Apply For Templates

Use this API to create a template for your Gupshup App

❗️

Attention

This guide is no longer maintained from 31st Jan 2025. Please refer the updated one here.


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

  1. App Id
  2. App token

Parameters

Key

Description

Required/Optional

Type

Value

Authorization

Access Token for the application

Required

String

{{PARTNER_APP_TOKEN}}

appId

Unique identifier of the Gupshup App

Required

String

{{APP_ID}}

elementName

The name of a template. Element name is unique for a WABA's namespace.

Required

String

ticket_check_url_334

languageCode

Language code for the template. Refer to all the language codes here.

Optional

String

en_US

category

The 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.

Required

String

AUTHENTICATION, MARKETING and UTILITY

templateType

Text

Carousel
\--data-urlencode 'cards'

Required

String

  • *Possible 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.

isLTO

Needs to be true in order to create LTO templates

Optional

Boolean

LTO creation param

limitedOfferText

Limited offer text can have Maximum 16 characters

Optional

String

LTO text

hasExpiration

Copy code button component required if "has_expiration" is set to true

Optional

Boolean

Set true to add expiration to LTO templates

cards

Either 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.

Optional

Strig

[  
    {  
        "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"  
                ]  
            }  
        ]  
    }  
]

vertical

Character limit: 180

Required

String

TEXT

content

The body of the template. Character limit: 1028. For “Authentication” category the first line should be - {{1}} is your verification code.

Required

String

your ticket has been confirmed for {{1}} persons on date {{2}}.

header

Header of the template. Applicable for templateType = Text Character limit: 60. Not applicable for “Authentication” category.

Optional

String

This is the header.

footer

Footer of the template. Character limit: 60. Not applicable for “Authentication” category, only set based on code_expiration_minutes value

Optional

String

This is the footer.

buttons

Used 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

Optional

String

[{"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 }]

example

An example of the template.

Required

String

your ticket has been confirmed for 4 persons on date 2020-05-04.

enableSample

  • *Required** for creating all types of templates.

Optional

Boolean

true

allowTemplateCategoryChange

Boolean 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 .

Optional

Boolean

false

exampleHeader

Optional

String

This is the header

addSecurityRecommendation

Optionally for "Authentication" category a security disclaimer is added to content - For your security, do not sharethis code.

Optional

Boolean

true

codeExpirationMinutes

Optionally 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.

Optional

Integer

90

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!