Interactive Message
Interactive message using type: "interactive" and support several action types. These messages can only be sent within the 24-hour window (the recipient has previously sent a message to your number).
Interactive Types
Section titled “Interactive Types”Type action | Description | Max Items |
|---|---|---|
button | Quick reply buttons (up to 3 buttons) | 3 buttons |
list | Interactive list menu | 10 sections, 10 rows per section |
cta_url | Button that directs to a URL | 1 button |
flow | Button that opens a WhatsApp Flow | 1 button |
send_location Request the recipient to send a location | - |
1. Quick Reply button (button)
Section titled “1. Quick Reply button (button)”{ "messaging_product": "whatsapp", "to": "6281234567890", "type": "interactive", "interactive": { "type": "button", "body": { "text": "Apakah Anda ingin melanjutkan?" }, "action": { "buttons": [ { "type": "reply", "reply": { "id": "btn_yes", "title": "Ya" } }, { "type": "reply", "reply": { "id": "btn_no", "title": "Tidak" } } ] } }}Field interactive
Section titled “Field interactive”| Field | Type | Required | Description |
|---|---|---|---|
type | string | Yes | "button" for quick reply |
header | object | No | Text, image, video, or document header |
body | object | Yes | Message body, field text required |
footer | object | No | Footer, field text |
action | object | Yes | Action object with array buttons |
Field action.buttons[]
Section titled “Field action.buttons[]”| Field | Type | Description |
|---|---|---|
type | string | Always "reply" |
reply.id | string | Button ID (sent back in the webhook when clicked) |
reply.title | string | Button label, max 20 characters |
2. List Menu (list)
Section titled “2. List Menu (list)”{ "messaging_product": "whatsapp", "to": "6281234567890", "type": "interactive", "interactive": { "type": "list", "body": { "text": "Pilih layanan yang Anda butuhkan:" }, "footer": { "text": "Ketuk untuk melihat pilihan" }, "action": { "button": "Pilih Layanan", "sections": [ { "title": "Perbankan", "rows": [ { "id": "svc_check_balance", "title": "Cek Saldo", "description": "Lihat saldo rekening Anda" }, { "id": "svc_transfer", "title": "Transfer", "description": "Kirim uang ke rekening lain" } ] }, { "title": "Informasi", "rows": [ { "id": "svc_promo", "title": "Promo", "description": "Lihat promo terbaru" } ] } ] } }}Field action for List
Section titled “Field action for List”| Field | Type | Description |
|---|---|---|
button | string | Button label that opens the list, max 20 characters |
sections[] | array | Array of sections |
sections[].title | string | Section title |
sections[].rows[] | array | List of options within the section |
sections[].rows[].id | string | Row ID (sent back when selected) |
sections[].rows[].title | string | Row title, max 24 characters |
sections[].rows[].description | string | Optional description, max 72 characters |
3. CTA URL (cta_url)
Section titled “3. CTA URL (cta_url)”{ "messaging_product": "whatsapp", "to": "6281234567890", "type": "interactive", "interactive": { "type": "cta_url", "body": { "text": "Selesaikan pembayaran Anda sekarang." }, "action": { "name": "cta_url", "parameters": { "display_text": "Bayar Sekarang", "url": "https://pay.example.com/checkout/abc123" } } }}4. WhatsApp Flow (flow)
Section titled “4. WhatsApp Flow (flow)”{ "messaging_product": "whatsapp", "to": "6281234567890", "type": "interactive", "interactive": { "type": "flow", "body": { "text": "Silakan isi formulir pendaftaran." }, "action": { "name": "flow", "parameters": { "flow_message_version": "3", "flow_token": "tx_abc123", "flow_id": "1234567890", "flow_cta": "Mulai", "flow_action": "navigate", "flow_action_payload": { "screen": "WELCOME", "data": { "user_name": "Budi" } } } } }}Field action.parameters for Flow
Section titled “Field action.parameters for Flow”| Field | Type | Description |
|---|---|---|
flow_message_version | string | Always "3" |
flow_token | string | Correlation token to match with nfm_reply |
flow_id | string | ID of the Flow already published on Meta |
flow_cta | string | CTA button label |
flow_action | string | "navigate" (open the initial screen) or "data_exchange" |
flow_action_payload | object | Payload for flow_action="navigate" |
5. Location Request (send_location)
Section titled “5. Location Request (send_location)”{ "messaging_product": "whatsapp", "to": "6281234567890", "type": "interactive", "interactive": { "type": "button", "body": { "text": "Kirim lokasi Anda untuk menemukan cabang terdekat." }, "action": { "name": "send_location" } }}Complete Example (Quick Reply)
Section titled “Complete Example (Quick Reply)”curl -X POST https://messaging.cpaas.id/v1/YOUR_PHONE_NUMBER_ID/messages \ -H 'Authorization: Bearer YOUR_API_KEY' \ -H 'Content-Type: application/json' \ -d '{ "messaging_product": "whatsapp", "to": "6281234567890", "type": "interactive", "interactive": { "type": "button", "body": { "text": "Konfirmasi pesanan Anda?" }, "action": { "buttons": [ { "type": "reply", "reply": { "id": "confirm", "title": "Ya, konfirmasi" } }, { "type": "reply", "reply": { "id": "cancel", "title": "Batalkan" } } ] } } }'import requests
url = "https://messaging.cpaas.id/v1/YOUR_PHONE_NUMBER_ID/messages"headers = { "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json"}payload = { "messaging_product": "whatsapp", "to": "6281234567890", "type": "interactive", "interactive": { "type": "button", "body": {"text": "Konfirmasi pesanan Anda?"}, "action": { "buttons": [ {"type": "reply", "reply": {"id": "confirm", "title": "Ya, konfirmasi"}}, {"type": "reply", "reply": {"id": "cancel", "title": "Batalkan"}} ] } }}
response = requests.post(url, json=payload, headers=headers)print(response.json())const response = await fetch( 'https://messaging.cpaas.id/v1/YOUR_PHONE_NUMBER_ID/messages', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json', }, body: JSON.stringify({ messaging_product: 'whatsapp', to: '6281234567890', type: 'interactive', interactive: { type: 'button', body: { text: 'Konfirmasi pesanan Anda?' }, action: { buttons: [ { type: 'reply', reply: { id: 'confirm', title: 'Ya, konfirmasi' } }, { type: 'reply', reply: { id: 'cancel', title: 'Batalkan' } }, ], }, }, }), });const data = await response.json();console.log(data);Response
Section titled “Response”{ "messaging_product": "whatsapp", "messages": [ { "id": "msg_f7a816e2-8397-11f0-8e34-010203040506" } ]}Webhook Statuses You Will Receive
Section titled “Webhook Statuses You Will Receive”message.status.sent— The interactive message was sent successfullymessage.status.delivered— Message reached the recipient’s devicemessage.status.read— Message read by the recipient
If it fails, you receive message.status.failed.
When the recipient presses a button or selects an item from the list, you will receive a webhook message.inbound containing button_reply or list_reply with an ID you specify.
See the page Webhook for details on the payload format of each event.