
























@@ -90,6 +90,7 @@ Native slash commands are opt-in. When enabled, OpenClaw registers `oc_*` slash
9090- For multi-account setups, `commands` can be set at the top level or under `channels.mattermost.accounts.<id>.commands` (account values override top-level fields).
9191- Command callbacks are validated with the per-command tokens returned by Mattermost when OpenClaw registers `oc_*` commands.
9292- Slash callbacks fail closed when registration failed, startup was partial, or the callback token does not match one of the registered commands.
93+9394</Accordion>
9495<Accordion title="Reachability requirement">
9596The callback endpoint must be reachable from the Mattermost server.
@@ -284,11 +285,13 @@ Enable via `channels.mattermost.streaming`:
284285- `block` uses append-style draft chunks inside the preview post.
285286- `progress` shows a status preview while generating and only posts the final answer at completion.
286287- `off` disables preview streaming.
288+287289</Accordion>
288290<Accordion title="Streaming behavior notes">
289291- If the stream cannot be finalized in place (for example the post was deleted mid-stream), OpenClaw falls back to sending a fresh final post so the reply is never lost.
290292- Reasoning-only payloads are suppressed from channel posts, including text that arrives as a `> Reasoning:` blockquote. Set `/reasoning on` to see thinking in other surfaces; the Mattermost final post keeps the answer only.
291293- See [Streaming](/concepts/streaming#preview-streaming-modes) for the channel-mapping matrix.
294+292295</Accordion>
293296</AccordionGroup>
294297@@ -362,6 +365,7 @@ When a user clicks a button:
362365- Button callbacks use HMAC-SHA256 verification (automatic, no config needed).
363366- Mattermost strips callback data from its API responses (security feature), so all buttons are removed on click — partial removal is not possible.
364367- Action IDs containing hyphens or underscores are sanitized automatically (Mattermost routing limitation).
368+365369</Accordion>
366370<Accordion title="Config and reachability">
367371- `channels.mattermost.capabilities`: array of capability strings. Add `"inlineButtons"` to enable the buttons tool description in the agent system prompt.
@@ -370,6 +374,7 @@ When a user clicks a button:
370374- If `interactions.callbackBaseUrl` is omitted, OpenClaw derives the callback URL from `gateway.customBindHost` + `gateway.port`, then falls back to `http://localhost:<port>`.
371375- Reachability rule: the button callback URL must be reachable from the Mattermost server. `localhost` only works when Mattermost and OpenClaw run on the same host/network namespace.
372376- If your callback target is private/tailnet/internal, add its host/domain to Mattermost `ServiceSettings.AllowedUntrustedInternalConnections`.
377+373378</Accordion>
374379</AccordionGroup>
375380@@ -465,6 +470,7 @@ context = {**ctx, "_token": token}
465470- Always sign **all** context fields (minus `_token`). The gateway strips `_token` then signs everything remaining. Signing a subset causes silent verification failure.
466471- Use `sort_keys=True` — the gateway sorts keys before signing, and Mattermost may reorder context fields when storing the payload.
467472- Derive the secret from the bot token (deterministic), not random bytes. The secret must be the same across the process that creates buttons and the gateway that verifies.
473+468474</Accordion>
469475</AccordionGroup>
470476@@ -500,6 +506,7 @@ Mattermost supports multiple accounts under `channels.mattermost.accounts`:
500506<Accordion title="Auth or multi-account errors">
501507- Check the bot token, base URL, and whether the account is enabled.
502508- Multi-account issues: env vars only apply to the `default` account.
509+503510</Accordion>
504511<Accordion title="Native slash commands fail">
505512- `Unauthorized: invalid command token.`: OpenClaw did not accept the callback token. Typical causes:
@@ -509,6 +516,7 @@ Mattermost supports multiple accounts under `channels.mattermost.accounts`:
509516 - the gateway restarted without reactivating slash commands
510517- If native slash commands stop working, check logs for `mattermost: failed to register slash commands` or `mattermost: native slash commands enabled but no commands could be registered`.
511518- If `callbackUrl` is omitted and logs warn that the callback resolved to `http://127.0.0.1:18789/...`, that URL is probably only reachable when Mattermost runs on the same host/network namespace as OpenClaw. Set an explicit externally reachable `commands.callbackUrl` instead.
519+512520</Accordion>
513521<Accordion title="Buttons issues">
514522- Buttons appear as white boxes: the agent may be sending malformed button data. Check that each button has both `text` and `callback_data` fields.
@@ -518,6 +526,7 @@ Mattermost supports multiple accounts under `channels.mattermost.accounts`:
518526- Gateway logs `missing _token in context`: the `_token` field is not in the button's context. Ensure it is included when building the integration payload.
519527- Confirmation shows raw ID instead of button name: `context.action_id` does not match the button's `id`. Set both to the same sanitized value.
520528- Agent doesn't know about buttons: add `capabilities: ["inlineButtons"]` to the Mattermost channel config.
529+521530</Accordion>
522531</AccordionGroup>
523532此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。