Send a template with buttons
Buttons are defined in the template when you create it. Once the
template is approved, every send of it shows the buttons. You add a BUTTONS component with up
to 10 buttons.
Button types
Section titled “Button types”| Button type | What the customer can do | Value needed at send time? |
|---|---|---|
QUICK_REPLY |
Tap a preset reply, for example “Yes” / “No” | No |
URL (fixed URL) |
Open a website | No |
PHONE_NUMBER |
Call your business | No |
URL with a {{1}} suffix |
Open a personalised link, for example a tracking page | Yes |
COPY_CODE |
Copy a coupon or OTP code | Yes |
Quick reply, URL and call buttons
Section titled “Quick reply, URL and call buttons”Template definition
Section titled “Template definition”{ "name": "delivery_confirmation", "language": "en", "category": "UTILITY", "components": [ { "type": "BODY", "text": "Hi {{1}}, your order {{2}} will be delivered tomorrow. Will you be home?", "example": { "body_text": [["Asha", "#10432"]] } }, { "type": "FOOTER", "text": "Tap a button to reply" }, { "type": "BUTTONS", "buttons": [ { "type": "QUICK_REPLY", "text": "Yes, I'll be home" }, { "type": "QUICK_REPLY", "text": "Reschedule" }, { "type": "URL", "text": "Track order", "url": "https://example.com/track" }, { "type": "PHONE_NUMBER", "text": "Call support", "phone_number": "+919812345678" } ] } ]}Buttons that need no value work exactly as approved — the request only fills the body variables:
curl -X POST "$HELLO_API_URL/v1/<your-phone-number-id>/messages" \ -H "Authorization: Bearer $HELLO_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "to": "+919999999999", "type": "template", "template": { "name": "delivery_confirmation", "language": { "code": "en" }, "components": [ { "type": "body", "parameters": [ { "type": "text", "text": "Asha" }, { "type": "text", "text": "#10432" } ] } ] } }'Dynamic URL and copy-code buttons
Section titled “Dynamic URL and copy-code buttons”A dynamic URL suffix or a copy-code value is supplied with each send in a button component,
alongside header/body:
{ "to": "+919999999999", "type": "template", "template": { "name": "order_tracking", "language": { "code": "en" }, "components": [ { "type": "body", "parameters": [{ "type": "text", "text": "Asha" }] }, { "type": "button", "sub_type": "url", "index": "0", "parameters": [{ "type": "text", "text": "ORD-10432" }] } ] }}sub_type is url or copy_code. index is the button’s position in the template’s
BUTTONS array ("0" for the first button), as a string. parameters[0].text is the URL
suffix or the code, matching the example given when the template was created.
When the customer taps a quick reply
Section titled “When the customer taps a quick reply”A quick-reply tap comes back to your number as a message from the customer, carrying the button’s text. It opens the 24-hour window, so you can follow up with free-form text or media without another template. See the reply in the dashboard or in your registered webhooks.
Button definitions
Section titled “Button definitions”type |
Fields | WhatsApp limits |
|---|---|---|
QUICK_REPLY |
text |
Label up to 25 characters |
URL |
text, url; for a variable suffix, url ends in {{1}} and example gives a full sample URL |
Up to 2 URL buttons |
PHONE_NUMBER |
text, phone_number in + international format |
1 per template |
COPY_CODE |
example: a sample code |
1 per template |
A template can have up to 10 buttons in total. WhatsApp shows the first three and puts the rest in a “See all options” list.