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 | IMAGE | {{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 --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={{CONTENT}}' \
--data-urlencode 'footer={{FOOTER}}' \
--data-urlencode 'category={{CATEGORY}}' \
--data-urlencode 'templateType={{TEMPLATE_TYPE}}' \
--data-urlencode 'vertical={{VERTICAL}}' \
--data-urlencode 'example={{EXAMPLE}}' \
--data-urlencode 'exampleMedia={{EXAMPLE_MEDIA}}' \
--data-urlencode 'enableSample={{ENABLE_SAMPLE}}' \
--data-urlencode 'allowTemplateCategoryChange={{ALLOW_TEMPLATE_CATEGORY_CHANGE}}'
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 There.\",\"sampleMedia\":\"4::aW1hZ2UvcadG5n:ARYaMMMA2QvIXuQZdPjWVXTOqfoBU3n0L1Ftyg4w57yxi9nD105yQDvW2nu3-HNo9HGefxZ-Ig-HAi3YSsckwIsOEUwxSPatsxT0Niob30E63A:e:1634884682:2281283925530161:100033655335566:ARaBAxW-1L-ZRu6SMSg\",\"enableSample\":true,\"editTemplate\":false,\"allowTemplateCategoryChange\":true,\"addSecurityRecommendation\":false}",
"createdOn": 1716282767027,
"data": "Hi {{1}}.\nThis is the footer",
"elementName": "image_element",
"id": "e676c31d-ff1d-42f1-bea1-88049da5b94f",
"languageCode": "en",
"languagePolicy": "deterministic",
"meta": "{\"example\":\"Hi There.\"}",
"modifiedOn": 1716282767027,
"namespace": "9c7fe92f_2a48_40ec_83d0_69c62a772433",
"priority": 1,
"quality": "UNKNOWN",
"retry": 0,
"stage": "NONE",
"status": "PENDING",
"templateType": "IMAGE",
"vertical": "Ticket update",
"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 There.","sampleMedia":"4::aW1hZ2UvcadG5n:ARYaMMMA2QvIXuQZdPjWVXTOqfoBU3n0L1Ftyg4w57yxi9nD105yQDvW2nu3-HNo9HGefxZ-Ig-HAi3YSsckwIsOEUwxSPatsxT0Niob30E63A:e:1634884682:2281283925530161:100033655335566:ARaBAxW-1L-ZRu6SMSg","enableSample":true,"editTemplate":false,"allowTemplateCategoryChange":true,"addSecurityRecommendation":false}", "createdOn": 1716282767027, "data": "Hi {{1}}.\nThis is the footer", "elementName": "image_element", "id": "e676c31d-ff1d-42f1-bea1-88049da5b94f", "languageCode": "en", "languagePolicy": "deterministic", "meta": "{"example":"Hi There."}", "modifiedOn": 1716282767027, "namespace": "9c7fe92f_2a48_40ec_83d0_69c62a772433", "priority": 1, "quality": "UNKNOWN", "retry": 0, "stage": "NONE", "status": "PENDING", "templateType": "IMAGE", "vertical": "Ticket update", "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 |