Push notifications and events

In this document we will show you how to deliver push notifications to your users, and what type of notifications are supported.

Notification API Reference

Documentation of the Notification API for sending push notifications to users.

Read documentation Swagger YAML

Notifications are generated by the Subaio systems when an event occurs, such as a user signing up for a new subscription or a cancellation is completed. These notifications are sent to you and contain sufficient information to allow you to open up the correct in-app screen and display a proper notification text.

Subaio prefers sending notifications to our clients in the following structure:

{
  "type": "CANCELLATION_COMPLETED",
  "country": "DK",
  "userId": "4242d747-d2cc-454d-857d-c4cab7fa2d11",
  "suggestedLocale": "da-dk",
  "payload": [
    {
      "name": "SUBSCRIPTION",
      "params": {
        "notificationType": "CANCELLATION_COMPLETED",
        "notificationId": "ac729cac-d985-4c35-a5d5-edaf3ae7dfe2",
        "serviceId": "a7a3146f-973c-4821-b862-d94ae80b2690",
        "url": "string"
      }
    }
  ],
  "texts": {
    "en": {
      "title": "Subscriptions",
      "body": "Your subscription has been successfully cancelled"
    },
    "da": {
      "title": "Abonnement",
      "body": "Dit abonnement er nu opsagt"
    },
    "no": {
      "title": "Mine abonnementer",
      "body": "Abonnementet ditt er sagt opp"
    }
  }
}

Subaio can provide translated texts for relevant languages for each notification type. Texts can be customized for you and contain a list of template variables.

Variable Example value
productTitle Booksy
productImageUrl https://cdn.prod…png
productType subscription

The payload can be used to open up a specific Subaio view via the Frontend SDK. In the following sections you can see details on each notification type.

Notification: New Subscription

Notification is sent when a new subscription is detected for a user.

{
  "type": "NEW_SUBSCRIPTION",
  "country": "DK",
  "userId": "4242d747-d2cc-454d-857d-c4cab7fa2d11",
  "suggestedLocale": "da-dk",
  "payload": [
    {
      "name": "SUBSCRIPTION",
      "params": {
        "notificationType": "NEW_SUBSCRIPTION",
        "notificationId": "ac729cac-d985-4c35-a5d5-edaf3ae7dfe2",
        "serviceId": "a7a3146f-973c-4821-b862-d94ae80b2690",
        "url": "string",
        "productTitle": "Booksy",
        "productImageUrl": "https://cdn.prod.subaio.com/products/fa208ed5-c15e-4e73-8ed0-450602395f7f/42872372cbd9be0cf664ddd284fe4804.png",
        "productType": "subscription"
      }
    }
  ],
  "texts": {
    "en": {
      "title": "Subscriptions",
      "body": "You have {subscriptionCount, plural, one {a new subscription} other {# new subscriptions}}"
    },
    "da": {
      "title": "Abonnement",
      "body": "Du har {subscriptionCount, plural, one {et nyt abonnement} other {# nye abonnementer}}"
    }
  }
}

Notification: Cancellation Completed

Notification is sent when a ongoing cancellation is completed.

{
  "type": "CANCELLATION_COMPLETED",
  "country": "DK",
  "userId": "4242d747-d2cc-454d-857d-c4cab7fa2d11",
  "suggestedLocale": "da-dk",
  "payload": [
    {
      "name": "SUBSCRIPTION",
      "params": {
        "notificationType": "CANCELLATION_COMPLETED",
        "notificationId": "ac729cac-d985-4c35-a5d5-edaf3ae7dfe2",
        "serviceId": "a7a3146f-973c-4821-b862-d94ae80b2690",
        "url": "string",
        "productTitle": "Booksy",
        "productImageUrl": "https://cdn.prod.subaio.com/products/fa208ed5-c15e-4e73-8ed0-450602395f7f/42872372cbd9be0cf664ddd284fe4804.png",
        "productType": "subscription"
      }
    }
  ],
  "texts": {
    "en": {
      "title": "Subscriptions",
      "body": "Your subscription has been successfully cancelled"
    },
    "da": {
      "title": "Abonnement",
      "body": "Dit abonnement er nu opsagt"
    }
  }
}

Notification: Cancellation Completed with Message

Notification is sent when a ongoing cancellation is completed and Subaio has added an additional message for the user.

{
  "type": "CANCELLATION_COMPLETED_WITH_MESSAGE",
  "country": "DK",
  "userId": "4242d747-d2cc-454d-857d-c4cab7fa2d11",
  "suggestedLocale": "da-dk",
  "payload": [
    {
      "name": "SUBSCRIPTION",
      "params": {
        "notificationType": "CANCELLATION_COMPLETED_WITH_MESSAGE",
        "notificationId": "ac729cac-d985-4c35-a5d5-edaf3ae7dfe2",
        "serviceId": "a7a3146f-973c-4821-b862-d94ae80b2690",
        "url": "string",
        "productTitle": "Booksy",
        "productImageUrl": "https://cdn.prod.subaio.com/products/fa208ed5-c15e-4e73-8ed0-450602395f7f/42872372cbd9be0cf664ddd284fe4804.png",
        "productType": "subscription"
      }
    }
  ],
  "texts": {
    "en": {
      "title": "Subscriptions",
      "body": "Your subscription has been successfully cancelled but there are information you should read."
    },
    "da": {
      "title": "Abonnement",
      "body": "Dit abonnement er opsagt, men der er yderligere information du skal læse."
    }
  }
}

Notification: Cancellation Needs User Attention - Require more Information

Notification is sent when a ongoing cancellation needs more information from user to be completed.

This happens when the merchant cannot find the user contract based on the provided information, e.g. the email address supplied is incorrect.

{
  "type": "CANCELLATION_MOREINFOREQUIRED",
  "country": "DK",
  "userId": "4242d747-d2cc-454d-857d-c4cab7fa2d11",
  "suggestedLocale": "da-dk",
  "payload": [
    {
      "name": "SUBSCRIPTION",
      "params": {
        "notificationType": "CANCELLATION_MOREINFOREQUIRED",
        "notificationId": "ac729cac-d985-4c35-a5d5-edaf3ae7dfe2",
        "serviceId": "a7a3146f-973c-4821-b862-d94ae80b2690",
        "url": "string",
        "productTitle": "Booksy",
        "productImageUrl": "https://cdn.prod.subaio.com/products/fa208ed5-c15e-4e73-8ed0-450602395f7f/42872372cbd9be0cf664ddd284fe4804.png",
        "productType": "subscription"
      }
    }
  ],
  "texts": {
    "en": {
      "title": "Subscriptions",
      "body": "We need more information to continue with the cancellation of your subscription with Booksy"
    },
    "da": {
      "title": "Abonnement",
      "body": "Vi har brug for mere information for at kunne fortsætte din opsigelse hos Booksy"
    }
  }
}

Notification: Cancellation Aborted

Notification is sent when a ongoing cancellation was aborted.

This happens if the user did not respond to requests for more information or in rare cases the merchant did not respond.

{
  "type": "CANCELLATION_ABORTED",
  "country": "DK",
  "userId": "4242d747-d2cc-454d-857d-c4cab7fa2d11",
  "suggestedLocale": "da-dk",
  "payload": [
    {
      "name": "SUBSCRIPTION",
      "params": {
        "notificationType": "CANCELLATION_ABORTED",
        "notificationId": "ac729cac-d985-4c35-a5d5-edaf3ae7dfe2",
        "serviceId": "a7a3146f-973c-4821-b862-d94ae80b2690",
        "url": "string",
        "productTitle": "Booksy",
        "productImageUrl": "https://cdn.prod.subaio.com/products/fa208ed5-c15e-4e73-8ed0-450602395f7f/42872372cbd9be0cf664ddd284fe4804.png",
        "productType": "subscription"
      }
    }
  ],
  "texts": {
    "en": {
      "title": "Subscriptions",
      "body": "We have had to abort the cancellation of your subscription with Booksy"
    },
    "da": {
      "title": "Abonnement",
      "body": "Vi har været nødt til at afbryde opsigelsen af dit abonnement hos Booksy"
    }
  }
}

Notification: Warning about New Payment on Cancelled Subscription

Notification is sent when a new payment is detected on a cancelled subscription.

This could happen if the merchant did not infact cancel the subscription due to an error.

{
  "type": "NEW_PAYMENT_CANCELLED_SUBSCRIPTION",
  "country": "DK",
  "userId": "4242d747-d2cc-454d-857d-c4cab7fa2d11",
  "suggestedLocale": "da-dk",
  "payload": [
    {
      "name": "SUBSCRIPTION",
      "params": {
        "notificationType": "NEW_PAYMENT_CANCELLED_SUBSCRIPTION",
        "notificationId": "ac729cac-d985-4c35-a5d5-edaf3ae7dfe2",
        "serviceId": "a7a3146f-973c-4821-b862-d94ae80b2690",
        "url": "string",
        "productTitle": "Booksy",
        "productImageUrl": "https://cdn.prod.subaio.com/products/fa208ed5-c15e-4e73-8ed0-450602395f7f/42872372cbd9be0cf664ddd284fe4804.png",
        "productType": "subscription"
      }
    }
  ],
  "texts": {
    "en": {
      "title": "Subscriptions",
      "body": "A payment has been made on a cancelled subscription"
    },
    "da": {
      "title": "Abonnement",
      "body": "Der har været en betaling på et opsagt abonnement"
    }
  }
}