Send Template Message API

This document details the Send Template Message API with which you can send template messages from your CRM or any custom software or tool.

The Send Message API endpoint and payload are tailored to each approved template message in your account. To send messages via the API, you’ll need to generate an API endpoint for the specific template you want to use.

Create API Endpoint
  1. Sign in to admin.emovur.com.

  2. Navigate to the WhatsApp -> Templates.

  3. Scroll to find and select the approved template.

  4. Click on "View/Edit Webhook details" icon against the approved template.

  5. Click on "Set Webhook details".

  6. If the header has media then you can choose to use static media or dynamic media, If not you will be taken to the final step:

    1. Dynamic - Use a public URL to pass the header media dynamically.

    2. Fixed- Select the source as a URL or upload an image, document, or video to use fixed header media.

  7. Click on "Submit".

  8. Now you will be able to see view the generated API endpoint and sample payload.

The following illustrations demonstrate three types of API payloads, helping you understand how to structure payloads for any template message.

Static Media Message with Dynamic Variables
Template Name :  Static Media Message with Dynamic Variables

Payload :  
{
  "receiver": "customer_mobile_number",
  "values": {
    "1": "custom_value",
    "2": "custom_value",
    "3": "custom_value"
  }
}

Webhook-Url :  "https://adminapis.backendprod.com/lms_campaign/api/whatsapp/template/20jpylrv97/process"

Webhook URL is the endpoint to which you have to submit the request.

In payload pass recipient number against key “receiver”.

Receiver Number format : <countrycode><mobile number> Example : +917411223344 Pass String values against dynamic variable “1”, “2”, “3”

Dynamic Media
Template Name :Dynamic Media

Payload :
{
  "receiver": "customer_mobile_number",
  "media_url": "media_url"
}
Webhook-Url :
"https://adminapis.backendprod.com/lms_campaign/api/whatsapp/template/uiw91c2k97/process

The medial URL should be public and secure. Supported Media Types : https://developers.facebook.com/docs/whatsapp/cloud-api/reference/media/#supported-media-types Example

https://static.remove.bg/sample-gallery/graphics/bird-thumbnail.jpg

One of the CTA button has Dynamic URL
Template Name :  Dynamic URL

Payload :  
{
  "receiver": "customer_mobile_number",
  "values": {
    "1": "custom_value"
  },
  "media_url": "media_url"
}

Webhook-Url :  "https://adminapis.backendprod.com/lms_campaign/api/whatsapp/template/ayd4zf7t83/process"

When a template's CTA includes a dynamic URL, you must provide the string to append to the static portion of the URL. Pass this value in the same way as dynamic variables within the template message.

API responses and Error codes

When you submit a Send Template Message API request to the Emovur server, we validate, process, and forward the request to Meta. We then provide an acknowledgment based on Meta's response. Upon successful submission, you will receive a response message. See the sample below:

Response


{
  "messaging_product": "whatsapp",
  "contacts": [
    {
      "input": "<WHATSAPP_USER_PHONE_NUMBER>",
      "wa_id": "<WHATSAPP_USER_ID>"
    }
  ],
  "messages": [
    {
      "id": "<WHATSAPP_MESSAGE_ID>",
      "message_status": "<PACING_STATUS>"
    }
  ]
}

Sample Response


{
    "messaging_product": "whatsapp",
    "contacts": [
        {
            "input": "9693971669",
            "wa_id": "919693971669"
        }
    ],
    "messages": [
        {
            "id": "wamid.HBgMOTE5NjkzOTcxNjY5FQIAERgSM0ExQzBFMjY5NjVEM0Q3MzJGAA==",
            "message_status": "accepted"
        }
    ]
}

If the message submission fails, an error message and code will be returned. You can refer to the Error Codes Documentation for detailed information on specific errors.

If the submission to the Emovur server is invalid or contains missing parameters, an error message will be returned as shown below.

Error Message
Description

The receiver field is required

Number format : <countrycode><mobile number> Example:

Country code : +91 Mobile Number : 7411223344 Should be structured as +917411223344

The values.n field is required

The value for dynamic variables in the message body or for the dynamic URL is missing.

Last updated