Send messages
Send buttons
Send reply or link buttons on WhatsApp, and action buttons on Instagram and Messenger, with POST /v1/messages.
POST /v1/messages with type: "interactive" sends reply or link buttons on WhatsApp. On Instagram and Messenger the equivalent is type: "buttons". 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 connection for the channel.
- An interactive message is a free-form message: it only goes out within 24 hours of the contact’s last message (see Windows). Outside it, use a template.
Reply buttons (WhatsApp)
Section titled “Reply buttons (WhatsApp)”interactive.type: "button" shows 1 to 3 buttons. When the contact taps one, the button id comes back to you.
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": "button", "header": { "type": "text", "text": "Your order" }, "body": { "text": "Your order #123 arrived. Did everything go well?" }, "footer": { "text": "Reply with one tap" }, "action": { "buttons": [ { "type": "reply", "reply": { "id": "sim", "title": "Yes" } }, { "type": "reply", "reply": { "id": "nao", "title": "No" } } ] } } }'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": "button", "header": { "type": "text", "text": "Your order" }, "body": { "text": "Your order #123 arrived. Did everything go well?" }, "footer": { "text": "Reply with one tap" }, "action": { "buttons": [ { "type": "reply", "reply": { "id": "sim", "title": "Yes" } }, { "type": "reply", "reply": { "id": "nao", "title": "No" } } ] } }});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": "button", "header": { "type": "text", "text": "Your order" }, "body": { "text": "Your order #123 arrived. Did everything go well?" }, "footer": { "text": "Reply with one tap" }, "action": { "buttons": [ { "type": "reply", "reply": { "id": "sim", "title": "Yes" } }, { "type": "reply", "reply": { "id": "nao", "title": "No" } } ] } }}Replace mj_... with your API key.
| Field | Rule |
|---|---|
interactive.body.text |
Required, 1 to 1024 characters. |
interactive.header |
Optional. { "type": "text", "text": "…" } with up to 60 characters. The type can also be image, video or document. |
interactive.footer.text |
Optional, up to 60 characters. |
interactive.action.buttons |
1 to 3 items { "type": "reply", "reply": { "id", "title" } }. |
reply.id |
1 to 256 characters. This is what you get back. |
reply.title |
1 to 20 characters. This is the button label. |
Link button (cta_url)
Section titled “Link button (cta_url)”interactive.type: "cta_url" shows a single button that opens a URL. header and footer are optional, as with reply buttons.
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": "cta_url", "body": { "text": "Track the delivery with the link." }, "action": { "name": "cta_url", "parameters": { "display_text": "Track order", "url": "https://exemplo.com/pedido/123" } } } }'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": "cta_url", "body": { "text": "Track the delivery with the link." }, "action": { "name": "cta_url", "parameters": { "display_text": "Track order", "url": "https://exemplo.com/pedido/123" } } }});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": "cta_url", "body": { "text": "Track the delivery with the link." }, "action": { "name": "cta_url", "parameters": { "display_text": "Track order", "url": "https://exemplo.com/pedido/123" } } }}Replace mj_... with your API key.
display_text is 1 to 20 characters and url is the page it opens.
Receiving the tap
Section titled “Receiving the tap”The tap arrives as a message.received event, with data.message.content of type reply:
{ "type": "message.received", "data": { "message": { "direction": "inbound", "content": { "type": "reply", "kind": "button", "id": "sim", "title": "Yes", "description": null, "payload": null } } }}id and title are those of the tapped button. Tie your logic to the id, not the text, which you may change.
Instagram and Messenger
Section titled “Instagram and Messenger”On these channels use type: "buttons": a text of 1 to 640 characters and 1 to 3 buttons. Each button is postback (title 1 to 20 and payload 1 to 1000 characters, returned when the contact taps) or web_url (title 1 to 20 and an https url). quick_replies is also accepted.
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": "17841400000000000", "type": "buttons", "buttons": { "text": "How can we help?", "buttons": [ { "type": "postback", "title": "Talk to sales", "payload": "vendas" }, { "type": "web_url", "title": "Visit site", "url": "https://exemplo.com" } ] } }'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": "17841400000000000", "type": "buttons", "buttons": { "text": "How can we help?", "buttons": [ { "type": "postback", "title": "Talk to sales", "payload": "vendas" }, { "type": "web_url", "title": "Visit site", "url": "https://exemplo.com" } ] }});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": "17841400000000000", "type": "buttons", "buttons": { "text": "How can we help?", "buttons": [ { "type": "postback", "title": "Talk to sales", "payload": "vendas" }, { "type": "web_url", "title": "Visit site", "url": "https://exemplo.com" } ] }}Replace mj_... with your API key.
For several cards with image, title and buttons, use type: "cards": 1 to 10 cards, with a title of up to 80 characters and, optionally, subtitle, image_url, default_url and buttons. See Message types.
Other interactive types
Section titled “Other interactive types”- Flows: Flows.
- Catalog, products and Pix order: Selling on WhatsApp.
- Call permission request: Calls.
- Option list: Send list.
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.