Skip to main content

Chat API

Profile Requirements

To deliver a message to a recipient over Chat API, Courier must be provided a phone number or chat id. This value should be included in the recipient profile as chat_api.

//RecipientProfile using phone number
{
"chat_api": {
"phone_number": "12345678"
}
}
//RecipientProfile using chat id
{
"chat_api": {
"chat_id": "chat id"
}
}

Template

In the notification’s integration settings, a quoted message id and mentioned phone numbers can be provided

Override

Overrides can be used to change the request body that Courier uses to send a push message. Overrides are useful when a field is not yet supported by Courier or you would like to override the value that Courier generates. You can override any of the fields supported by Chat APIs /sendMessage endpoint (see all send request body fields here). Below is an example of overriding the token and the chat API instance for the configuration:

{
"event": "<COURIER_NOTIFICATION_ID>",
"recipient": "katherine_pryde",
"profile": {
"chat_api": {
"phone_number": "12345678"
}
},
"data": {
"name": "Katherine Pryde"
},
"override": {
"config": {
"instanceId": "<yourInstanceId>",
"token": "<yourToken>"
}
}
}