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 is displayed in the 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 prerequisites to create an LTO template:

  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.
    The following are the prerequisites for using Kaleyra WhatsApp APIs to create an LTO template and send WhatsApp messages using LTO template:

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

You can use the LTO template in a WhatsApp message to send an LTO message through your WhatsApp account. The following is a sample screen of an WhatsApp LTO message on the end customer’s phone:

WhatsApp API request format to create LTO template

The following API request creates a marketing template that has a LTO code.

curl --location '<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=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\": [
     }"' \
--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 '' \
--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=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=@""' \
--form 'limited_time_offer="{
        \"text\": \"Hurry Up\",
        \"has_expiration\": true
}"' \
--form 'sample_media_url=""'

Parameter Description Table

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

ParameterData TypeDescriptionExampleMandatory?
SIDStringSecurity Identifier of your account.HXXXXXXX071USYes
api_keyStringYour API Key generated by
to_number 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.
channel_name StringChannel on which message must be sent.
For the WhatsApp channel, the only allowed value is WhatsApp.
from_number 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
body StringThe body of the message.Hi UserNo
languageStringThe language in which the message is sent.enYes
categoryStringThe message category.

Note: Only the ‘Marketing’ category is supported for LTO templates.
sample_media_fileStringThe location of the media file that will be embedded in the message.
Ensure you upload only the formats supported. Refer to
Messaging on WhatsApp Business for more details.
samplemedia_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_file and media_url are passed in API request, then only "media_url" is considered.
If a header is used, then only image/ video type is supported in the sample media field or sample _ media_url. Otherwise, this is not a mandatory field.
button_data ObjectThis is the button object that holds the button related details. The button appears as part of the message.button_data=
"type": "COPY_CODE",
"text": "DIWALI"
{ "type":"url",
"dynamic", "website_button_text":"button", "website_url":

"", "website_url_sample":""
] "
limited_time_offer ObjectThis field will hold in the values which define the LTO template.
Note: This object parameter is mandatory for an LTO template.
limited_time_offer =
"text": "Expiring offer!",
"has_expiration": true

Button_data object parameters description table

ParameterData TypeDescriptionExampleMandatory?
type StringThe type of the button based on its purpose.COPY_CODE, URLYes
text StringThe text that the button displays on the button.HAPPY_HOURSYes
website_url_typeStringThe type of URL the button contains
The values can be ‘static’ or ‘dynamic’.
Dynamic, StaticYes
website_button_text StringThe text (caption) the button displays buttonYes
website_url StringThe URL that the button takes you to, when clicked.https://www.favorite_shop.comYes
website_url_sample StringThe sample URL shown by the button.https://www.my_favorite_shop.comYes

Limited_time_offer object parameters description table

ParameterData TypeDescriptionExampleMandaotry?
textStringThe text that you want to show as ‘limited time offer’ text.Hurry Up! Ends in 2 days.Yes
has_expirationStringThe flag that indicates if the limited time offer has an expiration date.True, FalseYes

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