User Settings

General steps to get an FCM registration token:

When you have the FCM registration token, you can assign them to a device in the user's notification settings.

Token Management

Each user can have one or more devices, each with its own FCM token. When a Notification is created it is sent to all registered devices with an FCM token for the targeted user.

Add or update a device

The following code snippet will create a new device or updates the token if the device already exists:

const deviceName = "mobile"
const deviceData = {
  fcmToken: "zc8HuXBRjeSPaYnKkL7vyU6FDG2MAQVT9d5w3ft4NEZgprbmh1"
};

await exh.notificationsV2.userSettings.addOrUpdateDevice(userId, deviceName, deviceData);

Device Properties

  • name – Unique name and identifier for the device.

  • description – Description of the device.

  • fcmToken – FCM token for the device.

Remove a device

This stops notifications from being sent to the specified device:

Remove the user settings

Completely remove the user settings for a user and all associated devices and tokens from the system. This stops notifications from being sent to the user.

List user settings

There are multiple methods in the SDK at exh.notificationsV2.userSettings to fetch the notification settings of users.

For example, getting the notification settings for a specific user:

Or, listing the latest users who updated their settings:

Last updated