post https://partner.gupshup.io/partner/app//templates
Use this API to create a LTO template.
Request Parameters
Key | Description | Value | Data Type | Required/Optional | Constraints |
---|---|---|---|---|---|
Authorization | Access Token for the application | {{PARTNER_APP_TOKEN}} | String | Required | Should be a valid Partner App Access Token |
elementName | The name of a template. The element name is unique for a WABAs namespace. | {{ELEMENT_NAME}} | String | Required | elementName (not more than 180 char.) Mandatory fields |
languageCode | Language code for the template. Refer to all the language codes here. | {{LANGUAGE_CODE}} | String | Optional | languageCode default value : en_US |
content | The body of the template. | {{CONTENT}} | String | Required | content (not more than 1024 char.) |
category | The category of your template. | {{CATEGORY}} | String | Required | Category Type: MARKETING UTILITY |
vertical | TEXT | {{VERTICAL}} | String | Required | vertical (not more than 180 char.) |
templateType | CAROUSEL | {{TEMPLATE_TYPE}} | String | Required | The type of template: CAROUSEL Cards only to be passed if template type is CAROUSEL |
example | Template Example | {{EXAMPLE}} | String | Required | |
enableSample | Required for creating all types of templates | {{ENABLE_SAMPLE}} | true/false | Optional | if enableSample is true then exampleMedia |
buttons | buttons list | [{"type":"COPY_CODE","example":"250FF"},{"type":"URL","text":"Shop Now","url":"<https://www.luckyshrub.com/shop?promo={{1}}","example":["summer2023"]},{"type":"URL","text":"Website","url":"https://www.luckyshrub.com/shop?promo={{1}}","example":["summer2023"]},{"type":"PHONE_NUMBER","text":"Call","phone_number":"918016337728"},{"type":"QUICK_REPLY","text":"Yes"},{"type":"QUICK_REPLY","text":"No"},{"type":"QUICK_REPLY","text":"Unsubscribe> from Promos"},{"type":"QUICK_REPLY","text":"Red"},{"type":"QUICK_REPLY","text":"Blue"},{"type":"QUICK_REPLY","text":"Green"}] | String | Required | |
hasExpiration | Set true to add expiration to LTO templates | {{HAS_EXPIRATION}} | Boolean | Required | Copy code button component required if "has_expiration" is set to true. |
isLTO | LTO creation param | {{ISLTO}} | Boolean | Required | Needs to be true to create LTO templates |
limitedOfferText | LTO creation param | {{LIMITED_OFFER_TEXT}} | String | Required | |
allowTemplateCategoryChange | Boolean value. If True, Meta will automatically update the template category as per the template content. The default value is False. | {{ALLOW_TEMPLATE_CATEGORY_CHANGE}} | true/false | Optional | |
appId | App ID to fetch the access token | {{APP_ID}} | String | Required | The Id should be a valid app Id of Gupshup The App must be associated with the account that owns the PARTNER_APP_TOKEN being used |
Sample Request
curl --request POST \
--url https://partner.gupshup.io/partner/app/{{APP_ID}}/templates \
--header 'accept: application/json' \
--header 'content-type: application/x-www-form-urlencoded' \
--header 'Authorization: sk_8eb35b1f81c24af293a405164a392f30' \
--data hasExpiration=true \
--data isLTO=true \
--data elementName=lto_temp_1 \
--data languageCode=en \
--data 'content=Hi All, Here are our products.' \
--data category=MARKETING \
--data vertical=aaa \
--data templateType=TEXT \
--data 'example=Hi All, Here are our products.' \
--data allowTemplateCategoryChange=false \
--data enableSample=false \
--data 'buttons=[{"type":"COPY_CODE","example":"250FF"},{"type":"URL","text":"Shop Now","url":"https://www.luckyshrub.com/shop?promo={{1}}","example":["summer2023"]},{"type":"URL","text":"Website","url":"https://www.luckyshrub.com/shop?promo={{1}}","example":["summer2023"]},{"type":"PHONE_NUMBER","text":"Call","phone_number":"918016337728"},{"type":"QUICK_REPLY","text":"Yes"},{"type":"QUICK_REPLY","text":"No"},{"type":"QUICK_REPLY","text":"Unsubscribe from Promos"},{"type":"QUICK_REPLY","text":"Red"},{"type":"QUICK_REPLY","text":"Blue"},{"type":"QUICK_REPLY","text":"Green"}]' \
--data 'limitedOfferText=offer limited'
Sample Response
{
"status": "success",
"template": {
"appId": "07c7c72d-xxxx-xxxx-xxxx-14d1186eeec8",
"buttonSupported": "CC,PN,QR,URL",
"category": "MARKETING",
"containerMeta": "{\"appId\":\"07c7c72d-xxxx-xxxx-xxxx-14d1186eeec8\",\"data\":\"Hi All, Here are our products.\",\"buttons\":[{\"type\":\"COPY_CODE\",\"example\":\"250FF\"},{\"type\":\"URL\",\"text\":\"Shop Now\",\"url\":\"https://www.luckyshrub.com/shop?promo={{1}}\",\"example\":[\"summer2023\"]},{\"type\":\"URL\",\"text\":\"Website\",\"url\":\"https://www.luckyshrub.com/shop?promo={{1}}\",\"example\":[\"summer2023\"]},{\"type\":\"PHONE_NUMBER\",\"text\":\"Call\",\"phone_number\":\"918016337728\"},{\"type\":\"QUICK_REPLY\",\"text\":\"Yes\"},{\"type\":\"QUICK_REPLY\",\"text\":\"No\"},{\"type\":\"QUICK_REPLY\",\"text\":\"Unsubscribe from Promos\"},{\"type\":\"QUICK_REPLY\",\"text\":\"Red\"},{\"type\":\"QUICK_REPLY\",\"text\":\"Blue\"},{\"type\":\"QUICK_REPLY\",\"text\":\"Green\"}],\"sampleText\":\"Hi All, Here are our products.\",\"enableSample\":true,\"editTemplate\":false,\"allowTemplateCategoryChange\":false,\"addSecurityRecommendation\":false,\"limitedTimeOffer\":{\"text\":\"offer limited\",\"has_expiration\":true}}",
"createdOn": 1720520894377,
"data": "Hi All, Here are our products.\noffer limited | true | [Copy offer code,{{1}}] | [Shop Now,https://www.luckyshrub.com/shop?promo={{1}}] | [Website,https://www.luckyshrub.com/shop?promo={{1}}] | [Call,918016337728] | [Yes] | [No] | [Unsubscribe from Promos] | [Red] | [Blue] | [Green]",
"elementName": "lto_temp_2",
"id": "fe6be44e-11f1-4c31-8ea3-08c06b51ded9",
"languageCode": "en",
"languagePolicy": "deterministic",
"meta": "{\"example\":\"Hi All, Here are our products.\"}",
"modifiedOn": 1720520894377,
"namespace": "5ff5f84e_789b_44df_80dd_6844d48a6a4a",
"priority": 1,
"quality": "UNKNOWN",
"retry": 0,
"stage": "NONE",
"status": "PENDING",
"templateType": "TEXT",
"vertical": "aaa",
"wabaId": "116676371511027"
}
}
Status Codes
Status Code | Response | Comment |
---|---|---|
Success | ||
200 | { "status": "success", "template": { "appId": "07c7c72d-20e3-4ff9-a5a1-14d1186eeec8", "buttonSupported": "CC,PN,QR,URL", "category": "MARKETING", "containerMeta": "{\"appId\":\"07c7c72d-20e3-4ff9-a5a1-14d1186eeec8\",\"data\":\"Hi All, Here are our products.\",\"buttons\":\[{\"type\":\"COPY_CODE\",\"example\":\"250FF\"},{\"type\":\"URL\",\"text\":\"Shop Now\",\"url\":\"<https://www.luckyshrub.com/shop?promo={{1}}\",\"example\":[\"summer2023\"]},{\"type\":\"URL\",\"text\":\"Website\",\"url\":\"https://www.luckyshrub.com/shop?promo={{1}}\",\"example\":[\"summer2023\"]},{\"type\":\"PHONE_NUMBER\",\"text\":\"Call\",\"phone_number\":\"918016337728\"},{\"type\":\"QUICK_REPLY\",\"text\":\"Yes\"},{\"type\":\"QUICK_REPLY\",\"text\":\"No\"},{\"type\":\"QUICK_REPLY\",\"text\":\"Unsubscribe> from Promos\"},{\"type\":\"QUICK_REPLY\",\"text\":\"Red\"},{\"type\":\"QUICK_REPLY\",\"text\":\"Blue\"},{\"type\":\"QUICK_REPLY\",\"text\":\"Green\"}],\"sampleText\":\"Hi All, Here are our products.\",\"enableSample\":true,\"editTemplate\":false,\"allowTemplateCategoryChange\":false,\"addSecurityRecommendation\":false,\"limitedTimeOffer\":{\"text\":\"offer limited\",\"has_expiration\":true}}", "createdOn": 1720520894377, "data": "Hi All, Here are our products.\\noffer limited | true | [Copy offer code,{{1}}] | [Shop Now,https://www.luckyshrub.com/shop?promo={{1}}] | [Website,https://www.luckyshrub.com/shop?promo={{1}}] | [Call,918016337728] | [Yes] | [No] | [Unsubscribe from Promos] | [Red] | [Blue] | [Green]", "elementName": "lto_temp_2", "id": "fe6be44e-11f1-4c31-8ea3-08c06b51ded9", "languageCode": "en", "languagePolicy": "deterministic", "meta": "{\"example\":\"Hi All, Here are our products.\"}", "modifiedOn": 1720520894377, "namespace": "5ff5f84e_789b_44df_80dd_6844d48a6a4a", "priority": 1, "quality": "UNKNOWN", "retry": 0, "stage": "NONE", "status": "PENDING", "templateType": "TEXT", "vertical": "aaa", "wabaId": "116676371511027" } } | |
Error | ||
429 | { "status": "error", "message": "Too Many Requests" } | 10 Requests per Minute |
500 | { "status": "error", "message": "Internal server error. Please try again later and If Issue still persist than contact Gupshup Dev Support" } | For any Internal Error |