post https://partner.gupshup.io/partner/partner/app//subscription
Subscriptions can now be set for sandbox apps as well. Once the app goes live, the current subscription will be retained.
Request Parameters
Key | Mandatory/Optional | Description | Constraint |
---|---|---|---|
mode | Mandatory | Stages in subscription processing | Should be one of: SENT, DELIVERED, READ, FAILED, OTHERS, PAYMENTS, MESSAGE, BILLING, FLOWS_MESSAGE, TEMPLATE, ACCOUNT, ENQUEUED |
tag | Mandatory | Name tag for URL | Must be unique and mandatory for each app |
url | Mandatory | Callback URL | Should be a valid URL |
version | Mandatory | Version | Should be one of: 2, 3 |
showOnUI | Optional | Used internally | Default value is false |
Sample Request
curl --location '[https://partner.gupshup.io/partner/app/bf9ee64c-3d4d-4ac4-8668-732e577007c4/subscription](https://partner.gupshup.io/partner/app/bf9ee64c-3d4d-4ac4-8668-732e577007c4/subscription)' \
\--header 'Content-Type: application/x-www-form-urlencoded' \
\--header 'Authorization: sk\_e45eb372979f48dead602b52483259be' \
\--data-urlencode 'modes=SENT,DELIVERED,READ,FAILED,OTHERS,PAYMENTS,MESSAGE,
 BILLING,FLOWS\_MESSAGE,TEMPLATE,ACCOUNT,ENQUEUED' \
\--data-urlencode 'tag=V3 Subscription' \
\--data-urlencode 'showOnUI=false' \
\--data-urlencode 'version=3' \
\--data-urlencode 'url=[https://webhook.site/0b092322-b55b-419e-9c74-eb92f2b38553](https://webhook.site/0b092322-b55b-419e-9c74-eb92f2b38553)'
Sample Response
{
"status": "success",
"token": {
"token": "sk_20c901e*********2a592484********1",
"authoriserId": "aac***e8-d**c-****-a93f-**d6d5a***e8",
"requestorId": "4**2",
"createdOn": 1705905891100,
"modifiedOn": 1705905891100,
"expiresOn": 0,
"active": true
}
}
Status Codes
Status Code | Response | Comments |
---|---|---|
Success | ||
200 | { "status": "success", "subscription": { ... } } | Success |
Error | ||
400 | { "status": "error", "message": "Invalid URL Passed" } | The URL is not valid |
401 | { "status": "error", "message": "Authentication Failed" } | Authentication failure |
429 | { "status": "error", "message": "Too Many Requests" } | Rate limit exceeded |
500 | { "status": "error", "message": "Unable To Create Subscription" } | Error while creating the subscription |
Modes
- TEMPLATE: The template events get forwarded to subscriptions if TEMPLATE mode is subscribed.
- ACCOUNT: The account events get forwarded to subscriptions if ACCOUNT mode is subscribed.
- PAYMENTS: Incoming Whatsapp pay events get forwarded to subscriptions if PAYMENTS mode is subscribed. [Only for v3].
- FLOWS_MESSAGE: Incoming flow messages get forwarded to subscriptions if FLOWS_MESSAGE mode is subscribed. [Only for v3].
- MESSAGE: All incoming messages (not events) except flow messages get forwarded to subscriptions if MESSAGE mode is subscribed.
- OTHERS: All incoming new events whose exclusive mode is not present (eg read, delivered, sent, payments) get forwarded to subscriptions if OTHERS mode is subscribed [Only for v3].
- ALL: All incoming messages (not events) get forwarded to subscriptions if ALL mode is subscribed [Only for v3].
- BILLING: Billing events get forwarded to subscriptions if billing mode is subscribed.
- FAILED: The failed events get forwarded to subscriptions if failed mode is subscribed.
- SENT: Sent events get forwarded to subscriptions if sent mode is subscribed.
- DELIVERED: Delivered events get forwarded to subscriptions if delivered mode is subscribed.
- READ: Read events get forwarded to subscriptions if read mode is subscribed.
- ENQUEUED Enqueued events get forwarded to subscriptions if enqueued mode is subscribed.