Template APIs
Use the template APIs to retrieve WhatsApp templates configured for your account and send approved WhatsApp template messages through Flowcall.
Authentication
Create an access token from Settings -> Integrations in the Flowcall dashboard.
Pass the token as a Bearer token in every request:
Authorization: Bearer <your_access_token>
Sync Templates
Retrieves all WhatsApp message templates configured for your account. Flowcall fetches templates from the WhatsApp Cloud API and returns them in the same general template format.
POST https://api.flowcall.co/apis/whatsapp/template-sync
Request Body
No request body is required. The account is identified from the access token.
Example Request
curl -X POST https://api.flowcall.co/apis/whatsapp/template-sync \
-H "Authorization: Bearer <your_access_token>" \
-H "Content-Type: application/json"
Success Response
Returns an object containing a data array of WhatsApp template objects:
{
"data": [
{
"name": "order_confirmation",
"language": "en_US",
"category": "utility",
"status": "APPROVED",
"parameter_format": "named",
"components": [
{
"type": "body",
"text": "Thank you, {{first_name}}! Your order number is {{order_number}}.",
"example": {
"body_text_named_params": [
{
"param_name": "first_name",
"example": "Pablo"
},
{
"param_name": "order_number",
"example": "860198-230332"
}
]
}
}
]
}
]
}
Template objects commonly include these fields:
| Field | Type | Description |
|---|---|---|
name | string | Template name. |
language | string | Language code, for example en_US. |
category | string | Template category, such as utility, marketing, or authentication. |
status | string | Approval status, such as APPROVED, PENDING, or REJECTED. |
parameter_format | string | Parameter format, such as named or positional. |
components | array | Component objects for body, header, footer, and buttons. |
Error Responses
| HTTP Status | Message | Description |
|---|---|---|
500 | Failed to fetch WhatsApp templates | Unexpected server-side error or account misconfiguration. |
{
"error": "Failed to fetch WhatsApp templates"
}
Send Template
Sends a WhatsApp template message through Flowcall. The template payload uses the WhatsApp Cloud API template object format, with optional Flowcall tracking fields.
POST https://api.flowcall.co/apis/whatsapp/template-send
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
to | string | Yes | Recipient phone number. E.164 format is recommended, for example +919876543210. |
template | object | Yes | WhatsApp template object. See Template Object. |
campaign | string | No | Campaign tag for tracking and analytics. |
msg_id | string | No | Your message ID for tracking or deduplication. |
from | string | No | Sender identifier. |
Template Object
The template object follows the standard WhatsApp Cloud API template format.
| Field | Type | Required | Description |
|---|---|---|---|
template.name | string | Yes | Name of the approved WhatsApp template. |
template.language | object | No | Language object with a code field, for example { "code": "en_US" }. |
template.namespace | string | No | Template namespace. |
template.components | array | No | Component objects for body, header, and buttons. |
Common component types:
| Type | Description |
|---|---|
body | Text parameters for the template body. |
header | Header media or text parameters. |
button | Button parameters, including URL buttons with sub_type: "url". |
Example Request
curl -X POST https://api.flowcall.co/apis/whatsapp/template-send \
-H "Authorization: Bearer <your_access_token>" \
-H "Content-Type: application/json" \
-d '{
"to": "+919876543210",
"campaign": "march-promo",
"template": {
"name": "order_confirmation",
"language": {
"code": "en_US"
},
"components": [
{
"type": "body",
"parameters": [
{ "type": "text", "text": "Pablo" },
{ "type": "text", "text": "860198-230332" }
]
}
]
}
}'
Example Template Definition
This is an example of the approved order_confirmation template that the send request can target:
{
"name": "order_confirmation",
"language": "en_US",
"category": "utility",
"parameter_format": "named",
"components": [
{
"type": "body",
"text": "Thank you, {{first_name}}! Your order number is {{order_number}}.",
"example": {
"body_text_named_params": [
{
"param_name": "first_name",
"example": "Pablo"
},
{
"param_name": "order_number",
"example": "860198-230332"
}
]
}
}
]
}
Success Response
{
"status": "success"
}
The API responds after request validation. Message delivery happens asynchronously.
Error Responses
| Code | Message | Description |
|---|---|---|
7001 | Invalid template parameters | Missing or malformed template.name. |
7002 | Invalid phone number | The to field is not a valid phone number. |
7004 | No WhatsApp phone number configured for this account | Account has no WhatsApp phone configured. |
7004 | Internal server error | Unexpected server-side error. |
{
"status": "failure",
"error": {
"code": "7002",
"message": "Invalid phone number"
}
}