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. As for the file_type_friendly, it indicates the type of the file sent, such as Audio, Image, and Video.
Refer to the following table for the usage of content templates.
| Text message | File message | |
|---|---|---|
Default template | {sender_name}: {message} An example can be | {filename} An example can be |
Alternative template |
|
|
To apply a template to push notifications, use the setPushTemplate(name:completionHandler:) method. Specify the type of the template with the name as either SendbirdChat.PushTemplate.default or SendbirdChat.PushTemplate.alternative.
You can check the current user's setting with getPushTemplate(completionHandler:) like the following.