Updated service configurations, added new services, removed deprecated ones, and improved gitignore patterns for better repository hygiene. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
15 KiB
Matrix Integrations Setup Guide
This guide covers setup for all Matrix integrations in your homelab.
Quick Start
-
Start all services:
cd /home/eduardo_figueroa/homelab/compose/services/matrix docker compose up -d -
Check service health:
docker compose ps docker compose logs -f
Services Overview
| Service | URL | Purpose |
|---|---|---|
| Synapse | https://matrix.fig.systems | Matrix homeserver |
| Element | https://chat.fig.systems | Web client |
| Synapse Admin | https://admin.matrix.fig.systems | User/room management |
| Maubot | https://maubot.fig.systems | Bot management |
| Matrix Registration | https://reg.matrix.fig.systems | Token-based registration |
| Hookshot | https://hookshot.fig.systems | GitHub/GitLab webhooks |
1. Synapse Admin
Purpose: Web UI for managing users, rooms, and server settings.
Setup:
-
Access the UI:
- Navigate to https://admin.matrix.fig.systems
- Enter homeserver URL:
https://matrix.fig.systems
-
Login with your admin account:
- Use your Matrix credentials (@username:fig.systems)
- Must be a server admin (see below to grant admin)
-
Grant admin privileges to a user:
docker compose exec synapse register_new_matrix_user \ -u <username> \ -p <password> \ -a \ -c /data/homeserver.yaml \ http://localhost:8008
Features:
- View and manage all users
- Deactivate accounts
- Manage rooms (delete, view members)
- View server statistics
- Media management
2. Matrix Registration (Token-Based Registration)
Purpose: Control who can register with invite tokens.
Admin Access:
Admin credentials:
- URL: https://reg.matrix.fig.systems/admin
- Secret:
4a385519f20e015faf06996f12532236aa02d15511ea48bf1abec32e21d40188(Also in.envasMATRIX_REGISTRATION_ADMIN_SECRET)
Creating Registration Tokens:
Via Web UI:
- Go to https://reg.matrix.fig.systems/admin
- Enter the admin secret above
- Click "Create Token"
- Configure options:
- One-time use: Token works only once
- Multi-use: Token can be used multiple times
- Expiration date: Token expires after this date
- Disable email: Skip email verification for this token
- Copy the token and share with users
Registration URL format:
https://reg.matrix.fig.systems?token=<your_token_here>
Creating Tokens via API:
# Create a one-time token
curl -X POST https://reg.matrix.fig.systems/api/token \
-H "Authorization: Bearer 4a385519f20e015faf06996f12532236aa02d15511ea48bf1abec32e21d40188" \
-H "Content-Type: application/json" \
-d '{
"ex_date": "2026-12-31",
"one_time": true,
"disable_email": false
}'
# Create a multi-use token (for family/friends)
curl -X POST https://reg.matrix.fig.systems/api/token \
-H "Authorization: Bearer 4a385519f20e015faf06996f12532236aa02d15511ea48bf1abec32e21d40188" \
-H "Content-Type: application/json" \
-d '{
"ex_date": "2026-12-31",
"one_time": false,
"max_usage": 10,
"disable_email": true
}'
# List all tokens
curl https://reg.matrix.fig.systems/api/tokens \
-H "Authorization: Bearer 4a385519f20e015faf06996f12532236aa02d15511ea48bf1abec32e21d40188"
# Disable a token
curl -X PUT https://reg.matrix.fig.systems/api/token/<token_name> \
-H "Authorization: Bearer 4a385519f20e015faf06996f12532236aa02d15511ea48bf1abec32e21d40188" \
-H "Content-Type: application/json" \
-d '{"disabled": true}'
User Registration Process:
- Admin creates token via web UI or API
- Admin shares URL:
https://reg.matrix.fig.systems?token=abc123 - User opens URL and fills in:
- Username
- Password
- Email (if required)
- Account is created on your Matrix server
Benefits:
- Control who can register
- Track which tokens were used
- Bypass email verification per-token
- Prevent spam/abuse
- Invite-only registration system
3. Maubot (Bot Framework)
Purpose: Modular bot system for GIFs, reminders, RSS, and custom commands.
Initial Setup:
-
Generate initial config:
docker compose run --rm maubot -
Access the management UI:
- URL: https://maubot.fig.systems
- Default credentials are in
/mnt/media/matrix/maubot/config.yaml
-
Login and change password:
- First login with default credentials
- Go to Settings → Change password
Creating a Bot User:
-
Register a bot user on your homeserver:
docker compose exec synapse register_new_matrix_user \ -u bot \ -p <bot_password> \ -c /data/homeserver.yaml \ http://localhost:8008 -
Add bot client in Maubot UI:
- Go to https://maubot.fig.systems
- Click "Clients" → "+"
- Enter:
- User ID: @bot:fig.systems
- Access Token: (get from login)
- Homeserver: https://matrix.fig.systems
-
Get access token:
curl -X POST https://matrix.fig.systems/_matrix/client/r0/login \ -H "Content-Type: application/json" \ -d '{ "type": "m.login.password", "user": "bot", "password": "<bot_password>" }'Copy the
access_tokenfrom the response.
Installing Plugins:
Popular plugins:
-
Giphy -
/giphy <search>command- Download: https://github.com/TomCasavant/GiphyMaubot
- Upload .mbp file in Maubot UI
-
Tenor -
/tenor <search>GIF search -
Reminder -
/remind <time> <message>- Download: https://github.com/maubot/reminder
-
RSS - RSS feed notifications
- Download: https://github.com/maubot/rss
-
Reactions - Emoji reactions and karma
- Download: https://github.com/maubot/reactbot
-
Media - Download media from URLs
- Download: https://github.com/maubot/media
Installation steps:
- Download plugin .mbp file
- Go to Maubot UI → Plugins → Upload
- Create instance: Instances → + → Select plugin and client
- Configure and enable
4. Telegram Bridge (mautrix-telegram)
Purpose: Bridge Telegram chats and DMs to Matrix.
Setup:
-
Get Telegram API credentials:
- Go to https://my.telegram.org/apps
- Log in with your phone number
- Create an app
- Copy
api_idandapi_hash
-
Generate config:
docker compose run --rm mautrix-telegram -
Edit config:
nano /mnt/media/matrix/bridges/telegram/config.yamlKey settings:
homeserver: address: http://synapse:8008 domain: fig.systems appservice: address: http://mautrix-telegram:29317 hostname: 0.0.0.0 port: 29317 database: sqlite:///data/mautrix-telegram.db bridge: permissions: '@yourusername:fig.systems': admin 'fig.systems': user telegram: api_id: YOUR_API_ID api_hash: YOUR_API_HASH -
Start the bridge:
docker compose up -d mautrix-telegram -
Restart Synapse (to load the registration file):
docker compose restart synapse
Using the Bridge:
-
Start chat with bridge bot:
- In Element, start a DM with
@telegrambot:fig.systems - Send:
login - Enter your Telegram phone number
- Enter the code sent to Telegram
- In Element, start a DM with
-
Bridge a chat:
- Create or open a Matrix room
- Invite
@telegrambot:fig.systems - Send:
!tg bridge <telegram_chat_id> - Or use
!tg search <query>to find chats
-
Useful commands:
!tg help- Show all commands!tg pm- Bridge personal chats!tg search <query>- Find Telegram chats!tg sync- Sync members/messages!tg unbridge- Remove bridge
5. WhatsApp Bridge (mautrix-whatsapp)
Purpose: Bridge WhatsApp chats to Matrix.
Setup:
-
Generate config:
docker compose run --rm mautrix-whatsapp -
Edit config:
nano /mnt/media/matrix/bridges/whatsapp/config.yamlUpdate:
homeserver: address: http://synapse:8008 domain: fig.systems bridge: permissions: '@yourusername:fig.systems': admin 'fig.systems': user -
Start and restart:
docker compose up -d mautrix-whatsapp docker compose restart synapse
Using the Bridge:
-
Start chat with bot:
- DM
@whatsappbot:fig.systemsin Element - Send:
login
- DM
-
Scan QR code:
- Bridge will send a QR code
- Open WhatsApp on your phone
- Go to Settings → Linked Devices → Link a Device
- Scan the QR code
-
Chats are auto-bridged:
- Existing WhatsApp chats appear as Matrix rooms
- New WhatsApp messages create rooms automatically
6. Discord Bridge (mautrix-discord)
Purpose: Bridge Discord servers and DMs to Matrix.
Setup:
-
Generate config:
docker compose run --rm mautrix-discord -
Create Discord bot:
- Go to https://discord.com/developers/applications
- Create New Application
- Go to Bot → Add Bot
- Copy the Bot Token
- Enable these intents:
- Server Members Intent
- Message Content Intent
-
Edit config:
nano /mnt/media/matrix/bridges/discord/config.yamlAdd your bot token:
bridge: bot_token: YOUR_DISCORD_BOT_TOKEN permissions: '@yourusername:fig.systems': admin 'fig.systems': user -
Start and restart:
docker compose up -d mautrix-discord docker compose restart synapse
Using the Bridge:
-
Invite bot to Discord server:
- Get OAuth URL from bridge bot in Matrix
- Visit URL and authorize bot for your Discord server
-
Bridge channels:
- Create Matrix room
- Invite
@discordbot:fig.systems - Follow bridging instructions from bot
7. Google Chat Bridge (mautrix-googlechat)
Purpose: Bridge Google Chat/Hangouts to Matrix.
Setup:
Similar to other mautrix bridges:
- Generate config:
docker compose run --rm mautrix-googlechat - Edit
/mnt/media/matrix/bridges/googlechat/config.yaml - Start:
docker compose up -d mautrix-googlechat - Restart Synapse:
docker compose restart synapse - Login via bridge bot:
@googlechatbot:fig.systems
8. Mjolnir (Moderation Bot)
Purpose: Advanced moderation, ban lists, anti-spam protection.
Setup:
-
Create bot user:
docker compose exec synapse register_new_matrix_user \ -u mjolnir \ -p <password> \ -c /data/homeserver.yaml \ http://localhost:8008 -
Create management room:
- In Element, create a private room
- Invite
@mjolnir:fig.systems - Make the bot admin
-
Generate config:
docker compose run --rm mjolnir -
Edit config:
nano /mnt/media/matrix/bridges/mjolnir/config.yamlConfigure:
homeserver: https://matrix.fig.systems accessToken: <get_from_login> managementRoom: "!roomid:fig.systems" -
Get access token:
curl -X POST https://matrix.fig.systems/_matrix/client/r0/login \ -H "Content-Type: application/json" \ -d '{ "type": "m.login.password", "user": "mjolnir", "password": "<password>" }' -
Start bot:
docker compose up -d mjolnir
Using Mjolnir:
-
Protect rooms:
- Invite Mjolnir to rooms you want to moderate
- In management room, send:
!mjolnir rooms add <room_id>
-
Subscribe to ban lists:
!mjolnir list subscribe <list_room_id>
-
Ban users:
!mjolnir ban @user:server.com
-
Commands:
!mjolnir help- Show all commands!mjolnir status- Bot status!mjolnir rooms- Protected rooms
9. Matrix Hookshot (GitHub/GitLab Integration)
Purpose: Receive webhooks from GitHub, GitLab, Jira in Matrix rooms.
Setup:
-
Generate config:
docker compose run --rm hookshot -
Edit config:
nano /mnt/media/matrix/hookshot/config.yamlKey settings:
bridge: domain: fig.systems url: https://matrix.fig.systems mediaUrl: https://matrix.fig.systems port: 9993 bindAddress: 0.0.0.0 listeners: - port: 9000 bindAddress: 0.0.0.0 resources: - webhooks github: webhook: secret: <random_secret> gitlab: webhook: secret: <random_secret> -
Start service:
docker compose up -d hookshot docker compose restart synapse
Using Hookshot:
For GitHub:
- In Matrix room, invite
@hookshot:fig.systems - Send:
!github repo owner/repo - Bot will provide webhook URL
- Add webhook in GitHub repo settings
- Set webhook URL:
https://hookshot.fig.systems/webhooks/github - Add secret from config
For GitLab: Similar process with GitLab webhooks.
Features:
- Issue notifications
- PR/MR updates
- Commit messages
- CI/CD status
- Custom filters
Troubleshooting
Service won't start:
# Check logs
docker compose logs <service_name>
# Check if config exists
ls -la /mnt/media/matrix/<service>/
# Regenerate config
docker compose run --rm <service_name>
Bridge not connecting:
-
Check registration file exists:
ls -la /mnt/media/matrix/bridges/<bridge>/registration.yaml -
Check Synapse can read it:
docker compose exec synapse cat /data/bridges/<bridge>/registration.yaml -
Restart Synapse:
docker compose restart synapse
Can't login to admin interfaces:
- Synapse Admin: Use Matrix account credentials
- Maubot: Check
/mnt/media/matrix/maubot/config.yamlfor password - Matrix Registration: Use
MATRIX_REGISTRATION_ADMIN_SECRETfrom.env
Ports already in use:
Check what's using the port:
sudo lsof -i :<port_number>
Permission issues:
Fix ownership:
sudo chown -R 1000:1000 /mnt/media/matrix/
Useful Commands
# View all service logs
docker compose logs -f
# Restart all services
docker compose restart
# Update all services
docker compose pull
docker compose up -d
# Check service status
docker compose ps
# Create admin user
docker compose exec synapse register_new_matrix_user \
-u <username> -p <password> -a -c /data/homeserver.yaml http://localhost:8008
# Backup database
docker compose exec postgres pg_dump -U synapse synapse > backup.sql
# Restore database
cat backup.sql | docker compose exec -T postgres psql -U synapse synapse
Next Steps
- Set up Telegram bridge - Most useful for Telegram users
- Create registration tokens - Invite friends/family
- Install Maubot plugins - Add GIF search and other features
- Configure Mjolnir - Set up moderation
- Add GitHub webhooks - Get repo notifications in Matrix