Mattermost (plugin)
Status: supported via plugin (bot token + WebSocket events). Channels, groups, and DMs are supported. Mattermost is a self-hostable team messaging platform; see the official site at mattermost.com for product details and downloads.Plugin required
Mattermost ships as a plugin and is not bundled with the core install. Install via CLI (npm registry):Quick setup
- Install the Mattermost plugin.
- Create a Mattermost bot account and copy the bot token.
- Copy the Mattermost base URL (e.g.,
https://chat.example.com). - Configure OpenClaw and start the gateway.
Native slash commands
Native slash commands are opt-in. When enabled, OpenClaw registersoc_* slash commands via
the Mattermost API and receives callback POSTs on the gateway HTTP server.
native: "auto"defaults to disabled for Mattermost. Setnative: trueto enable.- If
callbackUrlis omitted, OpenClaw derives one from gateway host/port +callbackPath. - For multi-account setups,
commandscan be set at the top level or underchannels.mattermost.accounts.<id>.commands(account values override top-level fields). - Command callbacks are validated with per-command tokens and fail closed when token checks fail.
- Reachability requirement: the callback endpoint must be reachable from the Mattermost server.
- Do not set
callbackUrltolocalhostunless Mattermost runs on the same host/network namespace as OpenClaw. - Do not set
callbackUrlto your Mattermost base URL unless that URL reverse-proxies/api/channels/mattermost/commandto OpenClaw. - A quick check is
curl https://<gateway-host>/api/channels/mattermost/command; a GET should return405 Method Not Allowedfrom OpenClaw, not404.
- Do not set
- Mattermost egress allowlist requirement:
- If your callback targets private/tailnet/internal addresses, set Mattermost
ServiceSettings.AllowedUntrustedInternalConnectionsto include the callback host/domain. - Use host/domain entries, not full URLs.
- Good:
gateway.tailnet-name.ts.net - Bad:
https://gateway.tailnet-name.ts.net
- Good:
- If your callback targets private/tailnet/internal addresses, set Mattermost
Environment variables (default account)
Set these on the gateway host if you prefer env vars:MATTERMOST_BOT_TOKEN=...MATTERMOST_URL=https://chat.example.com
default). Other accounts must use config values.
Chat modes
Mattermost responds to DMs automatically. Channel behavior is controlled bychatmode:
oncall(default): respond only when @mentioned in channels.onmessage: respond to every channel message.onchar: respond when a message starts with a trigger prefix.
oncharstill responds to explicit @mentions.channels.mattermost.requireMentionis honored for legacy configs butchatmodeis preferred.
Access control (DMs)
- Default:
channels.mattermost.dmPolicy = "pairing"(unknown senders get a pairing code). - Approve via:
openclaw pairing list mattermostopenclaw pairing approve mattermost <CODE>
- Public DMs:
channels.mattermost.dmPolicy="open"pluschannels.mattermost.allowFrom=["*"].
Channels (groups)
- Default:
channels.mattermost.groupPolicy = "allowlist"(mention-gated). - Allowlist senders with
channels.mattermost.groupAllowFrom(user IDs recommended). @usernamematching is mutable and only enabled whenchannels.mattermost.dangerouslyAllowNameMatching: true.- Open channels:
channels.mattermost.groupPolicy="open"(mention-gated). - Runtime note: if
channels.mattermostis completely missing, runtime falls back togroupPolicy="allowlist"for group checks (even ifchannels.defaults.groupPolicyis set).
Targets for outbound delivery
Use these target formats withopenclaw message send or cron/webhooks:
channel:<id>for a channeluser:<id>for a DM@usernamefor a DM (resolved via the Mattermost API)
Reactions (message tool)
- Use
message action=reactwithchannel=mattermost. messageIdis the Mattermost post id.emojiaccepts names likethumbsupor:+1:(colons are optional).- Set
remove=true(boolean) to remove a reaction. - Reaction add/remove events are forwarded as system events to the routed agent session.
channels.mattermost.actions.reactions: enable/disable reaction actions (default true).- Per-account override:
channels.mattermost.accounts.<id>.actions.reactions.
Multi-account
Mattermost supports multiple accounts underchannels.mattermost.accounts:
Troubleshooting
- No replies in channels: ensure the bot is in the channel and mention it (oncall), use a trigger prefix (onchar), or set
chatmode: "onmessage". - Auth errors: check the bot token, base URL, and whether the account is enabled.
- Multi-account issues: env vars only apply to the
defaultaccount.