STOP-LIGHT DOCUMENTATION for Template API

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

    • API Documentation

      Running an API in Postman is a straightforward process, but it becomes even more useful when you need to include custom headers and a specific JSON request body. In this guide, we'll walk you through the steps to run the WABA API using Postman with a ...
    • Cloud API Error Codes

      The Cloud API is built on the Graph API, so if you are unfamiliar with handling Graph API error responses, see Graph API's error handling documentation. In general, we recommend that you build your app's error handling logic around code values and ...
    • How to automate API campaigns using Pabbly?

      How Pabbly Works! Pabbly acts as an intermediate between two applications, transferring data from one app into another. Basically, it works on triggers & actions. A trigger on one app will lead to an action on the other app. Here are some trigger ...
    • Mastering Template Creation: A Comprehensive Guide

      Mastering Template Creation: A Comprehensive Guide The ability to create templates is a valuable talent in the fast-paced field of communication management as it may assure professionalism, consistency, and time savings. Having well-designed ...
    • What are rules for template formatting ?

      Text-based exclusively, including letters, figures, and special characters, emoticons, and WhatsApp-specific formatting (see formatting table below) There can't be more than 1024 characters. Template Name The name of a WhatsApp message template can ...