Skip to content

Send messages

Send list

Send a list of options with sections on WhatsApp using POST /v1/messages and receive the contact's choice.

POST /v1/messages with type: "interactive" and interactive.type: "list" shows a button that opens a list of options. It exists on WhatsApp only. The fields shared by every send are in Common fields.

  • An API key with the send permission (see Authentication).
  • An Active WhatsApp connection.
  • An interactive message is a free-form message: it only goes out within the 24-hour window (see Windows). Outside it, use a template.
Janela do terminal
curl https://api.messajo.com/v1/messages \
-H "Authorization: Bearer $MESSAJO_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"connection_id": "conn_...",
"to": "5511999999999",
"type": "interactive",
"interactive": {
"type": "list",
"header": {
"type": "text",
"text": "Support"
},
"body": {
"text": "What would you like to talk about?"
},
"footer": {
"text": "Pick an option"
},
"action": {
"button": "See options",
"sections": [
{
"title": "Orders",
"rows": [
{
"id": "status",
"title": "Order status",
"description": "Where is my delivery"
},
{
"id": "troca",
"title": "Exchange or return"
}
]
},
{
"title": "Account",
"rows": [
{
"id": "fatura",
"title": "Invoice copy"
},
{
"id": "humano",
"title": "Talk to a person",
"description": "Business hours support"
}
]
}
]
}
}
}'
Field Rule
interactive.body.text Required, 1 to 1024 characters.
interactive.header, interactive.footer Optional. Text header and footer with up to 60 characters.
action.button 1 to 20 characters. The label of the button that opens the list.
action.sections 1 to 10 sections.
sections[].title Optional, up to 24 characters.
sections[].rows At least 1 row.
rows[].id 1 to 200 characters. This is what you get back.
rows[].title 1 to 24 characters.
rows[].description Optional, up to 72 characters.

The choice arrives as a message.received event, with data.message.content of type reply and kind: "list":

{
"type": "message.received",
"data": {
"message": {
"direction": "inbound",
"content": {
"type": "reply",
"kind": "list",
"id": "status",
"title": "Order status",
"description": "Where is my delivery",
"payload": null
}
}
}
}

id, title and description are those of the chosen row. Tie your logic to the id.