Set subscription for an app

📘

Subscriptions can now be set for sandbox apps as well. Once the app goes live, the current subscription will be retained.

Request Parameters

KeyMandatory/OptionalDescriptionConstraint
modeMandatoryStages in subscription processingShould be one of: SENT, DELIVERED, READ, FAILED, OTHERS, PAYMENTS, MESSAGE, BILLING, FLOWS_MESSAGE, TEMPLATE, ACCOUNT, ENQUEUED
tagMandatoryName tag for URLMust be unique and mandatory for each app
urlMandatoryCallback URLShould be a valid URL
versionMandatoryVersionShould be one of: 2, 3
showOnUIOptionalUsed internallyDefault 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 CodeResponseComments
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.
Language
Credentials
Bearer
JWT
Click Try It! to start a request and see the response here!