<img height="1" width="1" style="display:none;" alt="" src="https://dc.ads.linkedin.com/collect/?pid=254577&amp;fmt=gif">

Enabling push notifications, snooze, and Do not disturb in SendBird

Push notifications are essential for any app with chat and messaging because users receive messages from people they care about, about topics highly relevant to them, or from interactions they value. Users participate in conversations for good reasons and they don’t want to miss a message. The need for push notifications only increases if a user is responsible for reading and responding to a message as in, for example, work settings.

It is now a common standard to give users options to control when they receive push notifications. In fact, users expect it. As users try to balance the utility of notifications with setting boundaries around them, users now expect to set up “Do not disturb” statuses, snooze notifications, or control when they receive a push notification. 

This article describes SendBird’s push notification options and, importantly, references how to implement them in the client and backend using the iOS, Android, Javascript SDKs or Platform API. 

Push notification preferences in SendBird

SendBird has three categories of options for push notifications:

  1. General options for users and channels - these allow your users to control when they receive push notifications
  2. Snooze - allows the user to suspend notifications for a set a period
  3. Do not disturb - allows users to routinely suspend notifications for set periods each day

Push notification preferences, aka ‘Push Trigger Options’

SendBird allows your users to set preferences for push notifications using two dimensions: 

  • User preference
  • Group channel preference

SendBird calls these general options for push notifications, “Push Trigger Options.”

To allow users to configure their own preferences, you can use a SendBird object for Android, the JavaScript SDK, or SBDMain for iOS. This is available in all SDKs since Android SDK 3.0.86, JavaScript SDK 3.0.93, and iOS SDK 3.0.128. 

Push notification preferences for users

There are three user options available for setting push notification preferences. Note that the SendBird documentation refers to these as Push Trigger Options.

  1. ‘all’ : User receives push notifications for all new messages while offline, including mentioned messages
  2. ‘off’ : User does not receive any push notifications
  3. ‘mention_only’ : User receives push notifications only for messages in which the user is mentioned

Push notification options for Group Channels

Please note that options for push notifications are only available in group channels. They are not available for open channels.

There is one additional group channel preference compared to the user preferences described in the last section: default. Note that the SendBird documentation refers to these as Push Trigger Options.

  1. ‘all’ : User receives push notifications for all new messages in this channel while offline, including mentioned messages
  2. ‘off’ : User does not receive any push notifications for any messages in this channel
  3. ‘mention_only’ : User receives push notifications only for messages in which the user is mentioned in this channel
  4. ‘default’: The user’s push notification preferences applies to this channel

References for general push notification options

The following is a table of references for Push Trigger Options from our iOS, Android, and JavaScript SDKs. Where possible we linked directly to the reference library or indicate the line in the source code. 

For iOS,

For Android,

For JavaScript,

See our documentation for further reference: 

Option to snooze push notifications

In SendBird’s parlance, to ‘Snooze’ push notifications means the user does not receive any notifications for a specific period of time, which has a user-defined start and end. This period does not repeat. 

Please note that Snooze is only a user option and not a group channel option. A user’s Snooze setting will override any other user or channel push preferences during the Snooze period.

You can enable the option to ‘Snooze’ in the client app or from Platform API. The start- and end-time are in Unix Milliseconds, or 13-digit numbers.

References for snooze

The following is a table of references for Snooze from our iOS, Android, and JavaScript SDKs. Where possible we linked directly to the reference library or indicate the line in the source code. 

For iOS,

For Android,

For JavaScript,

See additional references for setting a snooze on notifications: 

Options for ‘Do not disturb’

In SendBird’s parlance, to set a ‘Do not disturb’ (DND) means that the user routinely does not receive any notifications at certain times of the day. These periods repeat every day. 

Note that DND is a user option and not an option for group channels. A user’s DND setting will routinely override any user or channel preferences for push notifications during the set period of time.

You can enable DND in the client app or from Platform API. The start- and end-time are expressed as integers: start_hour and start_min, end_hour and end_min.

References for ‘Do not disturb’

The following is a table of references for ‘Do not disturb’ from our iOS, Android, and JavaScript SDKs. Where possible we linked directly to the reference library or indicate the line in the source code.

For iOS,

For Android,

For JavaScript,

See our references for setting a ‘Do not disturb’ on notifications: 

Setting push preferences at the message level

SendBird also gives you an option to set the push notification preference at the message level. 

Both text and file messages have an optional Boolean property, send_push, that allows you to toggle on or off a push notification for a message. It defaults to being on, or True.

You can read more about the send_push optional message property in the Platform API documentation here.

How SendBird applies notification preferences

Given many options for notifications, it’s important to understand how the options are applied and what results from the combination of user, group channel, and other options.

Basically, you enable push notification preferences at the message, user, and group channel level. DND and Snooze, if in effect, always supersede Trigger Options (at the user and group channel level).

push notifications 2

The following flow chart gives you the permissions hierarchy in granular detail.

push notifications 1

User controls for push notifications are now standard

Thanks to the proliferation of messenger apps and chat collaboration software, user options for controlling push notifications are now a standard feature, more or less expected by users. SendBird’s SDKs and Platform API enable you to easily build these features for your users and deliver the excellent messaging experience they’ve come to expect.

 

Start Now

Written by

Imju Byon

Solutions Engineering Manager

TAGS Editor's pick | Product

Subscribe to Email Updates

Recent Posts