Configure Voucher

This request is used to configure a voucher with the appropriate settings on content, scheduling and rules.

HTTP Request

The request URL is the same as for submitting an SMS configuration but the POST parameters are different.

URLHTTP MethodDescription
https://app.tellody.com/CampaignCloud/Config POST Submit configuration

Parameters

NameDescription
title This defines the voucher title to appear in UI vouchers list. A string value requires to be set.
endDate Sets the date and time of voucher expiration. In case of an attempt to redeem the voucher past its expiration time, the voucher will not be valid and the voucher holder will not benefit from it. The end date is set as an integer value which represents the date in milliseconds. If the voucher should never expire, this value should be set to null or the parameter may be ommitted from the request.
campaignTemplateType This declares the type of configuration. For Voucher configuration it is set to the string "TELLODY_VOUCHER"
userId This is set to integer zero by default
sender This is the username of the Tellody user to create and send the SMS.
cycle This parameter is included under voucherConfig object and is set to boolean values. Setting this value to true will result in re-iteration of the configured rules after last rule takes effect (i.e. From last to first and so on).
redemptionMessages This is an object which defines a list of parameter pairs count-message inside voucherConfig object. Each such pair in "redemptionMessages" list defines a voucher rule. By default the system supports up to 20 rules which can be set in succession via the request. The parameter count is set to an integer value representing the quantity of redemptions that should take place to trigger the message. The parameter message is set to the actual string with the message. For example, if quantity is set to 3, the corresponding message will appear upon the third redemption of the same voucher
redemptionMessageCount This is set to an integer value and should be equal to the number of configured count-message pairs in the above redemptionMessagesstrong> list
pageTitleText This parameter is part of the page object/list inside the general voucherConfig. The relevant object which holds all the configuration of the voucher relenvant to the voucher's page is: voucherPageConfig. The parameter pageTitleText is set to the string value to appear as the title in the voucher's page.
pageText This parameter is also part of the voucherPageConfig list. It defines the text that will show up as the main text of the voucher's page and is set as a string value.
footerText This parameter is also part of the voucherPageConfig list. It defines the text that will show up as the footer of the voucher's page and is set to the filepath of the image file to be used. which should be located as a string value.
logoContentId This parameter is also part of the voucherPageConfig list. It defines the image to be used as a logo in the voucher's page and is set to the file id as a string value. As a prerequisite to set a logo the image file should exist in the system's CMS and its id should be known. The id of its file corresponds to the value of "filepath"key that is returned from CMS by Get CMS content request
backgroundColor This parameter is also part of the voucherPageConfig list. It defines the background colour of the voucher's page and is set as a string value in Hex triplet format.
fontColor This parameter is also part of the voucherPageConfig list. It defines the colour of the fonts in the voucher's page and is also set as a string value in Hex triplet format.

Sample Request

PythonOther

#Retrieving the XSRF Token needed for Session
pingResponse = my_session.get("https://app.tellody.com/CampaignCloud/RememberMeController/ping")

#Import the X-XSRF-Token returned from RememberMeController/ping into the request headers
xsrfToken = pingResponse.headers.get("X-XSRF-TOKEN")

#HTTP request header
header = {"Content-Type" : "application/json", "X-XSRF-TOKEN" : xsrfToken} 
data = {
   "title":"August Offer2",
   "endDate":1441019340000,
   "campaignTemplateType":"TELLODY_VOUCHER",
   "userId":0,
   "sender":"tester",
   "voucherConfig":{
      "cycle":False,
      "redemptionMessages":[
         {
            "count":1,
            "message":"1 piece of homemade cake"
         },
         {
            "count":3,
            "message":"1 pack of digestive bars"
         }
      ],
      "redemptionMessageCount":2
   },
   "voucherPageConfig":{
      "pageTitleText":"Coffee4U",
      "pageText":"Show this voucher to our shop and get your prize",
      "footerText":"Enjoy your summer vacations",
      "logoContentId":"file/digestive bar.jpgcampaign_43",
      "backgroundColor":"#D3D3D3",
      "fontColor":"#333333"
   }
}
url_config="http://www.tellody.com/CampaignCloud/Config"
response = my_session.post(url_config, header, data).json()
print(json.dumps(response,ensure_ascii=False))

Sample Response

The result of the request returns an alphanumeric string value which serves as the configuration identifier "id" which can be used later on to select this voucher.

{
   "title":"August Offer2",
   "voucherPageConfig":{
      "backgroundColor":"#D3D3D3",
      "footerText":"Enjoy your summer vacations",
      "pageText":"Show this voucher to our shop and get your prize",
      "pageTitleText":"Coffee4U",
      "fontColor":"#333333",
      "logoContentId":"file/digestive bar.jpgcampaign_43"
   },
   "sender":"tester",
   "campaignChannel":null,
   "userId":0,
   "id":"55cb3901c5ed6e0c60bbe12b",
   "endDate":1441019340000,
   "campaignTemplateType":"TELLODY_VOUCHER",
   "voucherConfig":{
      "redemptionMessageCount":2,
      "redemptionMessages":[
         {
            "count":1,
            "message":"1 piece of homemade cake"
         },
         {
            "count":3,
            "message":"1 pack of digestive bars"
         },
         .....
      ],
      "cycle":false
      .....
   }
}
  

Errors

If the result of the configuration does not return such a value, then the request has failed. More information on the issue can be derived by the HTTP response. (e.g. HTTP 400, 414 etc.)

Back to Top