post https://partner.gupshup.io/partner/app//template/metalibrary
Usi this API to create template from pre approved Meta Library Template
Request Parameters
Key | Description | Constraints |
---|---|---|
PARTNER_APP_TOKEN | App Access Token issued post partner login | Should be a valid partner app access token belonging to the passed appId |
elementName | Name of element | Meta library template name - Optional |
category | Category name | Currently only UTILITY is supported |
languageCode | Language code of the meta library template | Supported Languages - WhatsApp Business Management API - Documentation - Meta for Developers - Optional |
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 |
appId | App Id for the app that is linked to the Partner Account |
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}} for å fullføre profilen.\",\"buttons\":[{\"type\":\"URL\",\"text\":\"Bekreft konto\",\"url\":\"https://www.example.com/\"}],\"header\":\"Fullfør konfigurering av konto\",\"sampleText\":\"Hei, John\\n\\nDen nye kontoen din er opprettet.\\n\\nBekreft e-postadressen din for å fullføre profilen.\",\"sampleHeader\":\"Fullfør konfigurering av konto\",\"enableSample\":true,\"editTemplate\":false,\"allowTemplateCategoryChange\":false,\"addSecurityRecommendation\":false}",
"createdOn": 1721897898300,
"data": "Fullfør konfigurering av konto\nHei, {{1}}\n\nDen nye kontoen din er opprettet.\n\nBekreft {{2}} for å fullføre profilen. | [Bekreft konto,https://www.example.com/]",
"elementName": "jul23libtest1_8",
"externalId": "399568216474711",
"id": "0cc281c9-dc45-4ea3-bf50-411e9b8ff9b3",
"languageCode": "nb",
"languagePolicy": "deterministic",
"meta": "{\"example\":\"Hei, John\\n\\nDen nye kontoen din er opprettet.\\n\\nBekreft e-postadressen din for å fullføre profilen.\"}",
"modifiedOn": 1721897898300,
"namespace": "18cfa544_9c62_4dcd_b8f3_b3785d8c917c",
"quality": "UNKNOWN",
"status": "APPROVED",
"templateType": "TEXT",
"wabaId": "216141188246170"
}
}
Status Codes
Status Code | Response | Comments |
---|---|---|
Success | ||
200 | { "status": "success", "templates": { "buttonSupported": "URL", "category": "UTILITY", "containerMeta": "{\"data\":\"Hei, {{1}}\\n\\nDen nye kontoen din er opprettet.\\n\\nBekreft {{2}} for å fullføre profilen.\",\"buttons\":[{\"type\":\"URL\",\"text\":\"Bekreft konto\",\"url\":\"https://www.example.com/\"}],\"header\":\"Fullfør konfigurering av konto\",\"sampleText\":\"Hei, John\\n\\nDen nye kontoen din er opprettet.\\n\\nBekreft e-postadressen din for å fullføre profilen.\",\"sampleHeader\":\"Fullfør konfigurering av konto\",\"enableSample\":true,\"editTemplate\":false,\"allowTemplateCategoryChange\":false,\"addSecurityRecommendation\":false}", "createdOn": 1721897898300, "data": "Fullfør konfigurering av konto\\nHei, {{1}}\\n\\nDen nye kontoen din er opprettet.\\n\\nBekreft {{2}} for å fullføre profilen. | [Bekreft konto,https://www.example.com/]", "elementName": "jul23libtest1_8", "externalId": "399568216474711", "id": "0cc281c9-dc45-4ea3-bf50-411e9b8ff9b3", "languageCode": "nb", "languagePolicy": "deterministic", "meta": "{\"example\":\"Hei, John\\n\\nDen nye kontoen din er opprettet.\\n\\nBekreft e-postadressen din for å fullføre profilen.\"}", "modifiedOn": 1721897898300, "namespace": "18cfa544_9c62_4dcd_b8f3_b3785d8c917c", "quality": "UNKNOWN", "status": "APPROVED", "templateType": "TEXT", "wabaId": "216141188246170" } } | Response on creation of template from meta library template |
Error | ||
400 | { "status": "error", "message": "Template Name is missing" } | If elementName is not provided |
400 | { "status": "error", "message": "Category is missing" } | If category is not provided |
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": "(#100) 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 |
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 |