Send Template Message
Send a pre-approved WhatsApp template message to any user, regardless of the 24-hour service window. Template messages are the primary way to initiate conversations with customers.
Sends a pre-approved template message to a recipient. Templates can include dynamic variables in the header, body, and buttons. This is the only message type that can be sent outside the 24-hour customer service window.
No 24-Hour Restriction: Template messages are the only message type that can be sent outside the 24-hour customer service window. Templates must be pre-approved by Meta before use. You can manage templates from your dashboard or via the Templates API.
Parameters
| Parameter | Type | Description |
|---|---|---|
| token required | string | Your API authentication token. |
| phone required | string | Recipient phone number with country code. E.g., +919876543210. |
| template_name required | string | The exact name of the approved template as registered with Meta. Case-sensitive. |
| template_language required | string | Language code of the template. Common values: en, en_US, hi, es, pt_BR. |
| components optional | array | Array of component objects to fill template variables. Required if your template contains dynamic placeholders (1, 2, etc.). |
| carousel optional | object | Only for carousel templates. {"cards": [...]} — one entry per card, in card order. Each card accepts header_url (public image/video URL), body_params (values for the card's own variables) and buttons ({"index": 0, "payload": "..."} for a quick reply, {"index": 1, "text": "..."} for a URL button with a variable). Every field is optional: card media falls back to the media the template was created with, and a quick reply payload falls back to the button label. |
Component Format
The components array allows you to pass dynamic values into your template's header, body, and button placeholders. Each component targets a specific section of the template.
Body Variables
Replace 1, 2, etc. in the template body with dynamic text values.
Header Image
Provide a dynamic image for templates with an image header.
Button Variables
Provide dynamic values for URL buttons that contain a variable suffix (e.g., a tracking URL).
Examples
1. Simple Template (No Variables)
Send a template that has no dynamic placeholders, such as a static greeting or opt-in confirmation.
2. Template with Body Variables
Send a template that contains dynamic placeholders in the body, such as a customer name and order number.
Example template body: Hi 1, your 2 has been shipped and will arrive by 3.
3. Template with Header Image + Body Variables + Button
Send a rich template that includes a dynamic header image, body variables, and a URL button with a variable suffix.
4. Carousel Template
A carousel template sends one message bubble followed by 2–10 swipeable cards. Pass a carousel object instead of building the nested carousel component by hand — the card media, quick reply payloads and URL button values are filled in for you.
Send "carousel": {} (or omit it entirely) to reuse the card media the template was created with. Templates imported from Meta have no stored media, so those need an explicit header_url per card.
Rules Meta enforces on carousel templates: 2–10 cards, every card using the same media type (image or video), the same number and order of buttons on every card (1 or 2), a card body of at most 160 characters, and the MARKETING category.
Error Responses
Notes
Template Approval Required: All templates must be submitted to and approved by Meta before they can be used. Approval typically takes a few minutes to 24 hours. You can check template status in your dashboard or via the Templates API.
Variable Order Matters: The parameters in the components array are positional. The first parameter replaces 1, the second replaces 2, and so on. Ensure parameters are passed in the correct order.
Header Media: For templates with media headers, the image URL must be publicly accessible. Supported formats: JPEG and PNG. Maximum file size: 5 MB. The URL must use HTTPS.
Rate Limiting: WhatsApp applies per-template rate limits. If a template is flagged for low quality or high block rates, Meta may pause or disable it. Monitor template quality ratings in your dashboard.