docs/guides/mattermost-ai-agent.md
This guide connects nanobot to Mattermost through the built-in Mattermost channel, using WebSocket events and the Mattermost REST API.
mattermost channel enabled in nanobotnanobot agent -m "Hello!"
python -m pip install nanobot-ai
nanobot onboard --wizard
Merge this snippet into ~/.nanobot/config.json:
{
"channels": {
"mattermost": {
"enabled": true,
"serverUrl": "https://mattermost.example.com",
"token": "YOUR_MATTERMOST_TOKEN",
"teamId": "YOUR_TEAM_ID",
"groupPolicy": "mention",
"replyInThread": true,
"dm": {
"policy": "allowlist"
}
}
}
}
teamId scopes the channel to a Mattermost team. Keep groupPolicy as
mention for the first test.
Mattermost DMs are open by default. Setting dm.policy to "allowlist" with no
dm.allowFrom entries makes new DM senders receive a pairing code. Approve the
code before using the bot normally.
nanobot channels status
nanobot gateway
DM the bot account. It should return a pairing code. Approve it from a trusted local surface:
nanobot agent -m "/pairing approve ABCD-EFGH"
Then DM the bot again, or mention it in a channel where the bot has access:
@nanobot Hello from Mattermost
dm.policy as "allowlist" when you want pairing-based approval.serverUrl and token must be configured, check the
camelCase config keys.dm policy and pairing approval state.replyInThread and
includeThreadContext.