# Send buttons
pay attention
You can use the "Send Buttons" API in one case only:
If you send a message to a new client, or try to send a message to an old client (old client means that 24 hours since client's last message has passed), you must use the "Send Template Message" API instead.
If you send a template message to the client, and the client did not reply yet, and you want to send another message to him, you must use the template message again.
# Remarks
- You can use the "Send Buttons" API in one case only - for reply to a message that the client sent, within 24 hours since the client sent his last message. If you send a message to a new client, or try to send a message to an old client (old client means that 24 hours since client's last message has passed), you must use the "Send Template Message" API instead. If you send a template message to the client, and the client did not reply yet, and you want to send another message to him, you must use the template message again.
- You can only send a message to private people, not groups.
- The billing is per "conversation". conversation means a 24 hours session between you and the client (this 24 hours conversation session is unrelated to the 24 hours timer for template message)
- 24 hours session conversation starts when you send a message to the client.
- You can send unlimited messages within the 24 hours session time of a conversation.
- 24 hours session conversation starts when you send a message to the client.
- Every time the user replies, the template message session resets. which means that you don't have to use template message during this 24 hours template message session.
# Endpoint
POST https://019sms.co.il/whatsapp-api/send-buttons
# Header
Name | Type | Required |
---|---|---|
Authorization | Bearer authentication | ✔️ |
Content-Type | application/json | ✔️ |
# Parameters
# Request parameters
Name | Type | Description | Required |
---|---|---|---|
source | string | Your WhatsApp account. international number without +. for example: 972771234567 | ✔️ |
destination | string | The number you want to send the message to. for example: 972501234567 | ✔️ |
header | string | Header allows you to choose extra content as media 1-none 2-image 3-video 4-document | ✔️ |
headerURL | string | if you choose image/video/document as a header, here you must provide https URL for the file to be sent with the button image - jpg / png (up to 5 MB) video - mp4 (up to 16 MB) document - pdf (up to 100 MB) | Only if 'header' is 2/3/4 |
body | string | your message goes here. | ✔️ |
footer | string | Some footer message | ➖ |
button1 | string | The text of the button 1. maximum 20 characters. | ✔️ |
button2 | string | The text of button 2. maximum 20 characters | ➖ |
button3 | string | The text of button 3. maximum 20 characters | ➖ |
buttonExternal | string | In case you want button1 to be external button, here is the place you put the value. if buttonExternal is provided, button1 will be the text for the button. button2 and button3 will be ignored no Emoji support on button1 when using buttonExternal. | ➖ |
replyTo | string | In case you want to reply to a message that the end user has sent (quoted message), here you can provide the unique ID of that message | ➖ |
# Response
POST whatsapp-api/send-buttons HTTPS/1.1
Content-Type: application/json
{
"source": 972555555555,
"destination": 972550000000,
"header": "1",
"body": "this is body",
"footer": "Footer goes here",
"button1": "text of the button 1",
"button2": "text of the button 2",
"button3": "text of the button 3",
"replyTo": ""
}
# Response example
Content-Type: application/json
{
"success": true,
"ans": {
"status": "OK",
"unique": "HBgMOTcyNTI2ODkzMjQ1FQIAERgSRdDU4RjIyQjY2MEI5NUVEMUM4AA==",
"header": "1",
"body": "your body",
"footer": "your footer",
"button1": "your button 1",
"button2": "your button 2"
"button3": "your button 3"
"timestamp": 1600115719,
"from": "972555555555",
"to": "972550000000",
"templateTimeLeft": 0,
"conversationTimeLeft": 0,
"reason": 1
}
}
# Response parameters
Name | Type | Description | Options |
---|---|---|---|
success | boolean | The status of request. | true /false |
ans | object | The response object | |
ans -> status | string | Status of sending the message | OK / FAIL |
ans -> unique | string | Unique ID for any message | |
ans -> header | string | Your header selection (1/2/3/4) | |
ans -> body | string | the text you sent | |
ans -> footer | string | footer text | |
ans -> button1 | string | text for button 1 | |
ans -> button2 | string | text for button 2 | |
ans -> button3 | string | text for button 3 | |
ans -> timestamp | timestamp | Time stamp | |
ans -> from | string | Your WhatsApp account | |
ans -> to | string | The number that the message was sent to | |
ans -> templateTimeLeft | number | Amount of minutes left since client's last message. if passed, you must use Template Message. This value resets every time the client is sending you a message. | |
ans -> conversationTimeLeft | number | Amount of minutes left for the conversation session to end. if passed, any message after that, will be considered as a new conversation, and the timer will reset. | |
ans -> reason | string | The status explanation in case of FAIL | see the table below |
# Reason explanation
Reason | Description |
---|---|
1 | Not FAIL. the status is OK |
2 | Your "from" number account does not exist, or JSON syntax error |
3 | General error |
4 | 'to' is either empty or wrong number format or WhatsApp number does not exist |
5 | 'body' can't be empty |
6 | WhatsApp error |
7 | You are trying to send a message but it has been more than 24 hours since client's last message. please use 'Send Template' instead |
8 | You are trying to send a message for first time to a contact. please use 'Send Template' message instead |
9 | header is mandatory |
10 | footer is too long |
11 | button1 is missing or too long |
12 | button2 or button2 is too long |
13 | headerURL is mandatory for media 'header' |
14 | buttonExternal has invalid input |
15 | rate limit error |