Register for Push Notifications
The registerForPushNotifications action registers a device push token with the chat service so the user can receive push notifications related to their session (for example, when there are new messages). The widget forwards the token to the server when the chat connection is available.
Usage
Call registerForPushNotifications on the widget instance with an object containing the device token and provider:
window._asurion_widget('registerForPushNotifications', {
token: '<your-fcm-device-token>',
provider: 'fcm',
});
Parameters
| Parameter | Type | Description |
|---|---|---|
token | string | Non-empty FCM device token for the current user or device. |
provider | string | Push provider identifier. Currently only fcm is supported. |
If the token is missing or empty, or if provider is not fcm, registration is rejected and the widget reports a warning via its configured error handler. Registration may also fail if the chat socket is not connected or if the server does not acknowledge registration within the timeout.