WhatsApp

Send WhatsApp messages

View as MarkdownOpen in Claude

All WhatsApp messages are sent through the same endpoint as SMS and MMS, POST /api/messaging/messages. Two things route a message over WhatsApp instead of SMS/MMS:

  • The from number is a whatsapp:-prefixed WhatsApp number (e.g. whatsapp:+15557654321).
  • You set a message_type (for content messages) or a template_id (for template messages).

WhatsApp on SignalWire is in early-access alpha. You must connect a WhatsApp business number before you can send messages.

For the full request schema (every field, every message type’s body shape, and authentication), see the Send a message API reference.

Messaging rules

Meta enforces specific rules about when and how a business can send WhatsApp messages:

ScenarioWhat you can send
No prior customer messageApproved templates only. You cannot start a free-form conversation until the customer has responded.
Customer messaged firstAny message type (text, media, interactive, or template) within a 24-hour window from the customer’s last inbound message.

Message types

Set message_type to one of the following for a content message. Each value determines the shape of body, shown below.

whatsapp_media_textobjectRequired
OR
whatsapp_media_imageobjectRequired
Send an image message, with an optional caption.
OR
whatsapp_media_audioobjectRequired
Send an audio message.
OR
whatsapp_media_videoobjectRequired
Send a video message, with an optional caption.
OR
whatsapp_media_documentobjectRequired
Send a document message, with an optional filename and caption.
OR
whatsapp_media_stickerobjectRequired
Send a sticker message. Captions are not supported.
OR
whatsapp_media_locationobjectRequired
Share a location.
OR
whatsapp_media_contactsobjectRequired
Share one or more contact cards.
OR
whatsapp_media_reactionobjectRequired
React to a message with an emoji.
OR
whatsapp_interactive_ctaobjectRequired
OR
whatsapp_interactive_listobjectRequired
OR
whatsapp_interactive_reply_buttonobjectRequired
OR
whatsapp_interactive_location_request_messageobjectRequired
Request the customer's location.

Examples

Plain text

1{
2 "to": "+15551234567",
3 "from": "whatsapp:+15557654321",
4 "body": "Your appointment is confirmed for tomorrow at 2pm.",
5 "message_type": "whatsapp_media_text"
6}

Interactive reply buttons

Send a message with tappable reply buttons, ideal for simple menus or surveys. The body.type is button and each entry in action.buttons is a reply button (up to 3).

1{
2 "to": "+15551234567",
3 "from": "whatsapp:+15557654321",
4 "body": {
5 "type": "button",
6 "body": { "text": "How can we help?" },
7 "action": {
8 "buttons": [
9 { "type": "reply", "reply": { "id": "sales", "title": "Talk to Sales" } },
10 { "type": "reply", "reply": { "id": "support", "title": "Get Support" } },
11 { "type": "reply", "reply": { "id": "exit", "title": "No thanks" } }
12 ]
13 }
14 },
15 "message_type": "whatsapp_interactive_reply_button"
16}

Template message

Use a template when reaching out to a customer for the first time, or outside the 24-hour window. Provide the template_id and fill in any placeholders; the template must be approved. Use an array for positional parameters or an object for named parameters.

1{
2 "to": "+15551234567",
3 "from": "whatsapp:+15557654321",
4 "template_id": "{template_id}",
5 "header_template_parameters": ["Jane Smith"],
6 "body_template_parameters": ["ORD-9821", "out for delivery"]
7}

Next steps