Skip to main content

Bots & Integrations

Extend Matrix with bots for moderation, automation, notifications, and more.

Types of Bots

Simple Bots

Basic bots that respond to commands:

  • Echo bots, reminder bots
  • Info bots, help bots
  • Simple automation

Appservice Bots

More powerful bots using the Application Service API:

  • Can create users/rooms
  • Higher rate limits
  • Background processing

Moderation Bots

Keep communities safe:

  • Mjolnir - Ban lists, spam protection
  • Draupnir - Mjolnir fork with improvements

Integration Bots

Connect external services:

  • Hookshot - GitHub, GitLab, JIRA
  • Maubot - Plugin-based bot system
FrameworkLanguageComplexityBest For
MaubotPythonMediumPlugin ecosystem
matrix-bot-sdkTypeScriptLowQuick bots
mautrixPythonLowSimple bots
matrix-nioPythonLowAsync bots
matrix-rust-sdkRustMediumPerformance

Quick Start: Simple Bot

Using matrix-nio (Python):

from nio import AsyncClient, RoomMessageText

async def message_callback(room, event):
if event.body.startswith("!hello"):
await client.room_send(
room.room_id,
"m.room.message",
{"msgtype": "m.text", "body": "Hello, World!"}
)

client = AsyncClient("https://matrix.example.com", "@bot:example.com")
await client.login("password")
client.add_event_callback(message_callback, RoomMessageText)
await client.sync_forever()

Integration Services

Hookshot

Connect Matrix to development tools:

  • GitHub: Issues, PRs, commits
  • GitLab: Issues, MRs, pipelines
  • JIRA: Issues, projects
  • Generic webhooks
  • RSS feeds

Dimension

Integration manager for Matrix:

  • Widget management
  • Sticker packs
  • Bot configuration
  • Bridge management

NEB (Legacy)

Older integration bot:

  • RSS feeds
  • Service notifications
  • Being replaced by Hookshot

Hosted Bot Services

ServiceBots IncludedNotes
t2bot.ioManyFree, public
Element EMSEnterpriseManaged
etke.ccVariousManaged hosting

t2bot.io Public Bots

Free bots anyone can use:

  • @echo:t2bot.io - Echo bot
  • @rss:t2bot.io - RSS feeds
  • @reminder:t2bot.io - Reminders
  • @giphy:t2bot.io - GIF search

Invite to any room to use.

Bot Security

Best Practices

  1. Minimal permissions - Only request needed power levels
  2. Validate input - Sanitize all user input
  3. Rate limiting - Prevent abuse
  4. Audit logging - Track bot actions
  5. Secure tokens - Never expose access tokens

Power Levels for Bots

PurposeSuggested Level
Read-only bot0 (default)
Posting bot0 (default)
Moderation bot50+
Admin bot100

Building vs Using

Use Existing Bots When

  • Standard functionality needed
  • Quick deployment required
  • Don't want to maintain code

Build Custom Bots When

  • Unique requirements
  • Integration with internal systems
  • Learning/experimentation

Getting Started

  1. Maubot - Most versatile, plugin-based
  2. Mjolnir - Essential for moderation
  3. Hookshot - GitHub/GitLab integration
  4. Building Bots - Create your own

Continue: Maubot | Mjolnir | Hookshot