Message Receipts

August 9, 2023 · View on GitHub

‼️ MUST ENABLE this feature for your Connect instance

Render and send read/delivered message receipts. Enabled by default in ChatInterface + ChatJS

Message receipts use sendEvent API for sending Read/Delivered events

View receipts

Reference

Implementation Resources

Configuration

Disable Message Receipts

Enabling/disable message-receipts (Read/Delivered) for messages in setGlobalConfig():

connect.ChatSession.setGlobalConfig({
  loggerConfig: { /* ... */ },
  /* ... */
  features: {
    messageReceipts: {
      shouldSendMessageReceipts: true, // DEFAULT: true, set to false to disable Read/Delivered receipts
    }
  }
});

Custom Throttle Time

To customize wait time before sending read/delivered receipt, set the throttle in global config:

connect.ChatSession.setGlobalConfig({
  loggerConfig: { /* ... */ },
  /* ... */
  features: {
    messageReceipts: {
      shouldSendMessageReceipts: true, // DEFAULT: true
      throttleTime: 5000 //default throttle time - time to wait before sending Read/Delivered receipt.
    }
  }
});

Refer to PR #80 for related code changes. Note-able files are listed below:

  • index.js: enable/disable or set throttling time for sending message-receipts
  • ChatTranscriptor.js + Utils.js: update the model to parse API response and find read/delivered receipt
  • ChatMessage.js: use react-intersection-observer to send read receipt and handle display logic
  • ChatSession.js: add read/delivered eventHandlers for ChatJS handshake and sending receipt for last message
  • ChatJS: use latest version with updated feature configuration