API to create template from pre approved Meta Library Template
Rate Limit
10 Requests per Minute
Sample Request
curl --location --request POST 'https://partner.gupshup.io/partner/app/:appId/template/metalibrary' \
--header 'Authorization: {{PARTNER_APP_TOKEN}}' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'elementName={{NEW_ELEMENT_NAME}}' \
--data-urlencode 'category=UTILITY' \
--data-urlencode 'languageCode={{LANGUAGE_CODE_OF_LIBRARY_TEMPLATE}}' \
--data-urlencode 'libraryTemplateName={{NAME_OF_LIBRARY_TEMPLATE}}' \
--data-urlencode 'buttons={{BUTTONS_IN_SAME_FORMAT_LIKE_LIBRARY_TEMPLATE}}}'
Sample Response
{
"status": "success",
"templates": {
"buttonSupported": "URL",
"category": "UTILITY",
"containerMeta": "{\"data\":\"Hei, {{1}}\\n\\nDen nye kontoen din er opprettet.\\n\\nBekreft {{2}} hello.\",\"buttons\":[{\"type\":\"URL\",\"text\":\"Bekreft konto\",\"url\":\"https://www.example.com/\"}],\"header\":\"hello\",\"sampleText\":\"Hei, John\\n\\nhello.\\n\\nhello.\",\"sampleHeader\":\"hello\",\"enableSample\":true,\"editTemplate\":false,\"allowTemplateCategoryChange\":false,\"addSecurityRecommendation\":false}",
"createdOn": 1721897898300,
"data": "Fullfør konfigurering av konto\nHei, {{1}}\n\nhellot.\n\nhello {{2}} hello",
"elementName": "jul23libtest1_8",
"externalId": "399568216474711",
"id": "0cc281c9-dc45-4ea3-bf50-411e9b8ff9b3",
"languageCode": "nb",
"languagePolicy": "deterministic",
"meta": "{\"example\":\"Hei, John\\n\\nhello.\\n\\nhello\"}",
"modifiedOn": 1721897898300,
"namespace": "18cfa544_9c62_4dcd_b8f3_b3785d8c917c",
"quality": "UNKNOWN",
"status": "APPROVED",
"templateType": "TEXT",
"wabaId": "216141188246170"
}
}
Request Parameters
Key | Description | Constraints |
---|---|---|
Headers | ||
PARTNER_APP_TOKEN | App Access Token issued post partner login | Should be a valid partner app access token belonging to the passed appId |
Form Params | ||
elementName | Name of new element name to be created | Template name |
category | Category name | Currently only UTILITY and AUTHENTICATION is supported |
languageCode | Meta language code | |
libraryTemplateName | Name of meta library template used as base template | Element name of meta library template |
buttons | Buttons list for new template | Buttons list of meta library template |
libraryTemplateBodyInputs | Provide authentication related details. (AUTHENTICATION) | |
Path Params | ||
appId | App Id for the app that is linked to the Partner Account |
Status Codes
Status Code | Response | Comments |
---|---|---|
Error | ||
401 | { "message": "Authentication Failed", "status": "error" } | |
429 | { "status": "error", "message": "Too Many Requests" } | 10 Requests per Minute |
500 | { "status": "error", "message": "Internal Server Error" } | For any Internal Error |
400 | { "status": "error", "message": "Language is missing" } | If languageCode is not provided |
400 | { "status": "error", "message": "Library Template Name is missing" } | If libraryTemplateName is not provided |
400 | { "status": "error", "message": " The parameter library_template_button_inputs[0]['type'] is required. - null, null" } | If button type is not provided |
400 | { "status": "error", "message": "Template Already exists with same namespace and elementName and languageCode" } | If name of template already exists |
400 | { "status": "error", "message": "Category is missing" } | If category is not provided |
400 | { "status": "error", "message": "Template Name is missing" } | If elementName is not provided |