post https://partner.gupshup.io/partner/app//templates
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. Character limit: 1028. For "Authentication" category the first line should be - {{1}} is your verification code. | {{CONTENT}} | String | Required | content (not more than 1024 char.) |
category | The category of your template. | {{CATEGORY}} | String | Required | |
vertical | TEXT | {{VERTICAL}} | String | Required | vertical (not more than 180 char.) |
footer | Footer of the template. | {{FOOTER}} | String | Optional | |
templateType | VIDEO | {{TEMPLATE_TYPE}} | String | Required | |
example | Template Example | {{EXAMPLE}} | String | Required | |
exampleMedia | Handle Id required to generate media templates | {{ENABLE_MEDIA}} | String | Required | This is handleId. Generate handleId here |
enableSample | Required for creating all types of templates | {{ENABLE_SAMPLE}} | true/false | Optional | if enableSample is true then exampleMedia |
allowTemplateCategoryChange | Boolean value. If True, Meta will automatically update the category of the template as per the template content. Default value is False. | {{ALLOW_TEMPLATE_CATEGORY_CHANGE}} | Boolean | 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_711916ad1d5d4f21a9520fdef20516a1' \
--data elementName=video_element1 \
--data languageCode=en \
--data 'footer=This is the footer' \
--data 'content=Hi {{1}}.' \
--data category=MARKETING \
--data templateType=VIDEO \
--data 'vertical=Ticket updated' \
--data 'example=Hi User.' \
--data enableSample=true \
--data exampleMedia=4::aW1hZ2UvcadG5n:ARYaMMMA2QvIXuQZdPjWVXTOqfoBU3n0L1Ftyg4w57yxi9nD105yQDvW2nu3-HNo9HGefxZ-Ig-HAi3YSsckwIsOEUwxSPatsxT0Niob30E63A:e:1634884682:2281283925530161:100033655335566:ARaBAxW-1L-ZRu6SMSg \
--data allowTemplateCategoryChange=true
Sample Response
{
"status": "success",
"template": {
"appId": "a41b30f4-d202-4fdb-911e-3a8fbfbfb797",
"category": "MARKETING",
"containerMeta": "{\"appId\":\"a41b30f4-d202-4fdb-911e-3a8fbfbfb797\",\"data\":\"Hi {{1}}.\",\"footer\":\"This is the footer\",\"sampleText\":\"Hi User.\",\"sampleMedia\":\"4::aW1hZ2UvcadG5n:ARYaMMMA2QvIXuQZdPjWVXTOqfoBU3n0L1Ftyg4w57yxi9nD105yQDvW2nu3-HNo9HGefxZ-Ig-HAi3YSsckwIsOEUwxSPatsxT0Niob30E63A:e:1634884682:2281283925530161:100033655335566:ARaBAxW-1L-ZRu6SMSg\",\"enableSample\":true,\"editTemplate\":false,\"allowTemplateCategoryChange\":true,\"addSecurityRecommendation\":false}",
"createdOn": 1716282572440,
"data": "Hi {{1}}.\nThis is the footer",
"elementName": "video_element1",
"id": "80206293-ef61-4922-88c0-ff68768f02d8",
"languageCode": "en",
"languagePolicy": "deterministic",
"meta": "{\"example\":\"Hi User.\"}",
"modifiedOn": 1716282572440,
"namespace": "9c7fe92f_2a48_40ec_83d0_69c62a772433",
"priority": 1,
"quality": "UNKNOWN",
"retry": 0,
"stage": "NONE",
"status": "PENDING",
"templateType": "VIDEO",
"vertical": "Ticket updated",
"wabaId": "104505526065633"
}
}
Status Codes
Status Code | Response | Comments |
---|---|---|
Success | ||
200 | { "status": "success", "template": { "appId": "a41b30f4-d202-4fdb-911e-3a8fbfbfb797", "category": "MARKETING", "containerMeta": "{"appId":"a41b30f4-d202-4fdb-911e-3a8fbfbfb797","data":"Hi {{1}}.","footer":"This is the footer","sampleText":"Hi User.","sampleMedia":"4::aW1hZ2UvcadG5n:ARYaMMMA2QvIXuQZdPjWVXTOqfoBU3n0L1Ftyg4w57yxi9nD105yQDvW2nu3-HNo9HGefxZ-Ig-HAi3YSsckwIsOEUwxSPatsxT0Niob30E63A:e:1634884682:2281283925530161:100033655335566:ARaBAxW-1L-ZRu6SMSg","enableSample":true,"editTemplate":false,"allowTemplateCategoryChange":true,"addSecurityRecommendation":false}", "createdOn": 1716282572440, "data": "Hi {{1}}.\nThis is the footer", "elementName": "video_element1", "id": "80206293-ef61-4922-88c0-ff68768f02d8", "languageCode": "en", "languagePolicy": "deterministic", "meta": "{"example":"Hi User."}", "modifiedOn": 1716282572440, "namespace": "9c7fe92f_2a48_40ec_83d0_69c62a772433", "priority": 1, "quality": "UNKNOWN", "retry": 0, "stage": "NONE", "status": "PENDING", "templateType": "VIDEO", "vertical": "Ticket updated", "wabaId": "104505526065633" } } | |
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 |