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. | {{CONTENT}} | String | Required | content (not more than 1024 char.) |
category | The category of your template. | {{CATEGORY}} | String | Required | Category Type: MARKETING UTILITY |
vertical | TEXT | {{VARTICAL}} | String | Required | vertical (not more than 180 char.) |
templateType | PRODUCT | {{TEMPLATE_TYPE}} | String | Required | The type of template: PRODUCT |
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 |
header | Header of the template. | {{HEADER}} | String | Optional | |
footer | Footer of the template. Character limit: 60. | {{FOOTER}} | String | Optional | |
exampleHeader | This is the header | {{ENABLE_HEADER}} | String | Optional | |
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 --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=automation_template_439231' \
--data-urlencode 'languageCode=en' \
--data-urlencode 'content=Dear Customer, Here are our products. \nThanks for shopping with us' \
--data-urlencode 'category=MARKETING' \
--data-urlencode 'vertical=Internal_vertical' \
--data-urlencode 'templateType=PRODUCT' \
--data-urlencode 'example=Dear Customer, Here are our products. \nThanks for shopping with us' \
--data-urlencode 'allowTemplateCategoryChange=true' \
--data-urlencode 'enableSample=false' \
--data-urlencode 'exampleHeader=Hi All' \
--data-urlencode 'header=Hi All' \
--data-urlencode 'footer=This is footer'
Sample Response
{
"status": "success",
"template": {
"appId": "a41b30f4-d202-4fdb-911e-3a8fbfbfb797",
"buttonSupported": "MPM",
"category": "MARKETING",
"containerMeta": "{\"appId\":\"a41b30f4-d202-4fdb-911e-3a8fbfbfb797\",\"data\":\"Dear Customer, Here are our products. \\\\nThanks for shopping with us\",\"buttons\":[{\"type\":\"MPM\",\"text\":\"View items\"}],\"header\":\"Hi All\",\"footer\":\"This is footer\",\"sampleText\":\"Dear Customer, Here are our products. \\\\nThanks for shopping with us\",\"sampleHeader\":\"Hi All\",\"enableSample\":true,\"editTemplate\":false,\"allowTemplateCategoryChange\":true,\"addSecurityRecommendation\":false}",
"createdOn": 1710799689011,
"data": "Hi All\nDear Customer, Here are our products. \\nThanks for shopping with us\nThis is footer | [View items]",
"elementName": "automation_template_439231",
"id": "1f7871fc-2933-41dd-8f67-ab2a75f055fa",
"languageCode": "en",
"languagePolicy": "deterministic",
"meta": "{\"example\":\"Dear Customer, Here are our products. \\\\nThanks for shopping with us\"}",
"modifiedOn": 1710799689011,
"namespace": "9c7fe92f_2a48_40ec_83d0_69c62a772433",
"priority": 1,
"quality": "UNKNOWN",
"retry": 0,
"stage": "NONE",
"status": "PENDING",
"templateType": "PRODUCT",
"vertical": "Internal_vertical",
"wabaId": "104505526065633"
}
}
Status Codes
Status Code | Response | Comment |
---|---|---|
Success | ||
200 | { "status":"success", "template":{ "appId":"a41b30f4-d202-4fdb-911e-3a8fbfbfb797", "buttonSupported":"MPM", "category":"MARKETING", "containerMeta":"{"appId":"a41b30f4-d202-4fdb-911e-3a8fbfbfb797","data":"Dear Customer, Here are our products. \\nThanks for shopping with us","buttons":[{"type":"MPM","text":"View items"}],"header":"Hi All","footer":"This is footer","sampleText":"Dear Customer, Here are our products. \\nThanks for shopping with us","sampleHeader":"Hi All","enableSample":true,"editTemplate":false,"allowTemplateCategoryChange":true,"addSecurityRecommendation":false}", "createdOn":1710799689011, "data":"Hi All\nDear Customer, Here are our products. \nThanks for shopping with us\nThis is footer | [View items]", "elementName":"automation_template_439231", "id":"1f7871fc-2933-41dd-8f67-ab2a75f055fa", "languageCode":"en", "languagePolicy":"deterministic", "meta":"{"example":"Dear Customer, Here are our products. \\nThanks for shopping with us"}", "modifiedOn":1710799689011, "namespace":"9c7fe92f_2a48_40ec_83d0_69c62a772433", "priority":1, "quality":"UNKNOWN", "retry":0, "stage":"NONE", "status":"PENDING", "templateType":"PRODUCT", "vertical":"Internal_vertical", "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 |