Create a Limited Time Offer (LTO) Code Template
The Limited Time Offer (LTO) WhatsApp templates have a limited-time-offer with an expiration date and a countdown timer displayed in the LTO template messages. The WhatsApp messages with these LTO offers, enable you to communicate with your customers about offers with limited time and help in better customer engagement.
Following are the steps to create a WhatsApp LTO code template.
- Pre-requisites:
- 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.. - 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.
- 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.
- Create a WhatsApp LTO code template.
- Use the LTO code template in a WhatsApp message to send an LTO code message.
You can use the LTO template in a WhatsApp message to send an LTO message.
The following is a sample screen of a WhatsApp LTO message on the end customer’s phone:

API Domain and Value
api_domain | Value |
---|---|
IN pod | api.in.kaleyra.io |
SG Pod | api.kaleyra.io |
EU Pod | api.eu.kaleyra.io |
NA pod | api.na.kaleyra.ai |
WhatsApp API request format to create LTO template
The following API request creates a marketing template that has a LTO code.
curl --location 'https://<api_domain>/v1/<sid>/whatsapp/template' \
--header 'api-key: <api-key>' \
--form 'name="<template_name>"' \
--form 'category="<category_name>"' \
--form 'language="<language>"' \
--form 'header="{\"type\": \"image\"}";type=application/json' \
--form 'body="<body>"' \
--form 'button_data="[
{
\"type\": \"<COPY_CODE>\",
\"text\": \"<text>\"
},
{
\"type\":\"<type>\",
\"website_url_type\":\"<website_url_type>\",
\"website_button_text\":\"<website_button_text>\",
\"website_url\":\"<website_url>\",
\"website_url_sample\":\"<website_url_sample>\"
}
] ";type=application/json' \
--form 'sample_body="<body>"' \
--form 'sample_header_content="{\"type\": \"image\"}"' \
--form 'allow_category_change="<allow_categroy_change>"' \
--form 'waba_id="<waba_id>"' \
--form 'example="{
\"body_text\": [
[
\"<body_text>\",
\"<body_text>\"
]
]
}"' \
--form 'sample_media_file=@"<media_file>"' \
--form 'limited_time_offer="{
\"text\": \"<text>\",
\"has_expiration\": <has_expiration_value>
}"'
Sample WhatsApp request for LTO template
The following API request creates an LTO template.
curl --location 'https://api.in.kaleyra.io/v1/HXXXXXXX071IN/whatsapp/template' \
--header 'api-key: XXXXX77c4d1cfa6854a7423a68e7XXXXX' \
--form 'name="lto_true_vid_dyan_test"' \
--form 'category="marketing"' \
--form 'language="en"' \
--form 'header="{\"type\": \"video\"}";type=application/json' \
--form 'body="Renew now at just ₹1499 💸
Catch the latest releases, Hotstar Specials and LIVE cricket:"' \
--form 'button_data="[
{
\"type\": \"COPY_CODE\",
\"text\": \"HAPPY_HOURS\"
},
{
\"type\":\"url\",
\"website_url_type\":\"dynamic\",
\"website_button_text\":\"button\",
\"website_url\":\"https://www.favorite_shop/\",
\"website_url_sample\":\"https://www.favorite_shop.com"
}
] ";type=application/json' \
--form 'sample_body="Renew now at just ₹1499 💸
Catch the latest releases, Hotstar Specials and LIVE cricket:"' \
--form 'allow_category_change="1"' \
--form 'sample_media_file=@"https://www.kaleyra.com/wp-content/uploads/kaleyra.png"' \
--form 'limited_time_offer="{
\"text\": \"Hurry Up\",
\"has_expiration\": true
}"' \
--form 'sample_media_url="https://d38vr2u95vsr9f.cloudfront.net/docs/1684759885mp4_file.mp4"'
Parameter Description Table
Following table shows the list of parameters and data types supported for LTO template:
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_number | String | A valid WhatsApp number of the recipient. Ensure that the country code is prefixed to the number. (E164 format). | +1202XXXXXXX | Yes |
channel_name | String | Channel on which message must be sent. | Yes | |
from_number | 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 |
body | String | The body of the message. | Hi User | No |
language | String | The language in which the message is sent. | en | Yes |
category | String | The message category. Note: Only the ‘Marketing’ category is supported for LTO templates. | Marketing | Yes |
sample_media_file | String | The location of the media file that will be embedded in the message. | Yes | |
samplemedia_url | String | The media URL should be public and have a file extension. | No | |
button_data | Object | This is the button object that holds the button related details. The button appears as part of the message. | button_data= "https://www.favorite_shop.com/", "website_url_sample":"https://www.favorite_shop.com" | Yes |
limited_time_offer | Object | This field will hold in the values which define the LTO template. | limited_time_offer = | No |
Button_data object parameters description table
Parameter | Data Type | Description | Example | Mandatory? |
---|---|---|---|---|
type | String | The type of the button based on its purpose. | COPY_CODE, URL | Yes |
text | String | The text that the button displays on the button. | HAPPY_HOURS | Yes |
website_url_type | String | The type of URL the button contains | Dynamic, Static | Yes |
website_button_text | String | The text (caption) the button displays | button | Yes |
website_url | String | The URL that the button takes you to, when clicked. | https://www.favorite_shop.com | Yes |
website_url_sample | String | The sample URL shown by the button. | https://www.my_favorite_shop.com | Yes |
Limited_time_offer object parameters description table
Parameter | Data Type | Description | Example | Mandaotry? |
---|---|---|---|---|
text | String | The text that you want to show as ‘limited time offer’ text. | Hurry Up! Ends in 2 days. | Yes |
has_expiration | String | The flag that indicates if the limited time offer has an expiration date. | True, False | Yes |
Sample success Response
The following is a sample success response.
{
"status": 200,
"message": "Template created successfully.",
"data": \[],
"error": {}
}
Sample error response
The following is a sample error response.
{
"error": {
"code": "E1020",
"type": "VALIDATION_ERROR",
"parameter": "sample media url",
"message": "Sample Media URL is not valid!",
"reference": ""
}
}
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."
}
}
Updated 17 days ago