Skip to main content

Messages API

The messages API allows you to send out messages to users on different channels. WhatsApp is currently the only channel that is supported. We're planning to introduce the ability to send messages for web chat, Facebook Messenger and many other channel types in future.

WhatsApp

If someone messages your WhatsApp Business number first, this is known as a User Initiated Conversation. WhatsApp then allows you to reply to this person for up to 24 hours since their last inbound message to you. You can use the API below to send these messages.

info

If you want to message a recipient first, WhatsApp considers this to be a Business Initiated Conversation. For this, you will need to use the Template API to send a WhatsApp template first and from then on you can use this API to send any follow-up messages for up to 24 hours after your template was sent or since the user's last reply to you.

Request Examples

Below are examples of how you can send various WhatsApp message types to recipients. See the authentication page for how to obtain a bearer token.

POST https://api.cuedesk.com/v1/messages
Authorization: Bearer <token>
Content-Type: application/json
{
"message": {
"channelType": "whatsapp",
"to": "447576209857",
"from": "447418371579", // your WhatsApp business number
"type": "text",
"content": {
"text": "This is an outbound text message"
}
}
}

Responses

A successful request will be responded to with a 202 Accepted status code. This is because the message still has to be sent upstream to WhatsApp where it can still fail. For example, if the message has been sent outside of the 24 hour reply window or the recipient's phone number is not on WhatsApp.

It is therefore strongly recommended that you look into setting up a message status update webhook to be notified about message failures.

Webchat

Request Examples

Below are examples of how you can send various Webchat message types to recipients. See the authentication page for how to obtain a bearer token.

POST https://api.cuedesk.com/v1/messages
Authorization: Bearer <token>
Content-Type: application/json
{
"message": {
"channelType": "webchat",
"to": "GNVyvzreqPJe4uoAkP0fbHGAmx7FiuPbYMFj", // The contact's identifier
"from": "83208a8b-9a71-4223-8252-a73a6f1f3b85", // Your webchat channel's identifier
"sessionUuid": "ff14af09-620d-4bca-bcb5-1aaa95cb0e1c", // The session's UUID
"type": "text",
"content": {
"text": "This is an outbound text message"
}
}
}

Responses

A successful request will be responded to with a 202 Accepted status code.