Send Free-form Whatsapp Messages
You can use our whatsapp messaging API to send free-form messages of types:
- Text messages
- Reaction message
- Media messages
- Location messages
- Contacts messages
- Interactive messages
Note:
All of these types, can be sent as a reply to a previous message. That means these type of messages can be send only when a customer service window exists..
See Also: Before starting, it is recommended to go through the basics of whatsapp message
Endpoint
POST
/whatsapp/v2/send
Header
Authentication
AUTHORIZATION: Bearer Token
Body
Object
{
"messages": [
{
"originator": "{registered phone_number}",
"content": {
"message_type": "<TYPE>",
/* FOR TEXT MESSAGES ONLY */
"text": {<TEXT>}
/* FOR REACTION MESSAGES ONLY */
"reaction": {<REACTION>}
/* FOR ATTACHMENT MESSAGES ONLY */
"attachment": {<MEDIA>}
/* FOR LOCATION MESSAGES ONLY */
"location": {<LOCATION>}
/* FOR CONTACTS MESSAGES ONLY */
"contacts": {<CONTACTS>}
/* FOR INTERACTIVE MESSAGES ONLY */
"interactive": {<INTERACTIVE>}
},
"recipients": [<recipient>],
"report_url": "{report url}"
}
]
}
{
"messages": [
{
"originator": "{registered phone_number 1}",
"content": {
"message_type": "<TYPE>",
/* FOR TEXT MESSAGES ONLY */
"text": {<TEXT>}
/* FOR REACTION MESSAGES ONLY */
"reaction": {<REACTION>}
/* FOR ATTACHMENT MESSAGES ONLY */
"attachment": {<MEDIA>}
/* FOR LOCATION MESSAGES ONLY */
"location": {<LOCATION>}
/* FOR CONTACTS MESSAGES ONLY */
"contacts": {<CONTACTS>}
/* FOR INTERACTIVE MESSAGES ONLY */
"interactive": {<INTERACTIVE>}
},
"recipients": [<recipient>],
"report_url": "{report url}"
},
{
"originator": "{registered phone_number 2}",
"content": {
"message_type": "<TYPE>",
/* FOR TEXT MESSAGES ONLY */
"text": {<TEXT>}
/* FOR REACTION MESSAGES ONLY */
"reaction": {<REACTION>}
/* FOR ATTACHMENT MESSAGES ONLY */
"attachment": {<MEDIA>}
/* FOR LOCATION MESSAGES ONLY */
"location": {<LOCATION>}
/* FOR CONTACTS MESSAGES ONLY */
"contacts": {<CONTACTS>}
/* FOR INTERACTIVE MESSAGES ONLY */
"interactive": {<INTERACTIVE>}
},
"recipients": [<recipient>],
"report_url": "{report url}"
}
]
}
{
"messages": [
{
"originator": "{registered phone_number}",
"content": {
"message_type": "<TYPE>",
/* FOR TEXT MESSAGES ONLY */
"text": {<TEXT>}
/* FOR REACTION MESSAGES ONLY */
"reaction": {<REACTION>}
/* FOR ATTACHMENT MESSAGES ONLY */
"attachment": {<MEDIA>}
/* FOR LOCATION MESSAGES ONLY */
"location": {<LOCATION>}
/* FOR CONTACTS MESSAGES ONLY */
"contacts": {<CONTACTS>}
/* FOR INTERACTIVE MESSAGES ONLY */
"interactive": {<INTERACTIVE>}
},
"recipients": [<recipient>],
"report_url": "{report url}"
}
],
"message_globals": { // Global message parameters for all message objects
"schedule_time": "2021-08-05T12:52+05:30",
}
}
Body parameters
Parameter | Type | Description |
---|---|---|
* originator | String | The Phone number of Sender/Header of a message. We can use your mobile number that is registered and approved in meta. |
* recipients | Array(Object) | Array of recipient object |
*message_type | String | Possible types in free-form message are: TEXT, REACTION, ATTACHMENT, LOCATION, CONTACTS, INTERACTIVE |
* text | TEXT object | If message type is TEXT, then add text object. See Text Messages. |
* reaction | REACTION object | If message type is REACTION, then add text object. See Reaction Messages. |
* attachment | MEDIA object | If message type is ATTACHMENT, then add media objects. See Media Messages |
* location | LOCATION object | If message type is LOCATION, then add location object. See Location Messages |
* contacts | CONTACTS object | If message type is CONTACTS, then add contacts object. See Contacts Messages |
* interactive | INTERACTIVE object | If message type is INTERACTIVE, then add interactive object. See Interactive Messages |
report_url | HttpUrl | To receive delivery status (DLR) for your message, specify the callback server URL where you want to receive the message status updates using the report_url parameter. When the delivery status changes, the status updates will be sent to the specified URL. See more |
schedule_time | String | Schedule request to send at specific time .format: YYYY-MM-DDTHH:MM+HH:MM , must be specified inside message_globals object |
Recipient Objects
Parameter | Type | Description | Value / Pattern |
---|---|---|---|
*recipient | Array(string) | Mobile Numbers to send Whatsapp seperated by comma in an array. The recipient's phone number should have a country code prefix. | +97156xxxxxxx |
*recipient_type | String | Default: individual. Now Support Only individual recipients | individual |
cust_ref | string | Any text to store reference of recipient | [email protected] |
message_tag1 | string | Any text tag for message reference | tag1 |
message_tag2 | string | Any text tag for message reference | tag2 |
message_tag3 | string | Any text tag for message reference | tag3 |
message_tag4 | string | Any text tag for message reference | tag4 |
message_tag5 | string | Any text tag for message reference | tag5 |
conversation_id | string | Any text for conversation reference | conversation_marketing |
"recipients": [
{
"recipient": "{{recipient1}}",
"recipient_type": "individual",
"reference": {
"cust_ref": "[email protected]",
"message_tag1": "d7id00001_m1",
"conversation_id": "d7id00001"
}
},
{
"recipient": "{{recipient2}}",
"recipient_type": "individual",
"reference": {
"cust_ref": "[email protected]",
"message_tag1": "d7id00001_m1",
"conversation_id": "d7id00001"
}
}
],
Response
When the request is validated, request_id, status and created time will be returned. Users can use this request_id to query status using the Get status endpoint.
200 - Success
401 - Unauthorized
404 - Not Found
Response Parameters
Parameter | Value / Pattern |
---|---|
request_id | Unique id for each Whatsapp message request. This request_id is required to check delivery status of your Whatsapp message. |
status | The status of Whatsapp message request. Possible request status are accepted and rejected |
created_at | Date and time of the Whatsapp message request. |
Programing Examples:
One to One Message (Text Message)
One to Many Message (Text Message)
|
|
|
|
|
|
|
|
|
|
Many to Many Message (Text Messages)
|
|
|
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
|
|
|
|
|
|