Apply For Templates

Use this API to create a template for your Gupshup App

You will need the below details to start using this API.

  1. App Id
  2. App token

Parameters

KeyDescriptionRequired/OptionalTypeValue
Authorization Access Token for the applicationRequiredString{{PARTNER_APP_TOKEN}}
appId Unique identifier of the Gupshup AppRequiredString{{APP_ID}}
elementNameThe name of a template. Element name is unique for a WABA's namespace.RequiredStringticket_check_url_334
languageCodeLanguage code for the template. Refer to all the language codes here.OptionalStringen_US
categoryThe category of your template. Possible Values: AUTHENTICATION, MARKETING and UTILITY.
If you submit the templates with the any other categories, you will receive an error Invalid category provided, kindly use category from these option AUTHENTICATION, MARKETING, UTILITY.
RequiredStringAUTHENTICATION, MARKETING and UTILITY
templateTypeText

Carousel
\--data-urlencode 'cards'
RequiredStringPossible Values: TEXT, IMAGE, LOCATION, PRODUCT, CATALOG, CAROUSEL, VIDEO & DOCUMENT.

Catalog, LTO, and Carousel templates are not available with the On-premises API.

Catalog, Carousel, and Product templates are available for MARKETING & UTILITY category only.

Cards parameter only to be passed if the template type is CAROUSEL.

For the LTO template, the template type is to be passed as TEXT. limitedOfferText, hasExpiration, isLTO only to be passed for LTO Templates.
isLTONeeds to be true in order to create LTO templatesOptionalBooleanLTO creation param
limitedOfferTextLimited offer text can have Maximum 16 charactersOptionalStringLTO text
hasExpirationCopy code button component required if "has_expiration" is set to trueOptionalBooleanSet true to add expiration to LTO templates
cardsEither of mediaUrl, mediaId or exampleMedia is required. If exampleMedia is not provided, the handleId / exampleMedia will be generated in the backend using the mediaUrl / mediaId.OptionalStrig[ { "headerType": "IMAGE", "mediaUrl": "https://www.buildquickbots.com/whatsapp/media/sample/jpg/sample01.jpg", "mediaId": null, "exampleMedia": null, "body": "New Year is round the corner", "sampleText": "New Year is round the corner", "buttons": \[ { "type": "URL", "text": "Buy now", "url": "https://www.luckyshrub.com/shop", "buttonValue": "https://www.luckyshrub.com/shop?promo=", "suffix": "exotic_produce_2023", "example": [ "https://www.luckyshrub.com/shop" ] } ] } ]
verticalCharacter limit: 180RequiredStringTEXT
contentThe body of the template. Character limit: 1028. For “Authentication” category the first line should be - {{1}} is your verification code.RequiredStringyour ticket has been confirmed for {{1}} persons on date {{2}}.
headerHeader of the template. Applicable for templateType = Text Character limit: 60. Not applicable for “Authentication” category.OptionalStringThis is the header.
footerFooter of the template. Character limit: 60. Not applicable for “Authentication” category, only set based on code_expiration_minutes valueOptionalStringThis is the footer.
buttonsUsed only if your template has a CTA. An example is also submitted if a URL button has variable parameter. For “Authentication” category OTP button type is supported with two otp_type:

1. COPY_CODE
2. ONE_TAP
If otp_type is set to ONE_TAP, three additional parameters are required:
3. autofill_text
4. package_name
5. signature_hash
OptionalString[{"type":"PHONE_NUMBER","text":"Call Us","phone_number":"+919872329959"},{"type":"URL","text":"Book A Demo","url":"<https://bookins.gupshup.io/{{1}}","example":["https://bookins.gupshup.io/abc"]}]> or for “Authentication” category: [{"type":"OTP","otp_type":"COPY_CODE","text":"Copy OTP"},{"type":"OTP", “otp-type”: “ONE_TAP”, "text":"Book A Demo", "autofill_text": "Autofill", #One-tap buttons only "package_name": "com.example.myapplication" #One-tap buttons only , "signature_hash": "K8a%2FAINcGX7", #One-tap buttons only }]
exampleAn example of the template.RequiredStringyour ticket has been confirmed for 4 persons on date 2020-05-04.
enableSampleRequired for creating all types of templates.OptionalBooleantrue
allowTemplateCategoryChangeBoolean 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 .OptionalBooleanfalse
exampleHeaderOptionalStringThis is the header
addSecurityRecommendationOptionally for "Authentication" category a security disclaimer is added to content - For your security, do not share this code.OptionalBooleantrue
codeExpirationMinutesOptionally for “Authentication” category the following text is added to footer - This code expires in <NUM_MINUTES> minutes. Code expiry time should be between 1 and 90 minutes.OptionalInteger90

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 'category={{CATEGORY}}' \
--data-urlencode 'templateType={{TEMPLATE_TYPE}}' \
--data-urlencode 'vertical=TEXT' \
--data-urlencode 'content=your ticket has been confirmed for {{1}} persons on date {{2}}.' \
--data-urlencode 'header=This is the header' \
--data-urlencode 'footer=This is the footer' \
--data-urlencode 'buttons=[{"type":"PHONE_NUMBER","text":"Call Us","phone_number":"+919872329959"},{"type":"URL","text":"Book A Demo","url":"https://bookins.gupshup.io/{{1}}","example":["https://bookins.gupshup.io/abc"]}] or for “Authentication” category: [{"type":"OTP","otp_type":"COPY_CODE","text":"Copy OTP"},{"type":"OTP", “otp-type”: “ONE_TAP”, "text":"Book A Demo", "autofill_text": "Autofill", #One-tap buttons only "package_name": "com.example.myapplication" #One-tap buttons only , "signature_hash": "K8a%2FAINcGX7", #One-tap buttons only }]' \
--data-urlencode 'example=your ticket has been confirmed for 4 persons on date 2020-05-04.' \
--data-urlencode 'enableSample=true' \
--data-urlencode 'allowTemplateCategoryChange=false' \'

Sample Response

 {
        
Status: 204 Accepted
    }
                {
                    "status": "success",
                    "template": {
                        "appId": "****f7-***33-4**d-8f***-c***d*****",
                        "category": "MARKETING",
                        "createdOn": 1652768999707,
                        "data": "Hi, you Welcome to Header.\nHi, {{1}}. This is the template for header testing.\nHi, Welcome to Footer. | [call,917676767676] | [ur,https://www.fb.com]",
                        "elementName": "test_template12332",
                        "id": "f****a-f****-4**2-8***4-dc****ea",
                        "languageCode": "en",
                        "languagePolicy": "deterministic",
                        "master": true,
                        "meta": "{\"example\":\"Hi, [john]. This is the template for header testing.\"}",
                        "modifiedOn": 1652768999707,
                        "namespace": "e***3_e5**_**de_***3_20****1b",
                        "status": "PENDING",
                        "templateType": "TEXT",
                        "vertical": "Header",
                        "allowTemplateCategoryChange": "false"
                    }
                }
Language
Click Try It! to start a request and see the response here!