Notifications

Notifications are a sub-resource of conversations.

POST/v1/{appId}/conversations/{conversationId}/notifications

Programmatically Re-triggering Notifications

If you want to send additional notifications for unanswered messages in a conversation after the initial one we automatically send, for example, to remind your users about recent messages, you can programmatically (re-)trigger notifications.

In that case, everybody who has unanswered messages will be notified. In practice this means that in a one-on-one conversation, precisely 1 notification will be sent each time you call the API without a user list: to whoever did not write the latest message.

Beware of calling this endpoint too frequently, as your customers may get overloaded with spam if they don't answer. TalkJS cannot distinguish between the situation where a conversation has obviously ended (e.g. because the last message is "Ok thanks, bye!") or where the conversation still awaits an answer (e.g. because the last message is "can you tell me how wide it is around the waist?"). This means that there is a risk that some unwanted reminders are sent. We believe that, barring advanced AI that has its own set of pitfalls and risks, there is no way around this.

POST/v1/{appId}/conversations/{conversationId}/notifications
1{
2 "channels": ["email", "sms"], // Required. Provide at least one channel to trigger.
3 // Rest of the values are optional
4 "recipients": ["user-1", "user-2"], // Omit this field to trigger for all participants with unanswered messages
5 "smsSettings": {
6 "smsTemplate": "({{app.name}}) {{sender.name}}: \"{{messages}}\". Reply here: https://yoursite.com/inbox"
7 },
8 "emailSettings": {
9 "footer": "On behalf of {{sender.name}},\nThe {{app.name}} team",
10 "header": "Hi {{recipient.name}},\n\n{{sender.name}} wants to chat with you on {{app.name}}:",
11 "subject": "{{sender.name}} wants to chat with you on {{app.name}}",
12 "inboxUrl": "https://yoursite.com/inbox",
13 "senderName": "{{sender.name}} (via {{app.name}})",
14 "inboxLinkText": "Click here to join the chat.",
15 "replySeparator": "--- Write ABOVE THIS LINE to post a reply via email ---",
16 "unsubscribeText": "Unsubscribe from all chat emails"
17 }
18}

If you would like to be informed about the status of the notifications, you can use the Webhooks to listen for notification.triggered and notification.sent events. Read more on Webhooks.

What does the "unanswered" message mean?

An unanswered message is a message that the notification recipient has not yet replied to. Unanswered messages are all messages that come after the latest message by the second person.

Example

This example shows a conversation between a hypothetical buyer and seller. The seller forgets to answer questions asked by the buyer.

1Buyer: Hey
2Seller: Hey!
3Buyer: I would like to order this chair. Could you please tell me how tall it is?
4[Seller is away]
5
6(day later)
7Buyer: Hello, could you also tell me what's the exact color?

If at this point you trigger a notification then it will consist of two messages:

1Buyer: I would like to order this chair. Could you please tell me how tall it is?
2Buyer: Hello, could you also tell me what's the exact color?