This Go package helps you send notifications through Courier, the smartest way to design & deliver notifications. Design your notifications once using our drag & drop editor, then deliver to any channel through one API. Email, mobile push, SMS, Slack — you name it!
APIs supported:
- Send API
- Messages API
- Profiles API
For a full description of request and response payloads and properties, please see the official Courier API docs.
Add this line to your go package:
import "github.com/trycourier/courier-go"
func send() {
var eventID = "example-event"
var recipientID = "example-recipient"
client := courier.CourierClient("<YOUR_AUTH_TOKEN>", nil)
messageID, err := client.Send(
context.Background(),
eventID,
recipientID,
map[string]string{"email": "foo@example.com"},
map[string]string{"favoriteAdjective": "awesomeness"},
"my-brand-id",
nil,
nil,
})
if err != nil {
log.Fatalln(err)
}
log.Println(messageID)
}
If you need to use a base url other than the default https://api.courier.com, you can pass it in as the second paramter to the CourierClient
:
client := courier.CourierClient("<AUTH_TOKEN>", "<BASE_URL>")
For a full description of request and response payloads and properties, please see the official Courier API docs.
Send(context, eventID string, recipientID string, profile interface{}, data interface{}, brand string, override interface{}, preferences interface{}): object
[?]SendToList(context, eventID string, listID string, pattern string, data interface{}, brand string, override interface{}): object
[?]
GetMessage(context, messageID string): object
[?]GetMessages(context, cursor string, event string, list string, messageId string, notification string, recipient string): object
[?]GetMessageHistory(context, messageID string, _type string): object
[?]
GetProfile(id string): object
[?]MergeProfile(id string, profile byte[]): object
[?]UpdateProfile(id string, profile byte[]): object
[?]
To update this SDK to the latest version, use go get -u github.com/trycourier/courier-go
.
The package is available as open source under the terms of the MIT License. MIT License