Customizing Notifications

If you created roles, you can customize content of the email and SMS notifications that TalkJS sends to users when they receive a message and aren't online. The fields in the dashboard support a limited macro syntax, e.g. Hello {{recipient.name}}!, and email themes offer an even more flexible way to add markup and data to email notifications. You can also pass your metadata for users or conversations to benefit from the macro syntax (e.g. {{sender.custom.specialToken}}). The custom field has to be an object with strings as values. For example, you can specify special token for Alice:

const me = new Talk.User({
id: "123456",
name: "Alice",
...
custom: {
specialToken: "jd71ba91n"
}
});

You can use the specialToken defined by you in the dashboard to customize the email template.

In the exact same way you can customize a Conversation:

const conversation = session.getOrCreateConversation('order_83562938');
conversation.setParticipant(me);
conversation.setParticipant(other);
conversation.setAttributes({
subject: 'Hair Wax 5 Gallons',
custom: {
sellerId: 'seller_mq082jqid92',
},
});

All set! TalkJS ought to be production-ready for you now. Optionally, however, you maybe first want to customize the design, or customize the email theme.

You can also follow this step-by-step tutorial that shows how you could have different email notifications for different users.