Skip to main content

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:

FieldTypeDescription
namestringTemplate name.
languagestringLanguage code, for example en_US.
categorystringTemplate category, such as utility, marketing, or authentication.
statusstringApproval status, such as APPROVED, PENDING, or REJECTED.
parameter_formatstringParameter format, such as named or positional.
componentsarrayComponent objects for body, header, footer, and buttons.

Error Responses

HTTP StatusMessageDescription
500Failed to fetch WhatsApp templatesUnexpected 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

FieldTypeRequiredDescription
tostringYesRecipient phone number. E.164 format is recommended, for example +919876543210.
templateobjectYesWhatsApp template object. See Template Object.
campaignstringNoCampaign tag for tracking and analytics.
msg_idstringNoYour message ID for tracking or deduplication.
fromstringNoSender identifier.

Template Object

The template object follows the standard WhatsApp Cloud API template format.

FieldTypeRequiredDescription
template.namestringYesName of the approved WhatsApp template.
template.languageobjectNoLanguage object with a code field, for example { "code": "en_US" }.
template.namespacestringNoTemplate namespace.
template.componentsarrayNoComponent objects for body, header, and buttons.

Common component types:

TypeDescription
bodyText parameters for the template body.
headerHeader media or text parameters.
buttonButton 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

CodeMessageDescription
7001Invalid template parametersMissing or malformed template.name.
7002Invalid phone numberThe to field is not a valid phone number.
7004No WhatsApp phone number configured for this accountAccount has no WhatsApp phone configured.
7004Internal server errorUnexpected server-side error.
{
"status": "failure",
"error": {
"code": "7002",
"message": "Invalid phone number"
}
}