Text

Use this API to send messages using the Text template.

Request Parameters

KeyDescriptionValueData TypeRequired/OptionalConstraints
AuthorizationAccess Token for the application{{PARTNER_APP_TOKEN}}StringRequiredShould be a valid Partner App Access Token
elementNameThe name of a template. The element name is unique for a WABAs namespace.{{ELEMENT_NAME}}StringRequiredelementName (not more than 180 char.) Mandatory fields
languageCodeLanguage code for the template. Refer to all the language codes here.{{LANGUAGE_CODE}}StringOptionallanguageCode 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.{{CONTENT}}StringRequiredcontent (not more than 1024 char.)
categoryThe category of your template. {{CATEGORY}}StringRequired
verticalTEXT{{VERTICAL}}StringRequiredvertical (not more than 180 char.)
footerFooter of the template.{{FOOTER}}StringOptional
templateTypeDOCUMENT {{TEMPLATE_TYPE}}StringRequired
exampleTemplate Example{{EXAMPLE}}StringRequired
exampleHeaderThis is the header {{EXAMPLE_HEADER}}StringOptional
headerHeader of the template. {{HEADER}}StringOptional
buttonsButtons list{{BUTTONS}}StringOptional
allowTemplateCategoryChangeBoolean 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}}BooleanOptional
appIdApp ID to fetch the access token{{APP_ID}}StringRequiredThe 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!