Send a Text Template Message through WhatsApp

POST and GET Method

This API will help you create and send WhatsApp Message Templates.
Template messages are predefined messages that are used for standard communication and are designed to be reusable.

  1. Sign up for free

Before you get started, sign up for a account for free Create an API Key. To view the API Key and the SID, see View API Key and SID.

  1. Pre-requisites

Below listed are the pre-requisites for using Kalyera WhatsApp API’s

  • A WhatsApp business number.
  • An associated profile with the business number.
  • A WhatsApp verified and approved profile.

For more details, read what WhatsApp has to say about creating a business account.
Read Message Templates for any questions you may have about creating templates.

  1. Send a Text Template Message

You can use the below API’s to send a template message via WhatsApp account

Request Format - POST

curl -X POST "<SID>/messages" \
     -H "api-key: <API_KEY>" \
     -d "from=<FROM_NUMBER>" \
     -d "to=<TO_NUMBER>" \
     -d "type=<MESSAGE_TYPE>" \
     -d "channel=<CHANNEL_NAME>" \
     -d "template_name=<TEMPLATE_NAME>" \
     -d "params=<TEMPLATE_PARAMETERS>" \
     -d "lang_code=<LANGUAGE_CODE>" \
     -d "callback_url=<CALLBACK_URL>"

Request Format - GET

curl --request GET '<SID>/messages?channel=<CHANNEL_NAME>&to=<TO_NUMBER>&from=<FROM_NUMBER>&type=<MESSAGE_TYPE>&template_name=<TEMPLATE_NAME>&params=<TEMPLATE_PARAMETERS>&lang_code=<LANGUAGE_CODE>&callback_url=<CALLBACK_URL>' 
--header 'api-key: <API_KEY>'



Replace the placeholders above with relevant values as mentioned below.

SIDAccount SID (Security Identifier). Generated by while creating an API key.HXXXXXXX071USTrue
API_KEYYour API Key generated by
CONTENT_TYPEIndicates the format of the content the API will be processing.application/jsonTrue
FROM_NUMBERThe number registered with WhatsApp business from which the message is to be sent. Ensure that the country code is prefixed to the number. (E164 format).+1202XXXXXXXTrue
TO_NUMBERA valid WhatsApp number of the recipient. Ensure that the country code is prefixed to the number. (E164 format).

Note: You can add multiple recipients, separate each number using the comma (,) delimiter.
MESSAGE_TYPEThe type of message to be sent.templateTrue
CHANNEL_NAMEThe channel on which message must be sent.whatsappTrue
TEMPLATE_NAMEName of the WhatsApp template that was created in the portal. This name must be approved by WhatsApp before you start using this API.booking_confirmTrue
TEMPLATE_PARAMETERSThe values that you will pass when you want to send a message using the template. Since the values are dynamic, it must be passed through the key. Multiple parameters are allowed that must be separated with a comma.

For a template that says: Hi your booking id is for date the params to be passed would be
, <id_number>, .
"", "", ""True
LANGUAGE_CODEThe language code of the language that the template will allow.

'en' is the code for English.
For a comprehensive list of supported languages, read this
CALLBACK_URLThe URL that should send information to when your number receives a response. This URL can be accessed publicly.
Click here for an example.
  1. Response

If your request is successful, the response will be similar to the response shown below:

    "id": "1b408138-61bf-46d3-9a1d-f13089dbf0a5",
    "type": "template", 
    "createdDateTime": "2020-01-29 05:30:39+00:00", 
    "totalCount": 1, 
    "data": [
            "message_id": "1b408138-61bf-46d3-9a1d-f13089dbf0a5:0",
            "recipient": "1202XXXXXXX" 
    "error": {}

Error Codes

The below table provides information about the error codes you would receive when executing the WhatsApp Template Message API.

Error CodeParameterDescription
E13008from_invalidInvalid or in-correct input of the From number.
E13009to_invalidInvalid or in-correct input of the TO number.
E13004template_paramsThe Template params are not matching.
E13005template_name_missmatchInvalid template.