Send Buttons


You can use the "Send Buttons" API in one case only: You 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 more than 24 hours has passed since his last message), you must use the "Send Template Message" API instead. Sending contact is not available for template message, therefore, sending a contact message can only be when replying to a client. 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.



Explanation

The Send Buttons API allows you to send a message that includes up to 3 buttons OR external button: website/phone/email.


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)

  • 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.

  • When the end user clicks on the button, you will get it in the webhook as type "button" and the content of the button will be inside "body".

  • External button means that instead of normal 3 buttons, you can initiate an action to open a website or phone call or an email. if buttonExternal is in use, button1 will be the text for the button, while button2 and button2 will be ignored.


Settings:

URL

https://api.99digital.co.il/whatsapp/v2/sendButtons

Method

JSON via POST


Body:

Parameter

Description / Example

Mandatory

apiKey

Your API key for the service

yes

from

your WhatsApp account. international number without +. for example: 972771234567

yes

to

The number you want to send the message to. for example: 972501234567

yes

header

Header allows you to choose extra content as media

1 - none

2 - image

3 - video

4 - document

yes

headerURL

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

your message goes here.

\n for new line

text for bold

text for italic

~text~ for strike through

yes

footer

You can provide footer text that will be the in the bottom of the message.

\n for new line

text for bold

text for italic

~text~ for strike through

maximum 60 characters.

no

button1

The text of the button 1. maximum 20 characters.

yes

button2

The text of button 2. maximum 20 characters

no

button3

The text of button 3. maximum 20 characters

no

button1_id

The id of "button1".

you can set unique id that will be returned on the webhook.

maximum 256 characters. example: "my_button_1"

no

if not set, it will be default 1

button2_id

The id of "button2".

you can set unique id that will be returned on the webhook.

maximum 256 characters. example: "my_button_2"

no

if not set, it will be default 2

button3_id

The id of "button3".

you can set unique id that will be returned on the webhook.

maximum 256 characters. example: "my_button_3"

no

if not set, it will be default 3

buttonExternal

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.

Input

example

what will happen?

phone number (numbers only)

972501234567

the system will create a button that will initiate a phone call

link (must start with http or https)

https://www.google.com

the system will create a button that will initiate openning a website

email address

john@example.com

the system will create a button that will open the default email app to send an email

anything else

abcdefg

will be rejected with error code 14

no

replyTo

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

no

showRequest

You can get back in the response an object with all the request you sent (without the 'apiKey')

default is off (0)

1 - enable

no

localStorage

Whenever you provide headerURL, we deliver this URL to WhatsApp. They download the link in order to deliver it with your message.

If for any reason your file link is not accessible by WhatsApp and open to the internet, you can request us to download the image and provide Meta with alternative url to use, and not your own.

This will download the file, save it in our servers locally, deliver a new link for WhatsApp to use and then remove the file instantly.

default value is - 0 (disable)

enable - 1

** please note that using this feature may delay the response back from our server due to the operation described above.

localStorage will not work when buttonExternal is provided, and will use your link instead

no


Response:

{
"status": "OK",
"unique": "65dfd4r4dref34rdfxd34r",
"header": "your header",
"body": "your body",
"footer": "your footer",
"button1": "button 1 text",
"button2": "button 2 text",
"button3": "button 3 text",
"buttonExternal": "https://www.example.com",
"timestamp": 1600115719,
"from": "972507654321",
"to": "972501234567",
"templateTimeLeft": "400",
"reason": 1
}

Response-Explain:

Parameter

Description

status

OK or FAIL

**Note: OK status doesn't mean the message arrived to the end user. it only means that the system received your request.

You should listen to webhooks to see the status of your message.

unique

Unique ID for any message

header

Your header selection (1/2/3/4)

body

The text you sent

footer

Footer text

button1

Text for button 1

button2

Text for button 2

button3

Text for button 3

timestamp

Timestamp

from

Your WhatsApp account

to

The number that the message was sent to

templateTimeLeft

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.

reason

'reason' is the status explanation in case of FAIL

1

Not FAIL. the status is OK

2

Your "from" number account does not exist, or JSON syntax error

3

Wrong apiKey

4

 'to' is either empty or wrong number format

5

'body' can't be empty

6

WhatsApp error - try again

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, try again

16

button1_id or button2_id or button3_id is invalid, wrong, not unique or exceeded the maximum lengh.