Send a Coupon Code Template Message

Using a WhatsApp coupon code template, you can send a WhatsApp coupon code message.

Following are the steps to send a WhatsApp coupon code message.

  1. Pre-requisites:
    1. An active account, if you do not have, you can contact a kaleyra representative to sign up for free to the platform. Before you get started, Create a Kaleyra Account and Create an API Key.
      To view the API Key and the SID, see View API Key and SID..
    2. An active WhatsApp for Business API plan that includes:
      A WhatsApp business number.
      An associated profile with the business number.
      A WhatsApp verified and approved profile.
  2. Create a WhatsApp coupon code template. See, Create a Coupon Code template.
  3. Use the WhatsApp coupon code template in a WhatsApp message to send a coupon code message.

The following WhatsApp API request format uses a coupon code template.

curl --location '<sid>/messages' \
--header 'api-key: <api-key>' \
--form 'to="<to-number>"' \
--form 'type="mediatemplate"' \
--form 'template_name="<template_name>"' \
--form 'params="\"<params>\""' \
--form 'channel="whatsapp"' \
--form 'from="<from-no>"' \
--form 'callback_profile_id’="<callback_profile_id>”’ \
--form 'coupon_code="\"<coupon_code>"”’ \
--form 'media_url="<media_url>”’

Sample WhatsApp API request message with coupon code template

The following API request sends a WhatsApp message with a coupon code template.

curl --location '' \
--header 'api-key: XXXXX77c4d1cfa6854a7423a68e7XXXXX' \
--form 'to="1202XXXXXXX"' \
--form 'type="mediatemplate"' \
--form 'template_name="cc_img_statics20"' \
--form 'params="\"Mike\",\"25%\""' \
--form 'channel="whatsapp"' \
--form 'from="+1202XXXXXXX"' \
--form 'callback_profile_id="IN_b86b078e-046b-4565-892c-XXXXXXXXXXXX"' \
--form 'coupon_code="\"2532334\""' \
--form 'media_url=""'

Parameter description table

Following table shows the list of parameters and data types supported:

ParameterData TypeDescriptionExampleMandatory?
SID StringSecurity Identifier of your account. HXXXXXXX071USYes
api_key StringYour API Key generated by
to StringA valid WhatsApp number of the recipient.
Ensure that the country code is prefixed to the number. (E164 format).
Note: You can add multiple numbers and separate each number using the comma (,) delimiter.
type StringThe message type. media templateYes
template_nameStringThe template name.coupon_templateYes
channel StringChannel on which the message is sent. For the WhatsApp channel, the only allowed value is WhatsApp.WhatsApp Yes
from StringThe 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).+1202XXXXXXXYes
coupon_code StringThis field will hold the text that needs to be copied when the COPY CODE button is clicked.coupon_code: “2532334”Yes
callback_profile_id StringThe callback ID created for WhatsApp channel to receive updates about the message delivery status.

Note: You can also use callback_url to get updates about the message delivery status to the specified URL.
media_url StringThe media URL should be public and have a file extension.


URL path is supported for image/video/media instead of uploading it.
If both media and media_url are passed in API request, then only "media_url" will be considered.
This parameter is mandatory only if used in the template header.

Sample success response

The following is a sample success response.

    "id": "2a584df7-79df-44a2-8cb0-efa5fc276125",  
    "type": "mediatemplate",  
    "body": null,  
    "createdDateTime": "2024-01-09 13:00:14+00:00",  
    "totalCount": 1,  
    "data": [  
            "message_id": "2a584df7-79df-44a2-8cb0-efa5fc276125:0",  
            "recipient": "919986517019"  
    "error": {}  

Sample error response

The following is a sample error response.

    "code": "RBC201",  
    "message": "Incorrect SID or API key.",  
    "data": \[],  
    "error": {  
        "error": "Incorrect SID or API key."