#19957: feat(mattermost): add interactive buttons support
docs
channel: mattermost
size: XL
Cluster:
Mattermost Integration Enhancements
## Summary
Adds interactive button support, directory adapter, and channel name resolution for Mattermost.
**Interactive buttons:**
- HMAC-SHA256 token verification for secure button callbacks
- HTTP callback handler registered via `registerPluginHttpRoute`
- Button click completion: replaces buttons with "✓ **Button Name** selected by @user"
- Immediate agent response to button clicks via `dispatchButtonClick` pipeline
- Localhost-only validation for callback requests
- Stable HMAC secret derived from bot token (works across CLI/gateway)
- Sorted-key HMAC generation (Mattermost reorders context keys)
- `sanitizeActionId()` strips hyphens/underscores from IDs ([Mattermost routing bug](https://github.com/mattermost/mattermost/issues/25747))
- 2D→1D button array flattening (core sends `Array<Array<Button>>` for Telegram row layout)
- Empty-name button filter (prevents white-box rendering)
**Directory adapter:**
- Channel/user name resolution via `listGroups` and `listPeers`
- Multi-account support with deduplication by token
- Graceful fallback when accounts are unavailable
- `#channel-name` and bare names trigger directory lookup (not 403)
**Channel actions:**
- `listActions` returns `["send", "react"]`
- `supportsButtons`, `handleAction` for the `ChannelPlugin` interface
- Send action with optional button attachments
**Config & types:**
- Zod schema for `interactions.callbackBaseUrl`
- TypeScript types for interactions config on `MattermostAccountConfig`
**Also includes:**
- `updateMattermostPost` for modifying existing posts (button completion)
- `props` passthrough in `createMattermostPost` for attachments
- `parseMattermostTarget` with channel-name and `isMattermostId` support
- `fetchMattermostChannelByName` and `fetchMattermostUserTeams` client methods
- Documentation for buttons and directory adapter in `docs/channels/mattermost.md`
- Comprehensive test coverage (98 tests across 7 test files)
## AI-assisted
Built with Claude Code. Fully tested locally on a live Mattermost instance (button rendering, HMAC verification, click handling, agent response confirmed end-to-end).
## Test plan
- [x] `pnpm check` passes
- [x] `pnpm test` passes (98/98 extension tests)
- [x] Test button rendering in Mattermost channel
- [x] Test button click callback and HMAC verification
- [x] Test button completion (replacement text after click)
- [x] Test agent responds to button selection
- [x] Test `sanitizeActionId` with hyphenated/underscored IDs
- [x] Test directory resolution (channel names, user lookup)
Most Similar PRs
#12468: feat(mattermost): add read, search, and channel-list actions
by adamsbytes · 2026-02-09
71.5%
#19265: feat(mattermost): Add directory adapter for channel/user name resol...
by oskarmodig · 2026-02-17
70.9%
#20928: mattermost: add readMessages action for channel history
by hubertusgbecker · 2026-02-19
70.7%
#18657: feat(mattermost): add native slash command support (refresh)
by echo931 · 2026-02-16
66.4%
#19991: feat(telegram): callback direct mode with dedupe, button state, and...
by li-yifei · 2026-02-18
65.0%
#16570: feat(mattermost): add replyToMode threading support
by FBartos · 2026-02-14
64.3%
#10027: Mattermost: fix attachment downloads (GET + private-network hosts)
by transportrefer · 2026-02-06
64.2%
#20527: feat(mabos): complete setup_auto_fix and wire real channel testing
by kingler · 2026-02-19
63.0%
#20348: Add support for Keybase as a channel
by xgess · 2026-02-18
62.8%
#18940: Agents: expose message tool buttons schema in scoped contexts
by saurabhchopade · 2026-02-17
62.7%