OrbTop

Rocket.Chat Message Scraper

SOCIAL MEDIABUSINESS

Rocket.Chat Message Scraper - Export Chat History via REST API

Export messages, channels, private groups, and direct messages from any Rocket.Chat instance using the official REST API. Works with Rocket.Chat Community Edition, Enterprise Edition, and cloud-hosted workspaces. Authenticate with a User ID and personal access token, then filter by room type, date range, or specific room IDs.

What does the Rocket.Chat scraper do?

It connects to the Rocket.Chat REST API, enumerates rooms accessible to the authenticated user (channels, private groups, and optionally direct messages), and paginates through message history at 100 messages per request. Thread replies can be enabled with an extra API call per thread. Usernames and display names are resolved per message.

For very large workspaces, use maxItems to limit run size and re-run with dateFrom set to the previous run's cutoff to process incrementally.

Typical throughput on a self-hosted instance depends on that instance's rate limit configuration. The API pages at 100 messages per request, so a workspace with 100,000 messages requires approximately 1,000 API calls.

What data does it extract?

Each record represents one Rocket.Chat message:

Field Type Description
instance_url string Base URL of the Rocket.Chat instance
room_id string Rocket.Chat room identifier
room_name string Human-readable room name
room_type string c=channel, p=private group, d=direct message
room_topic string Room topic string
room_description string Room description string
message_id string Unique message identifier
message_rid string Room ID the message belongs to
message_ts string Message creation timestamp (ISO 8601)
message_update_at string Last edit timestamp (ISO 8601)
message_user_id string Sender User ID
message_user_username string Sender username
message_user_name string Sender display name
message_msg string Plain-text message body
message_type string Empty for normal messages; rm=deleted, uj=join, ul=leave, etc.
message_thread_msg_id string Parent message ID if this is a thread reply
message_attachments string JSON array of file/image attachments
message_reactions string JSON map of emoji reactions and user lists
message_urls string JSON array of embedded URLs
message_mentions string JSON array of @mentions
message_channels string JSON array of #channel references

Sample output record

{
  "instance_url": "https://open.rocket.chat",
  "room_name": "general",
  "room_type": "c",
  "message_id": "abc123xyz",
  "message_ts": "2024-06-01T09:14:22.000Z",
  "message_user_username": "jane.smith",
  "message_user_name": "Jane Smith",
  "message_msg": "Here's the updated runbook for the deploy process.",
  "message_type": "",
  "message_reactions": "{\":thumbsup:\":{\"usernames\":[\"john.doe\"],\"names\":[\"John Doe\"]}}",
  "message_attachments": "[]",
  "message_urls": "[]"
}

How to use it

Generating a personal access token

  1. Log in to your Rocket.Chat instance
  2. Click your avatar, then select Profile
  3. Scroll to Personal Access Tokens and click Add
  4. Copy both the Token and your User ID shown above the token list

The token path may vary between Rocket.Chat Community and Enterprise UI versions. Administrators can also generate tokens from Admin PanelUsers for any account.

Input parameters

Parameter Required Description
instanceUrl Yes Base URL of your Rocket.Chat instance (e.g. https://chat.example.com)
userId Yes Your Rocket.Chat User ID
authToken Yes Personal access token
roomIds No Limit to specific room IDs. Leave empty for all accessible rooms.
roomTypes Yes Array of room types: c (channels), p (private groups), d (direct messages)
dateFrom No Only fetch messages on or after this date (ISO format)
dateTo No Only fetch messages on or before this date (ISO format)
includeThreadReplies No Fetch replies nested in threads (adds extra API calls). Default: false
maxItems No Maximum records to save. 0 = unlimited

Example input

{
  "instanceUrl": "https://chat.yourcompany.com",
  "userId": "your-user-id",
  "authToken": "your-access-token",
  "roomTypes": ["c", "p"],
  "dateFrom": "2024-01-01",
  "maxItems": 10000
}

Use cases

  • Compliance archival — export message history for legal or regulatory retention from enterprise self-hosted deployments
  • Platform migration — extract messages before moving to Slack, Microsoft Teams, or a custom data warehouse
  • Knowledge base extraction — mine channel history for documentation; message_msg is plain text ready for import into Confluence, Notion, or a RAG pipeline
  • Communication analytics — analyze message volume, response times, and topic trends across channels and time windows
  • Backup — create offline snapshots of workspace history before a major upgrade or infrastructure change

FAQ

Does this work with cloud-hosted Rocket.Chat? Yes. Set instanceUrl to your cloud workspace URL. The REST API is identical across hosting models.

What rooms can the actor access? Only rooms visible to the authenticated user. Public channels, private groups the user belongs to, and (if enabled) direct messages. Admin accounts can access more rooms than regular users.

How do I handle authentication errors? Authentication failures produce an error record with status: AUTH_ERROR. Verify that the User ID and token are from the same Rocket.Chat instance and that personal access tokens are enabled by your admin.

Output is available in JSON, CSV, and Excel via the Apify dataset export panel.