Messages
Send buttons or a list
/messages/interactiveScope messages:sendSends a message the person answers by tapping: up to three reply buttons, or a list menu. Pass buttons or list, not both. Only works inside the 24-hour window.
Their choice comes back on the message.inbound webhook, with the id you gave the button or row in interactiveReplyId.
Body
tostringrequiredRecipient phone number with country code, for example
+919876543210. Spaces and dashes are ignored. A number without a country code is not guessed at and will not reach anyone.fromstringWhich of your WhatsApp numbers to send from. Accepts the number itself, its Meta
phone_number_idor its Wamafy id. Defaults to your default number.bodystringrequiredMain text. Up to 1,024 characters.
headerstringBold line above the body. Up to 60 characters.
footerstringSmall grey line below. Up to 60 characters.
buttonsobject[]One to three reply buttons.
idstringrequiredYour id for the button, returned when it is tapped.
titlestringrequiredButton text. Up to 20 characters.
listobjectA list menu, opened by a button.
buttonTextstringrequiredText on the button that opens the list. Up to 20 characters.
sectionsobject[]requiredOne to ten sections, each with a
title(optional, 24 characters) androws: one to ten items withid,title(24 characters) and an optionaldescription(72 characters).
Errors
| Status | Code | When |
|---|---|---|
| 400 | NO_OPEN_CONVERSATION | The window is closed. Send a template instead. |
| 422 | VALIDATION_ERROR | Both buttons and list were sent, or neither. |
Plus the errors any endpoint can return, such as a missing key or scope. See Errors.
# macOS, Linux or Git Bash, with WAMAFY_API_KEY set. The quoting does not work in Windows cmd or PowerShell.
curl -X POST "https://api.wamafy.com/api/v1/public/messages/interactive" \
-H "Authorization: Bearer $WAMAFY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"to": "+919876543210",
"body": "When should we deliver?",
"buttons": [
{
"id": "today",
"title": "Today"
},
{
"id": "tomorrow",
"title": "Tomorrow"
}
]
}'{
"success": true,
"data": {
"messageId": "wamid.HBgMOTE5ODc2NTQzMjEwFQIAERgSN0E",
"conversationId": "2b7e4f10-8c3a-4d2e-b1f6-0a9c5e7d3b21",
"status": "sent"
}
}Base URL https://api.wamafy.com/api/v1/public