OrbTop

Mattermost Message Scraper

SOCIAL MEDIABUSINESS

Mattermost Message Scraper - Export Chat History from Self-Hosted or Cloud

Export messages from any Mattermost workspace — both self-hosted instances and Mattermost Cloud. Connect with your instance URL and a personal access token to scrape teams, channels, and posts. Supports filtering by team name, channel name, date range, and direct messages. Returns 23 fields per message including team and channel context, author, message body (plain Markdown), reactions, and file attachment IDs.

post_message is stored as plain Markdown text, which makes it directly usable for Confluence or Notion imports, RAG pipeline ingestion, or knowledge base extraction without additional parsing.

What does the Mattermost scraper do?

It authenticates to the Mattermost REST API v4 using your personal access token, enumerates teams and channels accessible to that user, and paginates through posts in each channel. Usernames are resolved from a local cache to minimize API calls. The default API rate limit on self-hosted Mattermost is generous for authenticated users — typically 200+ requests per second.

What data does it extract?

Each record represents one Mattermost post:

Field Type Description
instance_url string Base URL of the Mattermost instance
team_id string Team UUID
team_name string Team URL slug
team_display_name string Team display name
channel_id string Channel UUID
channel_name string Channel URL slug
channel_display_name string Channel display name
channel_type string O=public, P=private, D=direct, G=group
channel_header string Channel header text
channel_purpose string Channel purpose text
post_id string Post UUID
post_root_id string Parent post UUID (empty for root posts, set for thread replies)
post_create_at integer Creation timestamp in milliseconds since Unix epoch
post_update_at integer Last update timestamp in ms
post_edit_at integer Last edit timestamp in ms (0 if never edited)
post_user_id string Author's user UUID
post_user_username string Author's username
post_message string Post body text (Markdown)
post_type string Empty for regular posts; system_* for system messages
post_hashtags string Space-separated hashtags
post_reactions string JSON array of emoji reactions [{emoji_name, user_id, create_at}]
post_file_ids string JSON array of file attachment IDs
post_props string JSON object with post metadata (attachments, overrides, etc.)

Sample output record

{
  "instance_url": "https://community.mattermost.com",
  "team_display_name": "Contributors",
  "channel_display_name": "Town Square",
  "channel_type": "O",
  "post_id": "3yd1q7gcrinbdmdq5qmnggd4xy",
  "post_root_id": "",
  "post_create_at": 1748063442000,
  "post_user_username": "john.doe",
  "post_message": "Has anyone seen the new API docs? The pagination endpoint changed.",
  "post_type": "",
  "post_reactions": "[{\"emoji_name\":\"thumbsup\",\"user_id\":\"abc123\",\"create_at\":1748063500000}]",
  "post_file_ids": "[]"
}

How to use it

Input Required Description
instanceUrl Yes Base URL of your Mattermost instance (e.g. https://mattermost.yourcompany.com). Works with self-hosted and Mattermost Cloud.
accessToken Yes Personal access token (see setup below)
teamNames No List of team URL slugs to scrape. Leave empty for all accessible teams.
channelNames No List of channel names to scrape within selected teams. Leave empty for all.
sinceDate No Only fetch posts on or after this date (ISO 8601)
untilDate No Only fetch posts on or before this date (ISO 8601)
includeDirectMessages No Set true to include DM and group message channels
maxItems No Maximum number of posts to return

Generating a personal access token

  1. Log in to your Mattermost instance
  2. Go to Account SettingsSecurityPersonal Access Tokens
  3. Click Create Token, give it a description, and copy the token

The path may vary slightly between Mattermost versions and UI themes. Administrators can also generate tokens from the Admin PanelUsers panel for any user account.

Example input

{
  "instanceUrl": "https://mattermost.yourcompany.com",
  "accessToken": "your-personal-access-token",
  "teamNames": ["engineering"],
  "channelNames": ["general", "incidents"],
  "sinceDate": "2024-01-01",
  "maxItems": 5000
}

Use cases

  • Compliance archival — export message history for legal hold or regulatory retention requirements in enterprise and government Mattermost deployments
  • Platform migration — export messages to move to Slack, Microsoft Teams, or a custom data warehouse
  • Knowledge base exportpost_message is plain Markdown, so channel history exports directly to Confluence, Notion, or any RAG pipeline without additional parsing
  • Incident retrospectives — extract incident channel history for post-mortems, filtered by date range
  • Communication analytics — analyze team communication patterns, channel activity, and response times across channels

FAQ

Does this work with Mattermost Cloud? Yes. Set instanceUrl to your cloud workspace URL (e.g. https://yourteam.cloud.mattermost.com). The REST API v4 is identical between self-hosted and cloud.

What permissions does the token need? A standard personal access token with the authenticated user's default permissions is sufficient. The actor only reads data the token's user can access — private channels and DMs are included only if the user is a member.

How do I handle very large workspaces? Set maxItems to limit the run, then resume by setting sinceDate to the date of the last run. The actor pages through channels in batches of 200 posts per API request.

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