Web Push Channel Provider

Configuration

To configure the Web Push integration, you'll need the following data:

required fields are marked with an `*`
ParameterTypeDescription
public_keystring *VAPID public key - generate one at https://magicbell.com/web-push/vapid-keys.
private_keystring *VAPID private key - from the pair you generated.

In the Dashboard

The easiest way to configure this integration is through the MagicBell dashboard:

  1. Log in to your MagicBell dashboard.
  2. Navigate to Channels.
  3. Find and click on this channel name in the sidebar.
  4. Click the Configure Web Push button.
  5. Follow the on-screen instructions to complete the configuration.

Using the API

You can also configure the integration using the API.

Example payload:

{
  "public_key": "BNKZeSrRX_c3QfqzOvv1oshpj1qPbDcUJHKET6Ahs2u9-F4HgllPYxtgaGvGSqfytuALumX5NYZPLD8YmCwBxcw",
  "private_key": "y56TIPdEzrQ0Ku_uQbGGkB84mYdF9pJl5IHvmAZ_fVs"
}

Channel Token

The channel token contains all the information (along with the config) necessary to deliver the notification on the Web Push channel.

required fields are marked with an `*`
ParameterTypeDescription
endpointstring *The push subscription URL obtained from PushSubscription.endpoint after calling registration.pushManager.subscribe(). This is the unique URL for this device that push messages will be sent to.
keysobject *The encryption keys from the PushSubscription.getKey() method, needed to encrypt push messages for this subscription.
└ p256dhstring *The P-256 ECDH public key obtained from PushSubscription.getKey('p256dh'). Used to encrypt push messages for this subscription.
└ authstring *The authentication secret obtained from PushSubscription.getKey('auth'). Used to encrypt push messages for this subscription.

Example

{
  "endpoint": "https://fcm.googleapis.com/fcm/send/fZhR0fsr0zw:APA91bE4pM-qo1KBJDU_Zp2N9nDP-Jdmwugm-v4KNL_NlJvYCrJeJUzPXmMyAXqAE0m6BFOrkSWT0ArGbUjEEpxQEYZLado8JeW1PZA5CHB8R6C7HT6-MD6Qs8ZaCn8_ffLGGU7WuvtN",
  "keys": {
    "auth": "GoIO2ulhtQuyBM64lZuFuw",
    "p256dh": "BICAe4KtLhhPNFvynlqMRxjvpRnr94881QeuTCr8kCwJf-Fssj3FLIlnfFMjj7T1yNg5l6cn14350323_NSGZh0"
  }
}

Schema

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "properties": {
    "endpoint": {
      "description": "The push subscription URL obtained from PushSubscription.endpoint after calling registration.pushManager.subscribe(). This is the unique URL for this device that push messages will be sent to.",
      "format": "uri",
      "type": "string"
    },
    "keys": {
      "description": "The encryption keys from the PushSubscription.getKey() method, needed to encrypt push messages for this subscription.",
      "properties": {
        "auth": {
          "contentEncoding": "base64",
          "description": "The authentication secret obtained from PushSubscription.getKey('auth'). Used to encrypt push messages for this subscription.",
          "type": "string"
        },
        "p256dh": {
          "contentEncoding": "base64",
          "description": "The P-256 ECDH public key obtained from PushSubscription.getKey('p256dh'). Used to encrypt push messages for this subscription.",
          "type": "string"
        }
      },
      "required": [
        "p256dh",
        "auth"
      ],
      "type": "object"
    }
  },
  "required": [
    "endpoint",
    "keys"
  ],
  "type": "object"
}