Export room messages to a file or email. When exporting to a file, the ZIP file is stored in the /tmp directory on the Rocket.Chat server, and its details are recorded in the rocketchat_user_data_files collection in MongoDB.
Permission required: mail-messages
Changelog
| Version | Description |
|---|---|
| 3.8.0 | Added |
The authToken of the authenticated user.
The userId of the authenticated user.
{
"rid": "iu7jtPAhvEeAS5tNq",
"type": "file",
"dateFrom": "2000-01-01",
"dateTo": "2021-11-25",
"format": "html",
"toUsers": [
"test.user"
],
"toEmails": [
"test@test.com"
],
"messages": [
"yd6NBgNoiWATgDoFt",
"BoCjicj9DdYoMHHeo",
"tajMB3aX3sawFWe8W"
],
"subject": "Test Subject "
}The room ID.
How you want the room to be exported. The type of export selected determines the remaining required parameters. It can be either email or file.
Start date to begin fetching. Use dateFrom if the type is file. By default, it selects the oldest possible date.
End date for fetching. By default it selects the current date. Use dateTo if the type is file.
The file type to export as. It can either be html or json. Use format if the type is file.
An array of users that should recieve the export. ecieve the export. It is required if type is email.
An array of any additional emails that should recieve the export. It is required if type is email.
An array of messageId for the messages that should be exported. It is required if type is email.
The subject of the email. It is required if type is email.
OK
{
"success": true
}Bad Request
{
"success": false,
"error": "[error-invalid-room]",
"errorType": "error-invalid-room"
}{
"success": false,
"error": "[error-invalid-format]",
"errorType": "error-invalid-format"
}{
"success": false,
"error": "[error-invalid-params]",
"errorType": "error-invalid-params"
}Unauthorized
{
"status": "error",
"message": "You must be logged in to do this."
}Forbidden
{
"success": false,
"error": "User does not have the permissions required for this action [error-unauthorized]"
}