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 kaleyra.io 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.

Base URL

https://<api_domain>/v1/<SID>

API Domain and Value

api_domainValue
IN podapi.in.kaleyra.io
SG Podapi.kaleyra.io
EU Podapi.eu.kaleyra.io
NA podapi.na.kaleyra.ai

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

curl --location 'https://<api_domain>/v1/<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 'https://api.in.kaleyra.io/v1/HXXXXXXX071IN/messages' \
--header 'api-key: Ac4XXXXX21f' \
--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="https://d38vr2u95vsr9f.cloudfront.net/docs/16879300632.jpg"'

Parameter description table

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

Parameter

Data Type

Description

Example

Mandatory?

SID

String

Security Identifier of your kaleyra.io account.

HXXXXXXX071IN

Yes

api_key

String

Your API Key generated by Kaleyra.io.

Ac4XXXXX21f

Yes

to

String

A 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.

+1202XXXXXXX

Yes

type

String

The message type.

media template

Yes

template_name

String

The template name.

coupon_template

Yes

channel

String

Channel on which the message is sent. For the WhatsApp channel, the only allowed value is WhatsApp.

WhatsApp

Yes

from

String

The 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).

+1202XXXXXXX

Yes

coupon_code

String

This field will hold the text that needs to be copied when the COPY CODE button is clicked.

coupon_code: “2532334”

Yes

callback_profile_id

String

The 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.

IN_b86b078e-046b-4565-892c-XXXXXXXXXXXX

No

media_url

String

The media URL should be public and have a file extension.

Note:

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.

https://www.kaleyra.com/wp-content/uploads/kaleyra.png

No

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."  
    }  
}




© 2025 Kaleyra Inc. All rights reserved.
Trademarks, logos and service marks displayed on this site are registered and unregistered trademarks of Kaleyra Inc.