Glue API: Add push notification subscriptions

Edit on GitHub

This endpoint lets you subscribe to push notifications using Glue API.

Installation

Install the Push Notification feature

Retrieve push notification providers


POST {{backend_url}}/push-notification-subscriptions


PATH DESCRIPTION
{{backend_url}} URL of your Backend Glue API.

Request

HEADER KEY HEADER VALUE REQUIRED DESCRIPTION
Authorization string Alphanumeric string that authorizes the Back Office user to send requests to protected resources. Get it by authenticating as a Back Office user.

Request sample: POST https://glue-backend.de.b2c.demo-spryker.com/push-notification-providers

{
    "data": {
        "type": "push-notification-subscriptions",
        "attributes": {
            "providerName": "web-push-php",
            "group": {
                "name": "warehouse",
                "identifier": "1"
            },
            "payload": {
                "endpoint": "https://push-notifications.de.b2c.demo-spryker.com",
                "publicKey": "3243-f234-3f34-d2334",
                "authToken": "4o3ijfoi3j4f93j4d7fh4f34jf3d902kfh345g8jf903kdj23uf3"
            },
            "localeName": "en_US"
        }
    }
}
ATTRIBUTE TYPE REQUIRED DESCRIPTION
providerName String Name of the provider to subscribe to. To get it, retrieve push notification providers
group Object Defines the entity to subscribe to.
group.name String The entity type to receive notifications about.
group.identifier String ID of the entity to receive notifications about. To get it, decode accessToken retrieved when authenticating as a warehouse user.
payload Object The subscription details for establishing a communication channel between the server and the client.
payload.endpoint String The URL provided by the push service that is used to send a push message to the recipient’s device.
payload.publicKey String A client public key that is used to encrypt the push message so that only the intended recipient can read it.
payload.authToken String An authentication token that allows the server to send messages to the client’s endpoint.
localeName String Defines the language in which the client is to receive notifications.

Response

Response sample:

{
   "data": {
      "id": "96555531-c40a-516a-85d2-4f68a8f34f4b",
      "type": "push-notification-subscriptions",
      "attributes": {
         "providerName": "web-push-php",
         "payload": {
            "endpoint": "https://push-notifications.de.b2c.demo-spryker.com",
            "publicKey": "3243-f234-3f34-d2334",
            "authToken": "4o3ijfoi3j4f93j4d7fh4f34jf3d902kfh345g8jf903kdj23uf3"
         },
         "localeName": "en_US",
         "group": {
            "name": "warehouse",
            "identifier": "1"
         }
      },
      "links": {
         "self": "https:glue-backend.de.spryker.local/push-notification-subscriptions/96555531-c40a-516a-85d2-4f68a8f34f4b"
      }
   }
}
RESOURCE ATTRIBUTE TYPE DESCRIPTION
push-notification-subscriptions providerName String The provider of push notifications.
push-notification-subscriptions payload.endpoint String The URL provided by the push service that is used to send a push message to the recipient’s device.
push-notification-subscriptions payload.publicKey String A client public key that is used to encrypt the push message so that only the intended recipient can read it.
push-notification-subscriptions payload.authToken String An authentication token that allows the server to send messages to the client’s endpoint.
push-notification-subscriptions localeName String The language in which the client is to receive notifications.
push-notification-subscriptions group Object Defines the entity you’ve subscribed to receive notifications about.
push-notification-subscriptions group.name String The entity type you’ve subscribed to notifications about.
push-notification-subscriptions group.identifier String Unique identifier of the entity you’ve subscribed to receive notifications about.

Possible errors

To view generic errors that originate from the Glue Application, see Reference information: GlueApplication errors.