Exporting Channels

Last Edit: Nov 27 2020

This method allows you to request an export of one or many channels and download all messages and metadata posted without using the regular message pagination.

Channel exports are created asynchronously, you can use the Task ID returned by the APIs to keep track of the status and to download the final result when it is ready.

The data created by the export is following the same format as the regular APIs and is JSON encoded. By default the entire history is included in the export, but you may optionally request the export to include only the messages in a specific interval using the messages_since and messages_until date parameters.

Requesting a channel export

const response = await serverClient.exportChannel({
    type: "livestream",
    id: "white-room", 
    messages_since: "2020-11-10T09:30:00.000Z",
    messages_until: "2020-11-10T11:30:00.000Z",

const taskID = response.task_id;

Retrieving the status of the export

You can check the status of an export request using the task ID returned when the task was created.

The result of the task contains the URL to the JSON file.

const response = await serverClient.getExportChannelStatus(taskId);

console.log(response.status);       // the status for this task
console.log(response.result);       // the result object, only present if the task is completed
console.log(response.result.url);   // the link to the JSON export
console.log(response.error);        // if not null the description of the task error

Request the export for multiple channels

You can also request the export for multiple channels at once. Up to 25 channels can be exported with a single export request.

await serverClient.exportChannel([
    {type: "livestream", id: "blue-room"},
    {type: "livestream", id: "red-room"},
    {type: "livestream", id: "purple-room"},