Send a message
After you have defined the message type(s) and channel(s) to use for your communication, use the send a Messages API message to create your request.
Depending on the channels and message type you use, remember to add additional options to your send request.
adaptationMode
Add the adaptationMode parameter to your API request to allow a message to be sent even if it contains elements that are unsupported by the channel.
For example, if you want to include a button in your SMS message, you can set the adaptationMode parameter to 'true' and the Messages API will handle the delivery of the message to WhatsApp as expected. However, it will render only text for the SMS channel.
If the parameter is set to 'false' and you attempt to send a message over a channel that does not support the defined element, then it will result in an error.
{
"messages": [
{
"channel": "WHATSAPP",
"content": {
"body": {
"text": "Thank you for joining us on Athleete Unlocked! Would you like to subscribe for future Athleete events?",
"type": "TEXT"
},
"buttons": [
{
"type": "REPLY",
"text": "Yes",
"postbackData": "true"
},
{
"type": "REPLY",
"text": "No",
"postbackData": "false"
}
]
},
"options": {
"adaptationMode": true
},
"sender": "441234567890",
"destinations": [
{
"to": "440987654321"
}
]
}
]
}
Output
SMS, MMS, and Viber with adaptationMode enabled.
Buttons
Messaging Channel | adaptationMode set to TRUE | adaptationMode set to FALSE |
---|---|---|
SMS | Text | Channel does not support buttons |
MMS | Text | Channel does not support buttons |
Text with buttons | Text with buttons | |
RCS | Text with buttons | Text with buttons |
Viber Business Messages | Text with buttons (only one) | Error if more than one button |
Apple Business Messages |
Text Buttons (separate message) |
Text Buttons (separate message) |
Google Business Messages | Text with buttons | Text with buttons |
Image
Messaging Channel | adaptationMode set to TRUE | adaptationMode set to FALSE |
---|---|---|
SMS |
URL of the image Image Caption |
URL of the image Image Caption |
MMS |
URL of the image Image Caption |
URL of the image Image Caption |
URL of the image Image Caption |
URL of the image Image Caption |
|
RCS | Image | It is not allowed to send RCS images with text |
Viber Business Messages |
URL of the image Image Caption |
URL of the image Image Caption |
Apple Business Messages |
Image Image caption |
Image Image caption |
Google Business Messages |
Image Image caption |
Image Image caption |
Image with header
Messaging Channel | adaptationMode set to TRUE | adaptationMode set to FALSE |
---|---|---|
SMS |
URL of the image Image Caption |
Channel does not support header |
MMS |
Message header Image Image Caption |
Message header Image Image Caption |
Image Image Caption |
Channel does not support header | |
RCS | Image | Channel does not support header |
Viber Business Messages |
Image Caption |
Channel does not support header |
Apple Business Messages |
Message header Image Image caption |
Message header Image Image caption |
Google Business Messages |
Message header Image Image caption |
Message header Image Image caption |
Templates
Messaging Channel | adaptationMode set to TRUE | adaptationMode set to FALSE |
---|---|---|
SMS | Channel does not support templates | Channel does not support templates |
MMS | Channel does not support templates | Channel does not support templates |
Template |
Template | |
RCS | Channel does not support templates | Channel does not support templates |
Viber Business Messages | Channel does not support templates | Channel does not support templates |
Apple Business Messages | Channel does not support templates | Channel does not support templates |
Google Business Messages | Channel does not support templates | Channel does not support templates |
Document
Messaging Channel | adaptationMode set to TRUE | adaptationMode set to FALSE |
---|---|---|
SMS |
URL of the document Document Caption |
Channel does not support documents without filenames |
MMS |
Document Document Caption |
Document Document Caption |
Document | Document | |
RCS | Channel does not support documents | Channel does not support documents |
Viber Business Messages | Channel does not support documents without filenames | Channel does not support documents without filenames |
Apple Business Messages |
Document Document Caption |
Document Document Caption |
Google Business Messages | Channel does not support documents | Channel does not support documents |
Video
Messaging Channel | adaptationMode set to TRUE | adaptationMode set to FALSE |
---|---|---|
SMS |
URL of the video Video caption |
Channel does not support video without filenames |
MMS |
Video Video caption |
Video Video caption |
Video Video caption |
Video Video caption |
|
RCS | Video | Channel does not support video with text |
Viber Business Messages |
Video Video caption |
Video Video caption |
Apple Business Messages |
Video Video caption |
Video Video caption |
Google Business Messages | Channel does not support videos | Channel does not support videos |
failover
User failover to always deliver your messages. This option provides messages delivery on other channels in case first option was unsuccessful.
You can:
- Automate channel switching - Messages API automatically changes channel in the event of a failed messages delivery.
- Configure validity period - Define period from 10 seconds to 48 hours for each channel. After validity period is expired, channel is switched and validity period for new channel starts.
- Customize failover flow - Define and prioritize channel failover order.
NotifyURL
Use the NotifyURL option if you want users to be able to set the URL where they want to receive API responses. Define the URL under the webhooks parameter of the API request.
{
"messages": [
{
"content": {
"body": {
"text": "Thank you for your registration!",
"type": "TEXT"
}
},
"webhooks": {
"delivery": {
"url": "https://notifyme.delivery"
},
"sender": "441234567890",
"destinations": [
{
"to": "440987654321"
}
],
"channel": "SMS"
}
}
]
}
callbackdata
Use callbackdata if you want to define additional data that users want to see in the delivery reports.