•about 2 months ago
A chat app generates a lot of data based on user interactions. In some cases, such as when you need to provide chat transcripts of a livestream event to the event organizer, it's essential to have easy access to that data in a flexible format. You can then transform the data into your preferred format for analysis by your organization or a third party.
While it's possible to use Stream Chat's standard client methods for exporting data from your chat channels, it may not always be the best option for large sets of data due to the constraints of pagination, data size, and possible rate limits.
To help you deal with this scenario, we implemented a convenient way for exporting channels that gives you all the data from one or multiple channels in the JSON format. Optionally, you can specify a timeframe for the data you want.
For now, exporting channels is only possible with the Stream Chat JS client.
To request the data from a channel, you should call the
exportChannel method. The parameters
messages_until are optional. If those are not included, the export will contain all data since the creation of the channel.
That method will not return the data itself, but an identifier (
task_id), which you can use to check on the export's status.
After you requested the channel export, you can periodically check the export status using the
getExportChannelStatus method to verify that it's complete.
Once the task is complete and there's no error, you can find the entire exported data by accessing the URL in the returned object.
It's also possible to export the history from multiple channels at once. The method is the same, but instead of a single object, you provide an array of objects containing the channel type and id. You can specify up to 25 channels. You can also specify
messages_until for each of them.
We're happy to bring yet another feature to help you understand your chat users better. For more information about this new feature, see the documentation on exporting channels. If you need help or have specific feedback about this feature, please leave a comment on the documentation page.