Skip to content
>_<
AI EngineeringWiki

Mattermost AI Agent

Tools Β· 6 min

A Mattermost bot brings AI to your team chat. This guide shows you how to set it up.

Why Mattermost?

  • Open Source - self-hosted
  • Full data control
  • Enterprise features
  • Integrations with everything

Bot Setup

# 1. Create Bot Account
# In Mattermost: System Console > Integrations > Bot Accounts

# 2. Get Access Token
# Save the token securely!

# 3. Add to channel
/memberadd @ai-bot

Python Bot Example

import mattermost
from mattermost import Webhook

# Connect to Mattermost
client = mattermost.Client('your-instance.com')
client.login('bot-email', 'bot-token')

# Simple AI response
@client.on_message
def handle_message(event):
    if event.text.startswith('!ai'):
        prompt = event.text[3:]
        response = ollama.chat('llama3', prompt)
        client.post_message(event.channel, response)

With n8n

  • Use Mattermost Node in n8n
  • Trigger on new messages
  • Connect to Ollama
  • Post response back

Commands

CommandDescription
!ai What is...?Ask AI anything
!summarizeSummarize thread
!helpShow help

Related articles

Was this article helpful?

Continue the learning path

The learning path puts these articles in order, and the Hub carries the building blocks we have checked in our own operations.

Why AI Engineering
  • Local and self-hosted
  • Documented and verifiable
  • From our own operations
  • Made in Austria
Not legal advice.