Mattermost Bot
The Mattermost bot connects AIvis to self-hosted Mattermost collaboration environments. Treat it as a controlled message entry before rollout: accept requests only from approved teams, channels, or command triggers; return only knowledge and tool results allowed for the current user or channel; and keep every request auditable.
Use cases
Choose an integration method
Start with a Custom Slash Command for the smallest controlled loop: the trigger is explicit, user intent is clear, and it supports private channels and direct messages. Use an Outgoing Webhook only when you need to listen for natural-language messages in public channels.
Management Boundary
Before Configuration
- Confirm the Mattermost Server version and deployment model, and make sure the current account can open Product menu > Integrations or that a System Admin can configure it.
- Confirm the required integration features are enabled: Outgoing Webhooks, Custom Slash Commands, Personal Access Tokens, or Bot Accounts.
- Prepare an AIvis HTTPS callback URL reachable by the Mattermost server.
- Define the teams, channels, users, default Agent, knowledge scope, and tool scope the bot can serve.
- Decide whether to use an Outgoing Webhook, a Custom Slash Command, or an additional Bot Account / Personal Access Token.
- Store all tokens only in protected configuration. Do not put them in public docs, Agent instructions, tickets, screenshots, or chat messages.
Where to get configuration values
Configure an Outgoing Webhook
Use an Outgoing Webhook when the bot should listen for trigger words in public channels:
- Open Product menu > Integrations > Outgoing Webhooks.
- Select Add Outgoing Webhook, then enter a name and description.
- Choose the request content type. Prefer
application/jsonso AIvis can parse a structured request. - Select one explicit public channel, or set a clear trigger word such as
aivis. - Paste the AIvis callback URL into Callback URLs and save.
- Copy the generated Mattermost Token and paste it into the AIvis bot configuration page.
Do not leave the Outgoing Webhook channel or trigger words too broad. Mattermost documents that an empty channel field can apply trigger words across all public channels in the team, and an empty trigger-word field can respond to all messages in the selected public channel.
Configure a Slash Command
Use a custom Slash Command when users should explicitly call the bot with /aivis, or when the bot needs to work in private channels or direct messages:
- Open Product menu > Integrations > Slash Commands.
- Select Add Slash Command.
- Set the title, description, and unique trigger word, such as
aivis. The trigger word must not include/or spaces. - Set Request URL to the AIvis callback URL.
- Set the request method to
POST. - Enable autocomplete if useful, and add an argument hint such as
[question]. - Save, copy the generated token, and paste it into the AIvis bot configuration page.
Configure a Bot Account
Use a Bot Account or Personal Access Token only when AIvis needs to proactively call the Mattermost REST API to post, reply, send direct messages, or inspect channel information.
- Confirm Bot Accounts and the required Personal Access Tokens settings are enabled in the System Console.
- Create a dedicated Bot Account, such as
aivis-bot. Do not grant System Admin unless it has passed a separate security review. - Add the bot to the allowed teams and channels.
- Copy the generated bot access token and save it in protected AIvis credentials.
- Post a minimal test response from the bot in a test channel to confirm identity, channel, and permission behavior.
Configure AIvis
Open the Mattermost bot configuration page in the AIvis Admin panel and fill the fields that match the selected integration method:
After saving, confirm the bot is enabled and record the callback URL, Mattermost integration name, token owner, and operational owner.
Verification
- Ask a normal question in a test channel or direct message and review the reply.
- If using an Outgoing Webhook, test both matching and non-matching trigger words.
- If using a Slash Command, test
/aivis question, empty arguments, and invalid arguments. - Validate denial from an unauthorized channel, unauthorized user, or request without a bound Agent.
- Confirm AIvis tracing records Mattermost source, team, channel, user, trigger method, response result, and errors.
- After rotating a webhook token, command token, or bot token, save the AIvis configuration again and repeat the test.
Troubleshooting
Security and maintenance
- Use separate Mattermost integrations and tokens for production, staging, and demos.
- Do not use a System Admin personal token as the bot credential.
- Rotate Outgoing Webhook, Slash Command, and Bot Account tokens regularly and track token owners.
- Disable unused webhooks, commands, or bot accounts before disabling the AIvis-side bot.
- Revalidate denial paths and traces whenever channels, teams, owners, or access boundaries change.
Official references
- Mattermost Developers: Bot accounts
- Mattermost Developers: Personal access tokens
- Mattermost Developers: Outgoing webhooks
- Mattermost Developers: Slash commands
- Mattermost Developers: Custom slash commands
- Mattermost admin docs: Integrations configuration settings