Customize notifications
You can customize the email and SMS notifications that TalkJS sends to offline users directly from the Notifications page in your dashboard.
In customizing your email and SMS settings, you can use a limited macro syntax, for example Hello {{recipient.name}}!
.
You can also pass your metadata for users or conversations using the macro syntax. For example, you can specify a custom special token {{sender.custom.specialToken}}
. The custom
field has to be an object with strings as values.
For example, you can specify a special token for Alice in your code:
1const me = new Talk.User({2 id: "123456",3 name: "Alice",4 ...5 custom: {6 specialToken: "jd71ba91n"7 }8});
Similarly, you can customize a conversation:
1const conversation = session.getOrCreateConversation('order_83562938');2conversation.setParticipant(me);3conversation.setParticipant(other);4conversation.setAttributes({5 subject: 'Hair Wax 5 Gallons',6 custom: {7 sellerId: 'seller_mq082jqid92',8 },9});
You can use these custom attributes of users or conversations in the dashboard to customize your email template.
If you would like to have different notifications for different users, create a separate role for each user group and adjust the notification settings per role.
Custom email themes are available on the Growth plan and up.
Custom email themes offer an even more flexible way to add markup and data to email notifications. You can create a custom email theme from the Themes page of your dashboard, in the section 'Email themes'.
For a step-by-step guide on sending users different customized email notifications, see: How to customize email notifications for different types of users in a TalkJS chat.