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 | {{VERTICAL}} | String | Required | vertical (not more than 180 char.) |
templateType | CAROUSEL | {{TEMPLATE_TYPE}} | String | Required | The type of template: CAROUSEL Cards only to be passed if template type is CAROUSEL |
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 |
buttons | buttons list | [{"type":"COPY_CODE","example":"250FF"},{"type":"URL","text":"Shop Now","url":"<https://www.luckyshrub.com/shop?promo={{1}}","example":["summer2023"]},{"type":"URL","text":"Website","url":"https://www.luckyshrub.com/shop?promo={{1}}","example":["summer2023"]},{"type":"PHONE_NUMBER","text":"Call","phone_number":"918016337728"},{"type":"QUICK_REPLY","text":"Yes"},{"type":"QUICK_REPLY","text":"No"},{"type":"QUICK_REPLY","text":"Unsubscribe> from Promos"},{"type":"QUICK_REPLY","text":"Red"},{"type":"QUICK_REPLY","text":"Blue"},{"type":"QUICK_REPLY","text":"Green"}] | String | Required | |
hasExpiration | Set true to add expiration to LTO templates | {{HAS_EXPIRATION}} | Boolean | Required | Copy code button component required if "has_expiration" is set to true. |
isLTO | LTO creation param | {{ISLTO}} | Boolean | Required | Needs to be true to create LTO templates |
limitedOfferText | LTO creation param | {{LIMITED_OFFER_TEXT}} | String | Required | |
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 | |
APP ID | 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 'https://qa-partner-api.gupshup.io/partner/app/a41b30f4-d202-4fdb-911e-3a8fbfbfb797/template/msg' \
--header 'Connection: keep-alive' \
--header 'Authorization: sk_4087b15819a34606be15483456dcf636' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'source=918929874278' \
--data-urlencode 'sandbox=false' \
--data-urlencode 'destination=918888998545' \
--data-urlencode 'template={"id":"667237b0-0e4f-42f7-ae70-4603bae593ff","params":["250FF"],"expiration":1714694865000}' \
--data-urlencode 'src.name=august18'
Sample Response
{
"status": "success",
"template": {
"appId": "a41b30f4-d202-4fdb-911e-3a8fbfbfb797",
"buttonSupported": "CC,PN,QR,URL",
"category": "MARKETING",
"containerMeta": "{\"appId\":\"a41b30f4-d202-4fdb-911e-3a8fbfbfb797\",\"data\":\"Hi All Dear SpiderMan, Here are our products.\",\"buttons\":[{\"type\":\"COPY_CODE\",\"example\":\"250FF\"},{\"type\":\"URL\",\"text\":\"Shop Now\",\"url\":\"https://www.luckyshrub.com/shop?promo={{1}}\",\"example\":[\"summer2023\"]},{\"type\":\"URL\",\"text\":\"Website\",\"url\":\"https://www.luckyshrub.com/shop?promo={{1}}\",\"example\":[\"summer2023\"]},{\"type\":\"PHONE_NUMBER\",\"text\":\"Call\",\"phone_number\":\"918016337728\"},{\"type\":\"QUICK_REPLY\",\"text\":\"Yes\"},{\"type\":\"QUICK_REPLY\",\"text\":\"No\"},{\"type\":\"QUICK_REPLY\",\"text\":\"Unsubscribe from Promos\"},{\"type\":\"QUICK_REPLY\",\"text\":\"Red\"},{\"type\":\"QUICK_REPLY\",\"text\":\"Blue\"},{\"type\":\"QUICK_REPLY\",\"text\":\"Green\"}],\"sampleText\":\"Hi All Dear SpiderMan, Here are our products.\",\"enableSample\":true,\"editTemplate\":false,\"allowTemplateCategoryChange\":false,\"addSecurityRecommendation\":false,\"limitedTimeOffer\":{\"text\":\"offer limited\",\"has_expiration\":true}}",
"createdOn": 1715610825823,
"data": "Hi All Dear SpiderMan, Here are our products.\noffer limited | true | [Copy offer code,{{1}}] | [Shop Now,https://www.luckyshrub.com/shop?promo={{1}}] | [Website,https://www.luckyshrub.com/shop?promo={{1}}] | [Call,918016337728] | [Yes] | [No] | [Unsubscribe from Promos] | [Red] | [Blue] | [Green]",
"elementName": "lto_newbv",
"id": "b72c5f8d-5fdd-44a6-9207-56e0dbb34dda",
"languageCode": "en",
"languagePolicy": "deterministic",
"meta": "{\"example\":\"Hi All Dear SpiderMan, Here are our products.\"}",
"modifiedOn": 1715610825823,
"namespace": "9c7fe92f_2a48_40ec_83d0_69c62a772433",
"priority": 1,
"quality": "UNKNOWN",
"retry": 0,
"stage": "NONE",
"status": "PENDING",
"templateType": "TEXT",
"vertical": "aaa",
"wabaId": "104505526065633"
}
}
Status Codes
Status Code | Response | Comment |
---|---|---|
Success | ||
200 | { "status":"success", "template":{ "appId":"a41b30f4-d202-4fdb-911e-3a8fbfbfb797", "buttonSupported":"CC,PN,QR,URL", "category":"MARKETING", "containerMeta":"{"appId":"a41b30f4-d202-4fdb-911e-3a8fbfbfb797","data":"Hi All Dear SpiderMan, Here are our products.","buttons":[{"type":"COPY_CODE","example":"250FF"},{"type":"URL","text":"Shop Now","url":"https://www.luckyshrub.com/shop?promo={{1}}\",\"example\":[\"summer2023\"]},{\"type\":\"URL\",\"text\":\"Website\",\"url\":\"https://www.luckyshrub.com/shop?promo={{1}}\",\"example\":[\"summer2023\"]},{\"type\":\"PHONE_NUMBER\",\"text\":\"Call\",\"phone_number\":\"918016337728\"},{\"type\":\"QUICK_REPLY\",\"text\":\"Yes\"},{\"type\":\"QUICK_REPLY\",\"text\":\"No\"},{\"type\":\"QUICK_REPLY\",\"text\":\"Unsubscribe from Promos"},{"type":"QUICK_REPLY","text":"Red"},{"type":"QUICK_REPLY","text":"Blue"},{"type":"QUICK_REPLY","text":"Green"}],"sampleText":"Hi All Dear SpiderMan, Here are our products.","enableSample":true,"editTemplate":false,"allowTemplateCategoryChange":false,"addSecurityRecommendation":false,"limitedTimeOffer":{"text":"offer limited","has_expiration":true}}", "createdOn":1715610825823, "data":"Hi All Dear SpiderMan, Here are our products.\noffer limited | true | [Copy offer code,{{1}}] | [Shop Now,https://www.luckyshrub.com/shop?promo={{1}}] | [Website,https://www.luckyshrub.com/shop?promo={{1}}] | [Call,918016337728] | [Yes] | [No] | [Unsubscribe from Promos] | [Red] | [Blue] | [Green]", "elementName":"lto_newbv", "id":"b72c5f8d-5fdd-44a6-9207-56e0dbb34dda", "languageCode":"en", "languagePolicy":"deterministic", "meta":"{"example":"Hi All Dear SpiderMan, Here are our products."}", "modifiedOn":1715610825823, "namespace":"9c7fe92f_2a48_40ec_83d0_69c62a772433", "priority":1, "quality":"UNKNOWN", "retry":0, "stage":"NONE", "status":"PENDING", "templateType":"TEXT", "vertical":"aaa", "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 |