Text

Use this API to send messages using the Text template.

Request Parameters

Key Description Value Data Type Required/Optional Constraints

Authorization

Access Token for the application

{{PARTNER_APP_TOKEN}}

String

Required

Should be a valid Partner App Access Token

elementName

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

{{ELEMENT_NAME}}

String

Required

elementName (not more than 180 char.) Mandatory fields

languageCode

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

{{LANGUAGE_CODE}}

String

Optional

languageCode default value : en_US

content

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

{{CONTENT}}

String

Required

content (not more than 1024 char.)

category

The category of your template.

{{CATEGORY}}

String

Required

vertical

TEXT

{{VERTICAL}}

String

Required

vertical (not more than 180 char.)

footer

Footer of the template.

{{FOOTER}}

String

Optional

templateType

DOCUMENT

{{TEMPLATE_TYPE}}

String

Required

example

Template Example

{{EXAMPLE}}

String

Required

exampleHeader

This is the header

{{EXAMPLE_HEADER}}

String

Optional

header

Header of the template.

{{HEADER}}

String

Optional

buttons

Buttons list

{{BUTTONS}}

String

Optional

allowTemplateCategoryChange

Boolean value. If True, Meta will automatically update the category of the template as per the template content. Default value is False.

{{ALLOW_TEMPLATE_CATEGORY_CHANGE}}

Boolean

Optional

appId

App ID to fetch the access token

{{APP_ID}}

String

Required

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

Sample Request

curl --request POST \
     --url https://partner.gupshup.io/partner/app/{{APP_ID}}/templates \
     --header 'accept: application/json' \
     --header 'content-type: application/x-www-form-urlencoded' \
     --header 'Authorization: sk_711916ad1d5d4f21a9520fdef20516a1' \
     --data elementName=text_element1 \
     --data languageCode=en \
     --data 'content=your otp is {{1}}' \
     --data category=MARKETING \
     --data vertical=Internal_vertical \
     --data templateType=TEXT \
     --data 'example=your otp is {{1}}' \
     --data 'header=Hi All' \
     --data 'exampleHeader=Hi All' \
     --data 'footer=This is footer' \
     --data allowTemplateCategoryChange=true \
     --data 'buttons=[{\"type\":\"QUICK_REPLY\",\"text\":\"please check\"},{\"type\":\"URL\",\"text\":\"test\",\"url\":\"https://www.google.co.uk/\",\"buttonValue\":\"https://www.google.co.uk/\",\"suffix\":\"\"}]'

Sample Response

{
  "status": "success",
  "template": {
    "appId": "947d28b8-XXXX-XXXX-XXXX-0acXXX245c9",
    "category": "MARKETING",
    "containerMeta": "{\"appId\":\"947d28b8-XXXX-XXXX-XXXX-0acXXX245c9\",\"data\":\"your otp is {{1}}\",\"header\":\"Hi All\",\"footer\":\"This is footer\",\"sampleText\":\"your otp is {{1}}\",\"sampleHeader\":\"Hi All\",\"enableSample\":true,\"editTemplate\":false,\"allowTemplateCategoryChange\":true,\"addSecurityRecommendation\":false}",
    "createdOn": 1721652028616,
    "data": "Hi All\nyour otp is {{1}}\nThis is footer",
    "elementName": "text_element1",
    "id": "dd57a883-5e98-44f5-9379-f6179011a186",
    "languageCode": "en",
    "languagePolicy": "deterministic",
    "meta": "{\"example\":\"your otp is {{1}}\"}",
    "modifiedOn": 1721652028616,
    "namespace": "8e58971e_b9b8_476c_b844_64a1aa63a73c",
    "priority": 1,
    "quality": "UNKNOWN",
    "retry": 0,
    "stage": "NONE",
    "status": "PENDING",
    "templateType": "TEXT",
    "vertical": "Internal_vertical",
    "wabaId": "117529881248706"
  }
}

Status Codes

Status CodeResponseComments
Success
200{ "status": "success", "template": { "appId": "947d28b8-XXXX-XXXX-XXXX-0acXXX245c9", "category": "MARKETING", "containerMeta": "{\"appId\":\"947d28b8-XXXX-XXXX-XXXX-0acXXX245c9\",\"data\":\"your otp is {{1}}\",\"header\":\"Hi All\",\"footer\":\"This is footer\",\"sampleText\":\"your otp is {{1}}\",\"sampleHeader\":\"Hi All\",\"enableSample\":true,\"editTemplate\":false,\"allowTemplateCategoryChange\":true,\"addSecurityRecommendation\":false}", "createdOn": 1721652028616, "data": "Hi All\\nyour otp is {{1}}\\nThis is footer", "elementName": "text_element1", "id": "dd57a883-5e98-44f5-9379-f6179011a186", "languageCode": "en", "languagePolicy": "deterministic", "meta": "{\"example\":\"your otp is {{1}}\"}", "modifiedOn": 1721652028616, "namespace": "8e58971e_b9b8_476c_b844_64a1aa63a73c", "priority": 1, "quality": "UNKNOWN", "retry": 0, "stage": "NONE", "status": "PENDING", "templateType": "TEXT", "vertical": "Internal_vertical", "wabaId": "117529881248706" } }
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 than contact Gupshup Dev Support" }For any Internal Error
Language
Click Try It! to start a request and see the response here!