/ SDKs / Flutter
Chat SDKs Flutter v3
Chat SDKs Flutter
Chat SDKs
Version 3
Sendbird Chat SDK v3 for Flutter is no longer supported as a new version is released. Check out our latest Chat SDK v4

Push notification content templates

Copy link

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

Copy link

There are two types of push notification content template: default and alternative. Default template applies to users with the initial notification message setting. Alternative template is used when a user selects a different notification content template instead of the default template.

Whereas the content of the template is set at the application level, individual users can choose which type of template to use through the Chat Platform API.

Note: When a custom channel type has its own customized push notification content template, it ignores both default and alternative templates.

Both templates can be customized using the variables of sender_name, filename, message, channel_name, and file_type_friendly, which are replaced with corresponding string values. As for file_type_friendly, it indicates the type of file sent, such as audio, image, and video.

See the following table to learn how to use content templates.

List of content templates

Copy link
Text messageFile message

Default template

{sender_name}: {message}
An example can be Cindy: Hi!

An example can be hello_world.jpg

Alternative template

New message arrived

New file arrived

To apply a template to push notifications, use the setPushTemplate() method. Specify the type of template with the name as either default or alternative.

try {
    await sendbird.setPushTemplate('default');
} catch (e) {
    // Handle error.

To check the current user's push notification template, use the getPushTemplate() method as follows.

try {
    final template = await sendbird.getPushTemplate();
    if (template == 'default') {
        // The current user is using the default template.
    } else if (template == 'alternative') {
        // The current user is using the alternative template.
} catch (e) {
    // Handle error.