Sending messages

The messages.send reference — text, templates, and flows.

Send a message with wabery.messages.send() (or POST /api/v1/messages). Set the channelId returned by the API, target either an existing conversation or a dedicated-channel WhatsApp phone number with opt-in, and provide exactly one content field.

Send text

await wabery.messages.send({
	channelId: "channel_...",
	conversationId: "conversation_...",
	text: "Thanks for your message",
});
curl https://api.wabery.com/v1/messages \
  -H "Authorization: Bearer $WABERY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "channel_id": "channel_...",
    "conversation_id": "conversation_...",
    "text": "Thanks for your message"
  }'

Send a template

Outside the 24-hour window, use an approved template instead of free-form text:

await wabery.messages.send({
	channelId: "channel_...",
	to: "+14155550100",
	template: {
		name: "order_shipped",
		language: "en",
		components: [
			{
				type: "body",
				parameters: [{ type: "text", text: "AB-2291" }],
			},
		],
	},
});
curl https://api.wabery.com/v1/messages \
  -H "Authorization: Bearer $WABERY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "channel_id": "channel_...",
    "to": "+14155550100",
    "template": {
      "name": "order_shipped",
      "language": "en",
      "components": [
        {
          "type": "body",
          "parameters": [{ "type": "text", "text": "AB-2291" }]
        }
      ]
    }
  }'

Send a Flow

Trigger a WhatsApp Flow to collect structured data in-chat:

await wabery.flows.send("flow_...", {
	channelId: "channel_...",
	contactId: "contact_...",
	bodyText: "Tell us about your project",
});
curl https://api.wabery.com/v1/flows/flow_.../send \
  -H "Authorization: Bearer $WABERY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "channel_id": "channel_...",
    "contact_id": "contact_...",
    "body_text": "Tell us about your project"
  }'

flows.send sends an interactive flow message, which Meta only allows inside the 24-hour window. To send by the contact's language, use flows.sendByConfigKey("config_key", { … }) — see Localization.

Proactive flows (outside the 24-hour window)

To reach a contact proactively, send an approved flow-type template (a template with a FLOW button) and pass the flow token via a button action:

await wabery.messages.send({
	channelId: "channel_...",
	to: "+14155550100",
	template: {
		name: "daily_reminder",
		language: "en",
		components: [
			{
				type: "button",
				sub_type: "flow",
				index: "0",
				parameters: [{ type: "action", action: { flow_token: "..." } }],
			},
		],
	},
});

Parameters

FieldTypeNotes
channelIdstringRequired channel id from channels.list().
tostringE.164 phone for dedicated WhatsApp channels.
conversationIdstringExisting conversation id.
textstringFree-form message (within the window).
templateobjectApproved WhatsApp template id, or name plus language.
mediaobjectImage, document, or video by public link or uploaded media id.
interactiveobjectWhatsApp button or list payload.

Provide exactly one of text, template, media, or interactive. Use wabery.flows.send() for WhatsApp Flows. A successful send returns 202 Accepted with the queued message id; delivery progress arrives later as message.status webhooks.

to sends are for dedicated WhatsApp channels with active opt-in. For the shared sandbox and inbound conversations, send with conversationId.

Sending messages | Wabery Docs | Wabery