Copy Coupon Code
- According to meta documentation it is supported only for CAPI but currently it's working for both on-premise and CAPI so we are also providing it for both but meta may remove this feature later for on-premise apps.
- Category Type should always be “MARKETING"
- Templates are limited to one copy code button.
- Button text cannot be customized.
- Codes are limited to 15 characters.
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=MARKETING' \
--data-urlencode 'example={{template body example}}' \
--data-urlencode 'vertical={{template vertical}}' \
--data-urlencode 'elementName={{template name}}' \
--data-urlencode 'buttons={{button list}}'Meta Payload Example
{
"name": "coupon_code_fall2023_25off",
"language": "en_US",
"category": "MARKETING",
"components": [
{
"type": "HEADER",
"format": "TEXT",
"text": "Our Fall Sale is on!"
},
{
"type": "BODY",
"text": "Shop now through November and use code {{1}} to get {{2}} off of all merchandise!",
"example": {
"body_text": [
[
"25OFF",
"25%"
]
]
}
},
{
"type": "BUTTONS",
"buttons": [
{
"type": "QUICK_REPLY",
"text": "Unsubscribe"
},
{
"type": "COPY_CODE",
"example": "250FF"
}
]
}
]
}Request Parameters
| Key | Description | Constraints |
|---|---|---|
| apikey | Apikey of the account where the app is to be created | It should be a valid gupshup.io apikey |
| languageCode | Valid Language code for the template | |
| content | Template body | |
| footer | Template Footer | Optional |
| category | Template Category | Must always be MARKETING |
| example | Template Body example | If params are used in the body |
| vertical | Template Vertical | |
| elementName | Template Name | |
| Buttons | buttons list | Can have only one copy coupon button |
| appId | Valid App Id |
Response
Status Code | Response | Comment |
|---|---|---|
Success 200 | |
Refer here for detailed information on coupon templates and its use.
Updated 6 days ago
