waiaconnect

Documentation / Essential

Messages with buttons and lists

POST /v1/messages

Markdown

Ready-to-copy example on GitHub: send-message/ →

Building with AI? Connect it to your account over MCP: it checks your setup, creates webhooks and templates with your confirmation and writes the code for you. See how →

Reply buttons, lists and a URL button, without a template: POST /v1/messages with type: "interactive" and Meta's interactive object, exactly as Meta documents it.

When: only inside the 24-hour window (the contact wrote to you in the last 24 hours), like free text. Outside the window Meta rejects it: the message ends failed with lastErrorCode: WINDOW_24H_EXPIRED (GET /v1/messages/:id and the message.status webhook). To message someone first you need an approved template.

Three types. button: 1 to 3 reply buttons. list: a button that opens a list of up to 10 options in sections. cta_url: one button that opens a web page.

Buttons (interactive.type: "button"):

{"type":"interactive","interactive":{"type":"button","header":{"type":"text","text":"Turno del jueves"},"body":{"text":"Hola Ana, ¿confirmás tu turno del jueves 20 a las 10:30?"},"footer":{"text":"Clínica Ejemplo"},"action":{"buttons":[{"type":"reply","reply":{"id":"turno-confirmar","title":"Confirmo"}},{"type":"reply","reply":{"id":"turno-cambiar","title":"Cambiar horario"}},{"type":"reply","reply":{"id":"turno-cancelar","title":"Cancelar"}}]}}}

List (interactive.type: "list"):

{"type":"interactive","interactive":{"type":"list","header":{"type":"text","text":"Menú del día"},"body":{"text":"Elegí tu pedido y te lo mandamos en 30 minutos."},"footer":{"text":"Pizzería Ejemplo"},"action":{"button":"Ver opciones","sections":[{"title":"Pizzas","rows":[{"id":"pz-muzza","title":"Muzzarella","description":"8 porciones · $9.000"},{"id":"pz-napo","title":"Napolitana","description":"8 porciones · $10.500"}]},{"title":"Bebidas","rows":[{"id":"bb-agua","title":"Agua 500 ml"}]}]}}}

URL button (interactive.type: "cta_url"): "action": { "name": "cta_url", "parameters": { "display_text": "See invoice", "url": "https://shop.example/invoices/A-1042" } }. Tapping it opens the browser: no webhook.

When the contact taps a button or picks a row you get message.received. data.message is Meta's, intact (type: "interactive"), and WAIA Connect adds data.reply: type (button_reply, list_reply, or button for a template quick reply), id (the one you sent), title, description (lists only) and messageId (the msg_… of the message tapped, if it went out through WAIA Connect):

{"type":"message.received","data":{"message":{"type":"interactive","context":{"id":"wamid.…"},"interactive":{"type":"button_reply","button_reply":{"id":"turno-confirmar","title":"Confirmo"}}},"reply":{"type":"button_reply","id":"turno-confirmar","title":"Confirmo","messageId":"msg_…"}}}

A tap opens the 24-hour window again.

Meta's limits (in characters; an emoji counts one). Buttons: title ≤ 20 and different from the others, id ≤ 256, body ≤ 1024, text header ≤ 60 or image, video or document, footer ≤ 60. List: button ≤ 20, up to 10 sections and 10 rows in total, row id ≤ 200 (unique), title ≤ 24 and description ≤ 72, section title ≤ 24 (required with more than one section), body ≤ 4096, text header only ≤ 60. URL button: text ≤ 20, body ≤ 1024.

Errors. Checked before anything goes to Meta: 400 INTERACTIVE_INVALID with every mistake at once in details.errors[] (field = the JSON path, code, message in your language; e.g. COUNT, TOO_LONG, DUPLICATE, HEADER_TEXT_ONLY). Idempotency-Key, the status (GET /v1/messages/:id) and delivery events work the same as for a text.

How it is charged. WAIA Connect charges the fixed fee per number and has no message cap: a message with buttons counts as one message, like a text. Meta charges separately, at its rate: inside the 24-hour window it is a service message, with 1,000 free per number per month; from the 1,001st Meta charges each one. Details: What Meta charges and what WAIA Connect charges.

# Only inside the 24-hour window (the contact wrote to you in the last 24 h).
curl -X POST https://api.waiaconnect.com/v1/messages \
  -H "Authorization: Bearer wc_live_YOUR_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"connectionId":"conn_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX","to":"5493511234567","type":"interactive","interactive":{"type":"button","body":{"text":"Hi Ana, can you confirm your appointment on Thursday at 10:30?"},"footer":{"text":"Example Clinic"},"action":{"buttons":[{"type":"reply","reply":{"id":"appt-confirm","title":"Confirm"}},{"type":"reply","reply":{"id":"appt-change","title":"Change time"}}]}}}'
# A list instead:       "interactive": {"type":"list","body":{"text":"Pick your order"},"action":{"button":"See options","sections":[{"title":"Pizzas","rows":[{"id":"pz-1","title":"Margherita","description":"8 slices"}]}]}}
# One URL button:       "interactive": {"type":"cta_url","body":{"text":"Your invoice is ready"},"action":{"name":"cta_url","parameters":{"display_text":"See invoice","url":"https://shop.example/inv/A-1042"}}}
# The tap comes back as message.received with data.reply:
# {"type":"button_reply","id":"appt-confirm","title":"Confirm","messageId":"msg_…"}
// Only inside the 24-hour window (the contact wrote to you in the last 24 h).
const res = await fetch("https://api.waiaconnect.com/v1/messages", {
  method: "POST",
  headers: {
    "Authorization": "Bearer wc_live_YOUR_API_KEY",
    "Idempotency-Key": crypto.randomUUID(),
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "connectionId": "conn_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "to": "5493511234567",
    "type": "interactive",
    "interactive": {
      "type": "button",
      "body": {
        "text": "Hi Ana, can you confirm your appointment on Thursday at 10:30?"
      },
      "footer": {
        "text": "Example Clinic"
      },
      "action": {
        "buttons": [
          {
            "type": "reply",
            "reply": {
              "id": "appt-confirm",
              "title": "Confirm"
            }
          },
          {
            "type": "reply",
            "reply": {
              "id": "appt-change",
              "title": "Change time"
            }
          }
        ]
      }
    }
  })
});
const sent = await res.json(); // { id: "msg_…", status: "queued" } — 400 INTERACTIVE_INVALID lists every mistake

// In your webhook handler, after verifying the signature:
if (evt.type === "message.received" && evt.data.reply) {
  const { type, id, title, messageId } = evt.data.reply; // type: button_reply | list_reply | button
  if (id === "appt-confirm") await confirmAppointment(evt.data.message.from, messageId); // your code
}
<?php
// Only inside the 24-hour window (the contact wrote to you in the last 24 h).
$ch = curl_init("https://api.waiaconnect.com/v1/messages");
curl_setopt_array($ch, [
  CURLOPT_POST => true,
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer wc_live_YOUR_API_KEY",
    "Idempotency-Key: " . bin2hex(random_bytes(16)),
    "Content-Type: application/json",
  ],
  CURLOPT_POSTFIELDS => json_encode(["connectionId" => "conn_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX","to" => "5493511234567","type" => "interactive","interactive" => ["type" => "button","body" => ["text" => "Hi Ana, can you confirm your appointment on Thursday at 10:30?"],"footer" => ["text" => "Example Clinic"],"action" => ["buttons" => [["type" => "reply","reply" => ["id" => "appt-confirm","title" => "Confirm"]],["type" => "reply","reply" => ["id" => "appt-change","title" => "Change time"]]]]]]),
]);
echo curl_exec($ch);

// In your webhook handler: $reply = $evt["data"]["reply"] ?? null;
// if ($reply && $reply["id"] === "appt-confirm") { /* your code */ }
import requests, uuid
# Only inside the 24-hour window (the contact wrote to you in the last 24 h).
res = requests.post("https://api.waiaconnect.com/v1/messages",
  headers={
    "Authorization": "Bearer wc_live_YOUR_API_KEY",
    "Idempotency-Key": str(uuid.uuid4()),
  },
  json={"connectionId":"conn_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX","to":"5493511234567","type":"interactive","interactive":{"type":"button","body":{"text":"Hi Ana, can you confirm your appointment on Thursday at 10:30?"},"footer":{"text":"Example Clinic"},"action":{"buttons":[{"type":"reply","reply":{"id":"appt-confirm","title":"Confirm"}},{"type":"reply","reply":{"id":"appt-change","title":"Change time"}}]}}})
print(res.json())  # {"id": "msg_…", "status": "queued"}

# In your webhook handler:
# reply = evt["data"].get("reply")
# if reply and reply["id"] == "appt-confirm": ...  # your code

Not the same as a template with buttons. A template with buttons (quick reply, URL, copy code) works outside the window, needs Meta's approval and may cost money depending on its category. An interactive message needs no approval, but only goes out within the 24 hours.

Coexistence: the 24-hour rule applies the same to what you send through the API. What you send from the WhatsApp Business app on the phone follows its own rules.

WAIA Connect does not store the text, titles or ids of your buttons: only how many there were.

Sending products or the catalog through /v1 is not available yet.