STOP-LIGHT DOCUMENTATION for Template API
STOP-LIGHT DOCUMENTATION
The released documentation covers how to use APIs to send templates directly from the Marketing panel.
POST https://connect.api-wa.co/project-apis/v1/project/{project_id}/messages
PARAMETER
Project_id : XXX
AUTH
X-API-WA-Project-API-Pwd: XXX
BODY
To: {Phone number}
Template: name: {template name}
Language: code: {Language code} eg “en” for English
Parameters:
Body
Text
"type": "text",
"text": "text-string"
Currency
"type": "currency",
"currency": {
"fallback_value": "$100.99",
"code": "USD",
"amount_1000": 100990
Date and Time
"type": "date_time",
"date_time": {
"fallback_value": "February 25, 1977",
"day_of_week": 5,
"year": 1977,
"month": 2,
"day_of_month": 25,
"hour": 15,
"minute": 33,
"calendar": "GREGORIAN"
Buttons
Call To Action Buttons
"type": "button",
"sub_type": {button_sub_type} eg URL here,
"index": "1", // index of the button, starts from 0
"parameters": [
{
"type": "payload",
"payload": {dynamic_text_for_button}
}
]
},
Parameter
Description
POST
Type of API call
Project Id
Project ID of account
Auth
API token for the Account
Phone Number
Phone number to whom the message needs to be sent
Template name
Name of the template you created
Language code
Language code that you selected for the template (en for English)
TEXT PARAMETERS
text
Text for variable 1 in body replacement
CURRENCY
fallback_value
Fallback value if there is no currency parameter
code
Currency used eg USD, INR
amount_1000
Amount
DATE AND TIME
Fallback_value
Fallback value if there is no date time parameter
BUTTONS
sub_type
There are multiple subtypes, eg URL
index
Index of the button, position, starts from 0
payload
Text value for the variable set in button.
Sample Value:
{
"messaging_product": "whatsapp",
"recipient_type": "individual",
"to": "1234567890",
"type": "template",
"template": {
"name": "customer_testing",
"language": {
"code": "en"
},
"components": [
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "UserName"
}
]
},
{
"type": "button",
"sub_type": "URL",
"index": "1",
"parameters": [
{
"type": "payload",
"payload": "about"
}
]
}
]
}
}
Sample Response:
{
"messaging_product": "whatsapp",
"contacts": [
{
"input": "1234567890",
"wa_id": "1234567890"
}
],
"messages": [
{
"id": "wamid.HBgMOTE5MDE2NTI",
"message_status": "accepted"
}
]
}
Explanation:
The format of the payload depends on the template format.
If the template has multiple text variables the parameters for text will increase.
For example,
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "UserName"
},
{
"type": "text",
"text": "CustomerID"
},
]
}
Here the parameter value will increase depending upon the number of variables in the template.
Same goes for the button. If there are two buttons with variables or dynamic URL link
The subtype and the count will depend upon that.
Also, there are multiple sub-types of buttons such as Catalog, URL and so on.
Following is the list of sub types that are currently supported:
CATALOG
COPY_CODE
FLOW
MPM
ORDER_DETAILS
QUICK_REPLY
REMINDER
URL
Kindly, look at template and select the type accordingly.
Related Articles
Message Template Guidelines
Templates Templates are used in template messages to open marketing, utility, and authentication conversations with customers. Unlike free-form messages, template messages are the only type of message that can be sent to customers who have yet to ...
API
Intro to APIs OCP API is used to retrieve data from the flow you build. Here are some examples that you could do with OCP API. Pull the flow you have built from OCP. Create, delete or obtain data including flow tag, flow field. Dealing with the data ...
Migrating from On-Premises API to Cloud API (or vice-versa)
This document explains how to migrate business phone numbers from On-Premises API to Cloud API. Note that migrating a business phone number from one API to another is not the same as migrating a number from one WhatsApp Business Account (WABA) to ...
Will the bot stop when reaching limits?
Unlike other chatbots in the market, we actually cares about you! Once your workspace consumes all bot user limits, the chatbots will not stop working. Rather OCP system will automatically start deleting old users with the longest last engagement ...
How to use Template message
Use in the flow builder Template messages offer more features, like the buttons(which can link to external URLs) & phone call button. You can send the template message right in the flow builder. It’s free to send if it’s within a 24-hour engagement ...