Template Button List

🚧

Before you begin

  • Supported for both On-Premise and CAPI
  • Only MARKETING and UTILITY template can have multiple buttons of different type.
  • Templates can have a maximum of 10 buttons with certain limitations on each type and combination.
  • CATALOG and MPM templates can have only one button.
  • AUTHENTICATION templates can have only one button and its type must be OTP.

📘

Limitations

  • Templates are limited to a maximum of 1 button of type PHONE_NUMBER.
  • Templates are limited to a maximum of 2 buttons of type URL.
  • Templates are limited to a maximum of 10 buttons of type QUICK_REPLY.
  • If using quick reply buttons with buttons of some other type, buttons must be organized into two groups: quick reply buttons and non-quick reply buttons. If grouped incorrectly, the API will return an error indicating an invalid combination.
  • MARKETING Templates are limited to a maximum of 1 button of type COPY_CODE.
  • UTILITY templates cannot use COPY_CODE.
  • MARKETING and UTILITY templates cannot use button of type OTP.

Request

curl --location 'https://api.gupshup.io/wa/app/:appId/template' \
--header 'apikey: {{api_key}}' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'languageCode={{language_code}}' \
--data-urlencode 'content={{template body}}' \
--data-urlencode 'footer={{template footer}}' \
--data-urlencode 'category={{template category}}' \
--data-urlencode 'example={{template body example}}' \
--data-urlencode 'vertical={{template vertical}}' \
--data-urlencode 'elementName={{template name}}' \
--data-urlencode 'templateType={{template type}}'

Meta Payload Example

 {
  "name": "seasonal_promotion",
  "language": "en_US",
  "category": "MARKETING",
  "components": [
    {
      "type": "HEADER",
      "format": "TEXT",
      "text": "Our {{1}} is on!",
      "example": {
        "header_text": [
          "Summer Sale"
        ]
      }
    },
    {
      "type": "BODY",
      "text": "Shop now through {{1}} and use code {{2}} to get {{3}} off of all merchandise.",
      "example": {
        "body_text": [
          [
            "the end of August","25OFF","25%"
          ]
        ]
      }
    },
    {
      "type": "FOOTER",
      "text": "Use the buttons below to manage your marketing subscriptions"
    },
    {
      "type":"BUTTONS",
      "buttons": [
        {
          "type": "QUICK_REPLY",
          "text": "Unsubscribe from Promos"
        },
        {
          "type":"QUICK_REPLY",
          "text": "Unsubscribe from All"
        }
      ]
    }
  ]
}

Request Parameters

KeyDescriptionConstraints
apikeyApikey of the account where the app is to be createdIt should be a valid gupshup.io apikey
languageCodeValid Language code for the template
contentTemplate body
footerTemplate FooterOptional
categoryTemplate Category
exampleTemplate Body exampleIf params are used in the body
verticalTemplate Vertical
elementNameTemplate Name
templatetTypeTemplate Type
ButtonsList of template buttonsButtons should be of valid type
appIdValid App Id

Response Parameters

KeyDescription
statusCreation status
templateTemplate object if template creation succeeds
messageError Message if template creation fails

📘

Refer here for a detailed information on template button list and it's use.