post https://partner.gupshup.io/partner/app//templates
Use this API to create and submit a template along with sample media for your Gupshup App
You will need below details to start using this API.
- App Id
- Partner App Token
- Handle Id
Parameters
Key | Description | Required/Optional | Type | Value |
---|---|---|---|---|
Authorization | Access Token for the application | Required | String | {{PARTNER_APP_TOKEN}} |
appId | Unique identifier for a Gupshup App | Required | String | 9e97650d-add3-4557-9535-4cdf47c3fa68 |
elementName | Template element name | Optional | String | ticket_check_url_334 |
languageCode | Template language code | Optional | String | en_US |
content | Template Content | Optional | String | Your verification code is {{1}}. |
footer | Footer of the template. Character limit: 60 | Optional | String | This is the footer |
category | The category of your template. Possible Values: AUTHENTICATION , MARKETING and UTILITY .If you submit the templates with the any other categories, you will receive an error Invalid category provided, kindly use category from these option AUTHENTICATION, MARKETING, UTILITY. | Optional | String | MARKETING |
templateType | Template Type | Optional | String | IMAGE |
vertical | Template vertical | Optional | String | Ticket update |
example | Template Example | Optional | String | Your verification code is 213. |
exampleMedia | 4::aW1hZ2UvcadG5n:ARYaMMMA2QvIXuQZdPjWVXTOqfoBU3n0L1Ftyg4w57yxi9nD105yQDvW2nu3-HNo9HGefxZ-Ig-HAi3YSsckwIsOEUwxSPatsxT0Niob30E63A:e:1634884682:2281283925530161:100033655335566:ARaBAxW-1L-ZRu6SMSg | This is the handleId. | ||
enableSample | Required when submitting CTA template with variables. | Boolean | true | |
allowTemplateCategoryChange | Boolean value. If True, Meta will automatically update the category of the template as per the template content. Default value is False. If the category gets updated, you can view the oldCategory from the Get Templates API | Boolean | false |
Sample Request
curl --location --request POST 'https://partner.gupshup.io/partner/app/{{APP_ID}}/templates' \
--header 'Authorization: {{PARTNER_APP_TOKEN}}' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'elementName={{ELEMENT_NAME}}' \
--data-urlencode 'languageCode={{LANGUAGE_CODE}}' \
--data-urlencode 'content=Your verification code is {{1}}.' \
--data-urlencode 'footer=This is the footer' \
--data-urlencode 'category={{CATEGORY}}' \
--data-urlencode 'templateType=IMAGE' \
--data-urlencode 'vertical=Ticket update' \
--data-urlencode 'appId={{APP_ID}}' \
--data-urlencode 'example=Your verification code is 213.' \
--data-urlencode 'exampleMedia={{HANDLE_ID}}' \
--data-urlencode 'enableSample=true' \
--data-urlencode 'allowTemplateCategoryChange=false'
Sample Response
{
"status": "success",
"template": {
"category": "TICKET_UPDATE",
"createdOn": 1634624637136,
"data": "Your verification code is {{1}}.",
"elementName": "verification_code_with_image_3",
"id": "ae*****e-7**c-4***-b0*11-6*****5b2***",
"languageCode": "en",
"languagePolicy": "deterministic",
"master": true,
"meta": "{\"example\":\"Your verification code is 123.\"}",
"modifiedOn": 1634624637136,
"status": "PENDING",
"templateType": "IMAGE",
"vertical": "TICKET_UPDATE",
"allowTemplateCategoryChange": "false"
}
}