Skip to main content
POST

Overview

Sends a pre-approved WhatsApp message template to a recipient using your agent’s connected WhatsApp Business number. Use this to initiate conversations outside the 24-hour messaging window.
Templates must be approved by Meta before use. Your template must comply with Meta’s template guidelines — templates that don’t conform will be rejected or recategorized. Manage your templates in Meta Business Manager → WhatsApp Manager → Message Templates.

Request

Headers

string
required
Bearer token for authentication.
string
required
Must be application/json

Body Parameters

string
required
The UUID of the agent whose connected WhatsApp number will send the message.Example: "d920763c-59d8-490e-ad69-b6a3295e23a8"
string
required
The recipient’s phone number in E.164 format.Example: "+16045628647"
string
required
The exact name of your approved Meta template. Must match a template approved in your WhatsApp Business account.See Meta’s template guidelines for categorization rules.Example: "upcoming_site_report"
string
The language code for the template. Defaults to en_US.Example: "en_US"
array
Optional array of template component objects for passing variable values. Required if your template has dynamic variables.Each component maps to a section of your template (body, header, or button). Parameters are positional — the first parameter fills {{1}}, the second fills {{2}}, and so on, in the order they appear in your approved template.Body variables example — for a template with Hello {{1}}, your report for {{2}} on {{3}} is ready:
With header and body variables:
With a URL button variable — buttons require sub_type and index (zero-based position of the button in the template):
See Meta’s template component docs for the full component structure including quick reply buttons, images, and documents.
object
Optional arbitrary JSON object (must be a plain object — arrays are ignored) stored against this message. When the recipient replies to the conversation this template opens, Magpipe echoes this metadata back on the inbound event so you can attribute the reply to your own record (e.g. a schedule, project, or ticket). Because the template is the conversation opener, attaching metadata here is the recommended way to tag the whole thread.Example: { "schedule_id": "sch_123", "project_id": "proj_456" }

Response

boolean
true when Meta accepted the send request. See the note below — acceptance is not the same as delivery.
string
The WhatsApp message ID (wamid) returned by Meta.

Delivery is asynchronous

A success: true response with a message_id means Meta accepted the request — not that the message reached the recipient’s device. WhatsApp delivery is confirmed asynchronously, and a send can be accepted and then dropped (e.g. the WhatsApp Business Account isn’t verified, or per-recipient marketing limits are hit).
To confirm a template actually delivered, check the message’s eventual status rather than relying on the synchronous response:
  • List Messages (filter by the recipient phone_number) or Get Message — inspect status (sentdeliveredread, or failed/undelivered).
  • When a send fails, the message carries a delivery_error object with Meta’s code and reason, so you can self-diagnose without contacting support.
  • For push-based tracking, subscribe to message status events via Set Webhook.

Common delivery failures

Magpipe stores the template’s rendered body against the message; the delivery_error reason comes straight from Meta. A failed status with 131042/131049 is a Meta account/policy condition, not a Magpipe error — no Magpipe retry will deliver it until the underlying Meta issue is resolved.

Example Request

Example Response

Error Responses