Configure notification preferences
By registering or unregistering the current user's registration token to the Sendbird server as below, you can turn push notifications on or off in the user's client app. The registration and unregistration methods in the code below should be called after a user has established a connection with the Sendbird server.
The setPushTriggerOption
method allows users to configure when to receive notification messages as well as what types of messages trigger notification messages. The following are the available options.
PushTriggerOption
Option | Description |
---|---|
all | When disconnected from the Sendbird server, the current user receives notifications for all new messages including messages the user has been mentioned in. |
mentionOnly | When disconnected from the Sendbird server, the current user only receives notifications for messages the user has been mentioned in. |
off | The current user doesn't receive any notifications. |
The setMyPushTriggerOption
method also allows users to configure the trigger for notification messages as well as turn notifications on or off for each channel. For the method, you can pass one of the following GroupChannelPushTriggerOption
values to its parameter.
GroupChannelPushTriggerOption
Option | Description |
---|---|
global | The current user’s push notification trigger settings are automatically applied to the channel. This is the default setting. |
all | When disconnected from the Sendbird server, the current user receives notifications for all new messages in the channel including messages the user has been mentioned in. |
mentionOnly | When disconnected from the Sendbird server, the current user only receives notifications for messages in the channel the user has been mentioned in. |
off | The current user doesn't receive any notifications in the channel. |
If you want to routinely turn off push notification on the current user's client app according to a specified schedule, use our Do Not Disturb
feature like the following.
Note: The
Do Not Disturb
feature can also be set for a user with our update push notification preferences API.
To snooze notification messages for a specific period of time, use our snooze
feature as below.
Note: The
snooze
notifications can also be set for a user through an API request to update push preferences.