Notifications are a sub-resource of conversations.

Path: /v1/{appId}/conversations/{conversationId}/notifications
Methods:POST

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 https://api.talkjs.com/v1/{appId}/conversations/{conversationId}/notifications

{
  "channels": ["email", "sms"], // Required. Provide at least one channel to trigger.
  // Rest of the values are optional
  "recipients": ["user-1", "user-2"], // Omit this field to trigger for all participants with unanswered messages
  "smsSettings": {
    "smsTemplate": "({{app.name}}) {{sender.name}}: \"{{messages}}\". Reply here: https://yoursite.com/inbox"
  },
  "emailSettings": {
    "footer": "On behalf of {{sender.name}},\nThe {{app.name}} team.",
    "header": "Hi {{recipient.name}},\n\n{{sender.name}} wants to chat with you on {{app.name}}:",
    "subject": "{{sender.name}} wants to chat with you on {{app.name}}",
    "inboxUrl": "https://yoursite.com/inbox",
    "senderName": "{{sender.name}} (via {{app.name}})",
    "inboxLinkText": "Click here to join the chat.",
    "replySeparator": "--- Write ABOVE THIS LINE to post a reply via email ---"
  }
}

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.

Buyer: Hey
Seller: Hey!
Buyer: I would like to order this chair. Could you please tell me how tall it is?
[Seller is away]

(day later)
Buyer: 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:

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