Create Templates from the Template Library

Use this API to create a template from a pre-approved Meta Library Template.

Request Parameters

KeyDescriptionConstraints
PARTNER_APP_TOKENApp Access Token issued post partner loginShould be a valid partner app access token belonging to the passed appId
elementNameName of elementMeta library template name - Optional
categoryCategory nameCurrently only UTILITY is supported
languageCodeLanguage code of the meta library templateSupported Languages - WhatsApp Business Management API - Documentation - Meta for Developers - Optional
libraryTemplateNameName of meta library template used as base templateElement name of meta library template
buttonsButtons list for new templateButtons list of meta library template
appIdApp 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 CodeResponseComments
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
Language
Credentials
Bearer
JWT
Click Try It! to start a request and see the response here!