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: | 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 |
| 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": {
"appId": <APP_ID>,
"category": "MARKETING",
"containerMeta": "{\"appId\":\"<APP_ID>\",\"data\":\"Hello I'm your virtual assistant\",\"footer\":\"Footer message\",\"sampleText\":\"Hello I'm your virtual assistant\",\"sampleMedia\":\"4::aW1hZ2UvcG5n:ARbkz3cEPftULo2onMnoculVMN-9ZPp2g6s6CYgkNU3VQwIlPDBhhq5nUDB3Gfcwi7x9rrsMAwpWoZ33NHPKPX3wzmy-4RXNxmu_D_XHTjiBzA:e:1708654057:2281283925530161:100033655335566:ARZYdDSW0Kdy0jXCHPU\",\"enableSample\":true,\"editTemplate\":false,\"allowTemplateCategoryChange\":true,\"addSecurityRecommendation\":false}",
"createdOn": 1708333889144,
"data": "Hello I'm your virtual assistant\nFooter message",
"elementName": "handle_id_1",
"id": "d00cca5c-ec89-431f-9421-70952fcd5695",
"languageCode": "en",
"languagePolicy": "deterministic",
"meta": "{\"example\":\"Hello I'm your virtual assistant\"}",
"modifiedOn": 1708333889144,
"namespace": "713e44ba_6a35_4cc4_ba70_9ab2db948214",
"priority": 1,
"quality": "UNKNOWN",
"retry": 0,
"stage": "NONE",
"status": "PENDING",
"templateType": "IMAGE",
"vertical": "media_gs_32",
"wabaId": "178402998700036"
}
}
Status Code
Status Code | Comments | |
---|---|---|
Success | Response | |
200 | ||
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 |