Export Chat Dump of a Session
You can programmatically retrieve all chat messages of a Dyte session using Chat Replay API.
Chat Replay API is not enabled by default for your organization. Contact Us to enable the Chat Replay API for your organziation.
Once Chat Replay API is enabled, do the following:
- Get the
chat_download_urlusing Chat Replay API.
- Download the chat dump CSV file.
To get the
chat_download_url, make a
HTTP GET request to
Chat Replay API. The API returns the
chat_download_urlis the AWS S3 signed URL to download the whole chat dump of a session in a CSV format.
chat_download_url_expirytimestamp indicates when the
chat_download_urlwill expire. If a
chat_download_urlis expired, just call this endpoint again to generate a new download URL.
Download the chat dump file
You can download the chat dump file in CSV format by making
HTTP GET request
chat_download_url that you obtained in the previous step.
Download on the client
To download at client side, do the following:
- Make a GET request to the
- Convert response to blob.
- Create an invisible
<a>HTML element with download attribute and add the above blob to it's
- Programatically click on the
<a>element so that the browser automatically starts downloading and then remove the
Download on the server
Node.js streams to download files on the server, so the steps are as
- Create a writable stream for a local file.
- Make a GET request to
- Get a readable stream using
res.bodyand pipe to the writable stream created in the first step.
Example: CSV chat dump File
This CSV file contains all the chat messages along with the participant's name and some other metadata. It contains the following column headers:
id: This is the chat message ID unique to each chat message.
participantId: This is the ID of the participant that sent this message.
sessionId: The ID of the session in which this chat message was sent. This will be the same as what you sent as URL param in the above endpoint.
meetingId: The id of the meeting to which this session belongs to.
displayName: Display name of the participant who sent this message.
pinned: A boolean that indicates if the current message was pinned or not.
isEdited: A boolean that indicates if the current message was edited or not.
payloadType: An ENUM that indicates the type of payload sent in the chat message. It can be one of TEXT_MESSAGE, IMAGE_MESSAGE, FILE_MESSAGE.
payload: The actual payload sent in this chat message.
createdAt: Timestamp when this chat message was sent
For more information on downloading the file, refer to How to Fetch Chat History of a Dyte Session blog.