Caricamento in corso...
Caricamento in corso...
Last synced: Today, 22:00
Technical reference for the OpenClaw framework. Real-time synchronization with the official documentation engine.
Use this file to discover all available pages before exploring further.
Status: bundled 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.
If you are on an older build or a custom install that excludes Mattermost, install a current npm package when one is published:
If npm reports the OpenClaw-owned package as deprecated, use a current packaged OpenClaw build or the local checkout path until a newer npm package is published.
Details: Plugins
text```json5} { channels: { mattermost: { enabled: true, botToken: "mm-token", baseUrl: "https://chat.example.com", dmPolicy: "pairing", }, }, } ```
Native slash commands are opt-in. When enabled, OpenClaw registers
oc_*json5{ channels: { mattermost: { commands: { native: true, nativeSkills: true, callbackPath: "/api/channels/mattermost/command", // Use when Mattermost cannot reach the gateway directly (reverse proxy/public URL). callbackUrl: "https://gateway.example.com/api/channels/mattermost/command", }, }, }, }
Set these on the gateway host if you prefer env vars:
MATTERMOST_BOT_TOKEN=...MATTERMOST_URL=https://chat.example.comMATTERMOST_URL.env.envMattermost responds to DMs automatically. Channel behavior is controlled by
chatmodeConfig example:
json5{ channels: { mattermost: { chatmode: "onchar", oncharPrefixes: [">", "!"], }, }, }
Notes:
oncharchannels.mattermost.requireMentionchatmodeUse
channels.mattermost.replyToModeofffirstallfirstConfig example:
json5{ channels: { mattermost: { replyToMode: "all", }, }, }
Notes:
firstallchannels.mattermost.dmPolicy = "pairing"openclaw pairing list mattermostopenclaw pairing approve mattermost <CODE>channels.mattermost.dmPolicy="open"channels.mattermost.allowFrom=["*"]channels.mattermost.groupPolicy = "allowlist"channels.mattermost.groupAllowFromchannels.mattermost.groups.<channelId>.requireMentionchannels.mattermost.groups["*"].requireMention@usernamechannels.mattermost.dangerouslyAllowNameMatching: truechannels.mattermost.groupPolicy="open"channels.mattermostgroupPolicy="allowlist"channels.defaults.groupPolicyExample:
json5{ channels: { mattermost: { groupPolicy: "open", groups: { "*": { requireMention: true }, "team-channel-id": { requireMention: false }, }, }, }, }
Use these target formats with
openclaw message sendchannel:<id>user:<id>@usernameOpenClaw resolves them user-first:
GET /api/v4/users/<id>/api/v4/channels/directIf you need deterministic behavior, always use the explicit prefixes (
user:<id>channel:<id>When OpenClaw sends to a Mattermost DM target and needs to resolve the direct channel first, it retries transient direct-channel creation failures by default.
Use
channels.mattermost.dmChannelRetrychannels.mattermost.accounts.<id>.dmChannelRetryjson5{ channels: { mattermost: { dmChannelRetry: { maxRetries: 3, initialDelayMs: 1000, maxDelayMs: 10000, timeoutMs: 30000, }, }, }, }
Notes:
/api/v4/channels/direct429Mattermost streams thinking, tool activity, and partial reply text into a single draft preview post that finalizes in place when the final answer is safe to send. The preview updates on the same post id instead of spamming the channel with per-chunk messages. Media/error finals cancel pending preview edits and use normal delivery instead of flushing a throwaway preview post.
Enable via
channels.mattermost.streamingjson5{ channels: { mattermost: { streaming: "partial", // off | partial | block | progress }, }, }
message action=reactchannel=mattermostmessageIdemojithumbsup:+1:remove=trueExamples:
textmessage action=react channel=mattermost target=channel:<channelId> messageId=<postId> emoji=thumbsup message action=react channel=mattermost target=channel:<channelId> messageId=<postId> emoji=thumbsup remove=true
Config:
channels.mattermost.actions.reactionschannels.mattermost.accounts.<id>.actions.reactionsSend messages with clickable buttons. When a user clicks a button, the agent receives the selection and can respond.
Enable buttons by adding
inlineButtonsjson5{ channels: { mattermost: { capabilities: ["inlineButtons"], }, }, }
Use
message action=sendbuttonstextmessage action=send channel=mattermost target=channel:<channelId> buttons=[[{"text":"Yes","callback_data":"yes"},{"text":"No","callback_data":"no"}]]
Button fields:
When a user clicks a button:
External scripts and webhooks can post buttons directly via the Mattermost REST API instead of going through the agent's
messagebuildButtonAttachments()Payload structure:
json5{ channel_id: "<channelId>", message: "Choose an option:", props: { attachments: [ { actions: [ { id: "mybutton01", // alphanumeric only — see below type: "button", // required, or clicks are silently ignored name: "Approve", // display label style: "primary", // optional: "default", "primary", "danger" integration: { url: "https://gateway.example.com/mattermost/interactions/default", context: { action_id: "mybutton01", // must match button id (for name lookup) action: "approve", // ... any custom fields ... _token: "<hmac>", // see HMAC section below }, }, }, ], }, ], }, }
props.attachmentsattachmentstype: "button"idid[a-zA-Z0-9]context.action_ididcontext.action_idHMAC token generation
The gateway verifies button clicks with HMAC-SHA256. External scripts must generate tokens that match the gateway's verification logic:
Python example:
pythonimport hmac, hashlib, json secret = hmac.new( b"openclaw-mattermost-interactions", bot_token.encode(), hashlib.sha256 ).hexdigest() ctx = {"action_id": "mybutton01", "action": "approve"} payload = json.dumps(ctx, sort_keys=True, separators=(",", ":")) token = hmac.new(secret.encode(), payload.encode(), hashlib.sha256).hexdigest() context = {**ctx, "_token": token}
The Mattermost plugin includes a directory adapter that resolves channel and user names via the Mattermost API. This enables
#channel-name@usernameopenclaw message sendNo configuration is needed — the adapter uses the bot token from the account config.
Mattermost supports multiple accounts under
channels.mattermost.accountsjson5{ channels: { mattermost: { accounts: { default: { name: "Primary", botToken: "mm-token", baseUrl: "https://chat.example.com" }, alerts: { name: "Alerts", botToken: "mm-token-2", baseUrl: "https://alerts.example.com" }, }, }, }, }
© 2024 TaskFlow Mirror
Powered by TaskFlow Sync Engine