Limited-time offer templates allow you to display expiration dates and running countdown timers for offer codes in template messages, making it easy for you to communicate time-bound offers and drive customer engagement.
LTO Object
Parameter
Type
Description
*expiration_time_ms
number
Offer code expiration time as a UNIX timestamp in milliseconds.
Position index of the button. Required if you have copy code button in your template.
*type
String
Type of the coupen code
*coupon_code
String
The coupon code to be copied when the customer taps the button.
/* Required if template uses offer expiration details, otherwise omit */"limited_time_offer":{"expiration_time_ms":1708804800000},"buttons":{/* Copy code button optional */"coupon_code":[{"index":0,"type":"copy_code","coupon_code":"GCBTS23"}],/* Can be omitted if url button in template has no variables */"actions":[{"action_type":"url","action_index":"1","action_payload":"/login"}]}
constClient=require('direct7')constclient=newClient(apiToken="Your API token")constresponse=awaitclient.whatsapp.sendWhatsAppTemplatedMessage({originator:"{{originator}}",recipients:[{"recipient":"{{recipient1}}","recipient_type":"individual"}],template_id:"{{template_id}}",language:"en",media_type:"image",media_url:"https://miro.medium.com/max/780/1*9Wdo1PuiJTZo0Du2A9JLQQ.jpeg",lto_expiration_time_ms:"1708804800000",coupon_code:"DWS44"});console.log('Templated message sent successfully. Response:',response);
fromdirect7importClientclient=Client(api_token="Your API token")client.whatsapp.send_whatsapp_templated_message(originator="{{originator}}",recipients=[{"recipient":"{{recipient1}}","recipient_type":"individual"}],language="en",template_id="{{template_id}}",media_type="image",media_url="https://miro.medium.com/max/780/1*9Wdo1PuiJTZo0Du2A9JLQQ.jpeg",lto_expiration_time_ms="1708804800000",coupon_code="DWS44")
import("github.com/d7networks/direct7-go-sdk/direct7")apiToken:="Your Api Token"client:=direct7.NewClient(apiToken)whatsapp:=direct7.NewWhatsApp(client)originator:="{{originator}}"recipients:=[]map[string]string{"recipient":"{recipient}","recipient_type":"individual",}templateId:="limited_time_offer"language:="en"optParams:=&OptionalParams{mediaType:"image"mediaURL:"https://miro.medium.com/max/780/1*9Wdo1PuiJTZo0Du2A9JLQQ.jpeg",ltoExpirationTimeMS:"1704272804",couponCode:"DWS44",}response,err:=client.whatsapp.SendWhatsAppTemplatedMessage(originator,recipients,templateId,language,optParams)
require'direct7'client=Direct7::Client.new('Your API token')client.whatsapp.send_whatsapp_templated_message(originator='{originator}',recipients=[{"recipient"=>"{recipient}","recipient_type"=>"individual"}],template_id="{template_id}",language="en",body_parameter_values=nil,media_type="image",text_header_title=nil,media_url="https://t4.ftcdn.net/jpg/01/43/23/83/360_F_143238306_lh0ap42wgot36y44WybfQpvsJB5A1CHc.jpg",latitude=nil,longitude=nil,name=nil,address=nil,lto_expiration_time_ms="1708804800000",coupon_code="DWS44")