Apply For Templates

Using this API, you can Create a template for a particular app

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
📘

Apply for template now supports named parameter syntax in headers and body components.


Parameters

KeyDescriptionValueData typeRequired/OptionalConstraints
AuthorizationAccess Token for the application{PARTNER_APP_TOKEN}StringRequired• Should be a valid Partner App Access Token
appIdApp ID to fetch the access token{APP_ID}StringRequired• The Id should be a valid app Id of Gupshup• The App must be associated with the account that owns the PARTNER_APP_TOKEN being used
elementNameThe name of a template. Element name is unique for a WABAs namespace.{ELEMENT_NAME}StringRequired• elementName (not more than 200 char.) Mandatory fields
languageCode

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

here

.

{LANGUAGE_CODE}Stringoptional• languageCode default value : en_US
contentThe body of the template. Character limit: 1028. For "Authentication" category the first line should be - {{1}} is your verification code.StringNA• content (not more than 1024 char.)
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.
StringNA• category (not more than 180 char.)
verticalTEXTStringNAvertical (not more than 180 char.)
templateType

TEXT

Carousel--data-urlencode 'cards'LTO--data-urlencode 'limitedOfferText=
{limited offer text}'
--data-urlencode 'hasExpiration=
{true/false}'
--data-urlencode 'isLTO=true

StringNA

The type of template: TEXT, IMAGE, LOCATION, PRODUCT, CATALOG, LTO, CAROUSEL, VIDEO & DOCUMENTCATALOG, LTO, CAROUSEL templates are not available with the On-premises API

CATALOG, LTO, CAROUSEL and PRODUCT templates are available for MARKETING & UTILITY category only.Cards to be cards only to be passed if template type is CAROUSEL

exampleTemplate ExampleStringNA
enableSampleRequired for creating all types of templatestrue/falseNAif enableSample is true then exampleMedia
headerHeader of the template. Applicable for templateType = Text Character limit: 60. Not applicable for "Authentication" category.StringNA
footerFooter of the template. Character limit: 60. Not applicable for "Authentication" category, only set based on code_expiration_minutes valueStringNA
buttonsArray of objectsNA
exampleHeaderThis is the headerStringNA
addSecurityRecommendationOptionally for "Authentication" category a security disclaimer is added to content - For your security, do not share this codeBooleanNAtrue
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.IntegerNA
messageValidityIf we are unable to deliver a message to a WhatsApp user, we will retry the delivery for a period of time known as a time-to-live, TTL, or the message validity period.Valid messageValidity property values
Authentication templates: 30 to 900 seconds (30 secs to 15 mins).
Utility templates: 30 to 43200 seconds (30 secs to 12 hours).
Marketing templates: 43200 to 2592000 (12 hours to 30 days)
IntegerNA
isCPRTo enable or disable CPR (Call permission request)true/falseBooleanOptional
parameterFormat

Header component : Already supports positional ({{1}}) → Now supports named ({{sale_start_date}}).

Body component: Already supports multiple positional params ({{1}}, {{2}}) → Now supports named ({{order_id}}, {{customer_name}}).

NAMED/POSITIONAL
Default will be positional
📘

NOTE:

  • marketing ttl is only available on MM lite, and not available on CAPI.

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 {{customer_name}} persons on date.' \
--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 'messageValidity=43200' \
--data-urlencode 'isCPR=true' \
--data-urlencode 'parameterFormat=NAMED' \

Sample Response

{
    "status": "success",
    "template": {
        "appId": "57d9179b-7412-4621-bf86-57ee1962fd12",
        "category": "MARKETING",
        "containerMeta": "{\"appId\":\"57d9179b-7412-4621-bf86-57ee1962fd12\",\"data\":\"Hi user, how is {{customer}} doing?\",\"footer\":\"This code expires in 15 minutes\",\"sampleText\":\"Hi user, how is jane doing?\",\"enableSample\":true,\"editTemplate\":false,\"allowTemplateCategoryChange\":false,\"addSecurityRecommendation\":false,\"isCPR\":false,\"cpr\":false}",
        "createdOn": 1767003908520,
        "data": "Hi user, how is {{customer}} doing?\nThis code expires in 15 minutes",
        "elementName": "test_22_decemberrr",
        "id": "5da48971-6181-4c45-8de0-c786a93328e7",
        "languageCode": "en",
        "languagePolicy": "deterministic",
        "meta": "{\"example\":\"Hi user, how is jane doing?\"}",
        "modifiedOn": 1767003908520,
        "namespace": "0fee79c0_9ff8_47dc_a4e7_c07dcc23472e",
        "parameterFormat": "NAMED",
        "priority": 1,
        "quality": "UNKNOWN",
        "retry": 0,
        "stage": "NONE",
        "state": "ACTIVE",
        "status": "PENDING",
        "templateType": "TEXT",
        "vertical": "aaa",
        "wabaId": "256322900902782"
    }
}

Status Codes

Status CodeResponseComments
Success
200{
"status": "success","template":{"appId": "bf9ee64c-3d4d-4ac4-8668-732e577007c4","category": "MARKETING","containerMeta": "{"appId":"bf9ee64c-3d4d-4ac4-8668-732e577007c4","data":"This is category for copy code button template.","footer":"This is footer","sampleText":"This is category for copy code button template.","enableSample":true,"editTemplate":false,"addSecurityRecommendation":false}","createdOn": 1708205191624,"data": "This is category for copy code button template.\nThis is footer","elementName": "automation_template_2956534","id": "e8e837c2-a3a8-4845-958f-ec7febb54aec","languageCode": "en","languagePolicy": "deterministic","meta": "{"example":"This is category for copy code button template."}","modifiedOn": 1708205191624,"namespace": "18cfa544_9c62_4dcd_b8f3_b3785d8c917c","priority": 1,"quality": "UNKNOWN","retry": 0,
"stage": "NONE",
"status": "PENDING",
"templateType": "TEXT",
"vertical": "Internal_vertical",
"wabaId": "216141188246170"
}
}
Error
429

{

"status": "error","message": "Too Many Requests"}

10 Requests per Minute
500

{

"status": "error","message": "Internal server error. Please try again later and If Issue still persist, then contact Gupshup Dev Support"}

For any Internal Error
Path Params
string
required

Unique identifier of the app.

Form Data
string
required

The name of a template. Element name is unique for a WABAs namespace.

string

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

string
enum
required

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.

Allowed:
string
enum
required

The type of template: TEXT, IMAGE, LOCATION, VIDEO, DOCUMENT, PRODUCT and CATALOG

Allowed:
string
required

Character limit: 180

string
required

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

string

Header of the template.

  1. Applicable for templateType = Text Character limit: 60.
  2. Not applicable for “Authentication” category and template type “CATALOG”
string
string
  • 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:

    1. autofill_text
    2. package_name
    3. signature_hash
string
required

An example of the template.

boolean

Required for creating all types of templates.

boolean

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.

string

Not applicable for template type: CATALOG

boolean

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

integer

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.

integer

If we are unable to deliver a message to a WhatsApp user, we will retry the delivery for a period of time known as a time-to-live, TTL, or the message validity period. Valid message_send_ttl_seconds property values
Authentication templates: 30 to 900 seconds (30 secs to 15 mins)
Utility templates: 30 to 43200 seconds (30 secs to 12 hours)
Marketing templates: 43200 to 2592000 (12 hours to 30 days)

Headers
string
required

Your app token, please refer Get access token api to get the token from partner documentation.

Responses

Language
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json