Push notification content templates
Push notification content templates are pre-formatted forms that can be customized to display your own push notification messages on a user’s device. Sendbird provides two types: Default and Alternative. Both templates can be customized in Settings > Chat > Push notifications > Push notification content templates on Sendbird Dashboard.
Content templates
There are two types of push notification content template: Default and Alternative. Default template is a template that applies to users with the initial notification message setting. Alternative template is sent to those who opted to a different notification message setting.
The content in the template is set at the application level while the selection of templates is determined by a user or through the Platform API.
Note: When a custom channel type has its own customized push notification content template, it takes precedence over the default or alternative templates.
Both templates can be customized using the variables of sender_name
, filename
, message
, channel_name
, and file_type_friendly
which will be replaced with the corresponding string values. The file_type_friendly
field indicates the type of the file sent, such as Audio, Image, and Video.
Refer to the following table for the usage of content templates.
Content templates use cases
Text message | File message | |
---|---|---|
DEFAULT | {sender_name}: {message} | {filename} |
ALTERNATIVE |
|
|
To apply a template to push notifications, use the setPushTemplate()
method. Specify the template name as either with PushTemplate.DEFAULT
or PushTemplate.ALTERNATIVE
.
To check the current user's push notification template, use the getPushTemplate()
method like the following.