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.
Before you start
Section titled “Before you start”- An API key with the
sendpermission (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.
Send a list
Section titled “Send a list”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" } ] } ] } } }'import { Messajo } from "@messajo/sdk";
const messajo = new Messajo({ apiKey: process.env.MESSAJO_API_KEY! });
const sent = await messajo.messages.send({ "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" } ] } ] } }});n8n HTTP Request node settings
- Method:
POST - URL:
https://api.messajo.com/v1/messages - Authentication: Generic Credential Type, then Header Auth. Name:
Authorization; Value:Bearer mj_... - Headers: turn on Send Headers and add
Idempotency-Key(a unique value per item) - Body: turn on Send Body; Body Content Type: JSON; Specify Body: Using JSON
{ "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" } ] } ] } }}Replace mj_... with your API key.
List fields
Section titled “List fields”| 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. |
Receiving the choice
Section titled “Receiving the choice”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.
Other interactive types
Section titled “Other interactive types”- Reply and link buttons: Send buttons.
- Flows: Flows.
- Catalog and Pix order: Selling on WhatsApp.
Common errors
Section titled “Common errors”outside_service_window(422): outside the 24 hours (windows). The window end is indetails[0].message.type_not_supported_by_channel(422): the channel does not accept this type. For example,interactiveon Instagram or Messenger, orbuttonson WhatsApp.validation_failed(400): the body breaks the rules, such as more than 3 buttons or a title over the limit.