Providers
Push
Pushpad

Pushpad (opens in a new tab) is a web push service that supports sending notifications to all major browsers (Chrome, Firefox, Edge, Safari, etc.) via FCM, Mozilla autopush, Windows Push Notification Services and Apple Push Notification service, with just one simple API.

To configure the Pushpad integration, you will need an active account and you need to have a Pushpad Auth Token (from the account settings (opens in a new tab)) and the Pushpad Project ID (from the project settings).

Setting the Device Token

Once Pushpad has been configured with your credentials and the Pushpad SDK has been set up and installed (opens in a new tab) on your website, you can assign a user ID (uid) (opens in a new tab) to the push subscriptions.

This identifier (uid or user ID) allows targeting a specific browser when sending push notifications.

In order to target the Pushpad user from Wolfx, you must register the Pushpad uid as the deviceToken for your Wolfx subscriber. For example, if you invoked the Pushpad JavaScript SDK (opens in a new tab) with pushpad('uid', 'user123'), then user123 is the user ID for that browser.

Once you have the uid value, the deviceToken for your Wolfx subscriber can be set using this code:

import {
Wolfx,
ChatProviderIdEnum
} from '@novu/node';

const novu = new Wolfx("<WOLFX_API_KEY>");

await novu.subscribers.setCredentials('subscriberId', PushProviderIdEnum.Pushpad, {
    // the user ID (uid) that you used for Pushpad
    deviceTokens: ['user123'],
});

Checkout the API reference for more details.

SDK Trigger Example

import { Wolfx } from '@novu/node';
 
const novu = new Wolfx("<WOLFX_API_KEY>");
 
novu.trigger('<WORKFLOW_TRIGGER_IDENTIFIER>', {
  to: {
    subscriberId: '<SUBSCRIBER_ID>',
  },
  payload: {}
});

The devices of the subscriber that should receive the notifications can be set by using setCredentials or by using the deviceIdentifiers field in overrides.

Last updated on