Templates are the core of how Sendbird Notifications works. They allow brands to send personalized in-app notifications by building and using multiple templates for each channel. Templates can be created and customized on Sendbird Dashboard without writing code. This allows non-engineers such as, product managers and marketers, to easily compose up to 100 different templates and send notifications that fit the right use case needs.
Templates act as the starting point for Sendbird Notifications. You need to create a template first before sending and receiving the notification. You can build a template for either Feed view or Chat view and set variables in the template editor. Then, Sendbird allows you to send the notification using two ways: Notifications API or external platforms such as CleverTap and Braze.
To see if your notification's been successfully sent, you need to install Sendbird Chat UIKit for Notifications to render a notification channel in your app. Sendbird Notifications currently only supports mobile platforms: iOS and Android.
Create a template for Feed or Chat view
When creating your first template, you can choose between two channel views: Feed or Chat. When the template is created, a notification channel with the selected view is automatically created as well. As shown in the image below, notifications look different in each view. In a Feed view, the template contains a green badge that indicates new notification and disappears when the user reads the notification. In a Chat view, the template contains a channel image and a timestamp.
To learn more about the difference between Feed view and Chat view, see Notification channel.
Variables are an important aspect of building templates. They're the customizable parts of the template that you can change each time you send a notification. There are three different types of variables that Sendbird Notifications provides.
Specifies the texts used in the body of the template and the text buttons. These texts are subject to change each time the notification is sent. The string variable is shown as a text field in the Sendbird Notification Builder. You can assign a value to the key of the variable before sending the notification.
Specifies the images used in the template. These images are subject to change each time the notification is sent. The image variable is shown as an image URL field in the Sendbird Notification Builder. You can assign a value to the key of the variable before sending the notification.
Specifies the actions to execute when a UI component in the template is tapped on the mobile app. These actions are subject to change each time the notification is sent. The action variable is shown as a drop-down menu containing two action types and a URL field in the Sendbird Notification Builder. You can assign two different types of action values to the variable key: Web link and In-app link.
To see how to set variables in a template using the API, refer to Notifications API.