Send session message
API to send a message to recipient on target channel, i.e. WhatsApp, SMS
post
/v1/businesses/{businessId}/send/messages
If you are trying to send a WhatsApp message and the number you are messaging has not messaged you within the last 24 hours, you will need to send a pre approved template message. See here for details.

24 hour WhatsApp restriction

If the recipient has not initiated the conversation first within the last 24 hours you CAN NOT send the messages to them. In this case, you MUST use templated message API /v1/businesses/{businessId}/send/whatsapp_templated_messages.
  • Generally, you use /v1/businesses/{businessId}/send/messages to reply to the customers who already messaged you first.
  • You use /v1/businesses/{businessId}/send/whatsapp_templated_messages to initiate with the customer first.

Select the WhatsApp number you want to send from

The endpoint supports an optional sender field in the body. If you have multiple WhatsApp phone numbers with Connectly you can choose which one you want to send the message from. The payload needs to contain the optional sender object specifying the phone number in the id section and channelType as whatsapp:
{
"sender": {
"id": "+14151111234",
"channelType": "whatsapp"
},
"recipient": {
"id": "+16044441111",
"channelType": "whatsapp"
},
"message": {
"text": "Hello!"
}
}

Send message with an attachment

You can include an attachment to the message. Currently, only a single attachment is supported.
{
"sender": {
"id": "+14151111234",
"channelType": "whatsapp"
},
"recipient": {
"id": "+16044441111",
"channelType": "whatsapp"
},
"message": {
"attachments": [
{
"type": "document",
"url": "https://cdn.connectly.ai/26fa/26fa1308-d328-41c9-a6a1-d5f4225a3768"
}
]
}
}

Send interactive list message

Use list_message to send a WhatsApp interactive list message. For more information, see WhatsApp documentation.
{
"sender": {
"id": "+14151111234",
"channelType": "whatsapp"
},
"recipient": {
"id": "+16044441111",
"channelType": "whatsapp"
},
"message": {
"text": "this is a list message",
"list_message": {
"header": {
"text": "header"
},
"footer": {
"text": "footer"
},
"button": {
"text": "a button"
},
"sections": [
{
"title": "Section 1",
"rows": [
{
"id": "row1",
"text": "item 1"
},
{
"id": "row2",
"text": "item 2"
}
]
},
{
"title": "Section 2",
"rows": [
{
"id": "row3",
"text": "item 3"
},
{
"id": "row4",
"text": "item 4"
}
]
}
]
}
}
}

Send interactive reply buttons message

Use reply_button_message to send interactive reply button message. For more information, see WhatsApp documentation.
{
"sender": {
"id": "+14151111234",
"channelType": "whatsapp"
},
"recipient": {
"id": "+16044441111",
"channelType": "whatsapp"
},
"message": {
"text": "this is a reply button message",
"reply_button_message": {
"header": {
"text": "header"
},
"footer": {
"text": "footer"
},
"buttons": [
{
"id": "b1",
"text": "button 1"
},
{
"id": "b2",
"text": "button 2"
},
{
"id": "b3",
"text": "button 3"
}
]
}
}
}
​