WhatsApp Business API for support menu — interactive buttons
This scenario sends an interactive button message with sendButton during the 24-hour customer service window.
Use case overview
This scenario sends an interactive button message with sendButton during the 24-hour customer service window. Three quick replies let the client choose main menu, order status, or agent handoff without typing.
Template example
How can we help you today?
Button titles and ids are fixed in the integration; only the session body text is customised when variables are added.
When to use it
- tier-1 support
Business value
- Inbound client message opens or continues the session window
- Interactive button message is sent with three labelled options
- Client taps a button and the webhook delivers the selection payload
- Backend routes menu, status, or agent handoff flows automatically
- Support team receives structured intent instead of ambiguous free text
Workflow
- A client message arrives via webhook and keeps the session open.
- Your backend sends the interactive button menu with footer guidance.
- The client taps one of the three options.
- The webhook delivers the button id for routing to menu, status, or agent flows.
- Delivery progress is reported asynchronously — typically
sent, thendelivered(or failed/undelivered). - Your system receives status via webhook (
hooks[]) or polls delivery status and handles failures if needed.
Technical implementation
Prerequisites
- An open WhatsApp session window and inbound webhook configured for button replies.
- 1MSG channel with sendButton access.
Code examples
Node.js
#!/usr/bin/env node
// === Configuration (replace "___" placeholders) ===
const API_BASE_URL = "https://api.1msg.io"; // production 1MSG API base URL
const CHANNEL_ID = "___"; // channel ID from 1MSG dashboard
const API_TOKEN = "___"; // channel JWT token (Bearer)
// === Test data ===
const TEST_PHONE = "___"; // client phone in international format · requires open 24-hour session window
function normalizePhone(phone) {
return String(phone).replace(/\D/g, "");
}
async function sendInteractiveButtonMessage({ phone }) {
const url = `${API_BASE_URL}/${CHANNEL_ID}/sendButton`;
const requestBody = {
phone: normalizePhone(phone),
body: `How can we help you today?`,
footer: "Choose an option",
sections: [
{ type: "reply", reply: { id: "menu", title: "Main menu" } },
{ type: "reply", reply: { id: "status", title: "Order status" } },
{ type: "reply", reply: { id: "agent", title: "Talk to agent" } }
],
};
const res = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${API_TOKEN}`,
},
body: JSON.stringify(requestBody),
});
const raw = await res.text();
let data;
try {
data = JSON.parse(raw);
} catch {
data = null;
}
if (!res.ok || !data || data.sent !== true) {
console.error("Send failed.");
console.error(raw);
process.exit(1);
}
console.log("Message sent to client.");
return data;
}
if (require.main === module) {
sendInteractiveButtonMessage({
phone: TEST_PHONE,
}).catch((err) => {
console.error("Execution failed:", err.message);
process.exit(1);
});
}
module.exports = { sendInteractiveButtonMessage };
Immediate API response (synchronous)
- HTTP 2xx and JSON
"sent": truemean 1MSG accepted the message for sending — not that it already reached the customer's phone. - Save the `id` field from the response (value looks like
wamid.…). Use it to correlate delivery callbacks or polling. - The response may also include
messageanddescription— informational only.
Delivery status (asynchronous)
- Register a webhook (
POST …/webhook) so 1MSG POSTs delivery updates to your HTTPS endpoint in a separate `hooks[]` payload (sent,delivered,read, or failed/undelivered when applicable). - Optionally poll:
GET {base}/{channel}/hookInfo?messageId=<id from sendTemplate>. - In practice, delivery often completes within a few seconds — but that is not guaranteed by the API contract.
Common errors
- Session window closed (no client message within 24 hours)
- Invalid or non-normalized phone number
- Missing or invalid message body / media URL
- Delivery failure — check status webhook and retry policy
FAQ
- Do I need a template? No — this scenario uses a session message inside the 24-hour customer service window.
- When does the session window close? If the client has not written or replied within 24 hours, sendMessage will fail until a template reopens the chat.
- How do I check delivery?
sent: trueonly confirms acceptance. Track delivery via webhookhooks[]or polling. - What if the message is not delivered? Log the failed/undelivered hook, verify the session window, then retry or use a template.
- Can I connect this to my CRM or backend? Yes — trigger the API call from your inbound webhook or workflow engine.
CTA
Ready to use support menu — interactive buttons? Connect your 1MSG channel and run the code examples above.
Related
Build WhatsApp automation in minutes
Use 1MSG to automate this workflow and try it with our free demo.
WhatsApp Business API for ticket additional info requestWhatsApp Business API for ticket accepted notificationWhatsApp Business API for team broadcast — create whatsapp groupWhatsApp Business API for support acknowledgement — reaction and read receiptWhatsApp Business API for support csat requestWhatsApp Business API for session reply — request additional informationWhatsApp Business API for issue resolved notificationWhatsApp Business API for specialist handoff — share contact card
