# Matrix Integrations Setup Guide This guide covers setup for all Matrix integrations in your homelab. ## Quick Start 1. **Start all services:** ```bash cd /home/eduardo_figueroa/homelab/compose/services/matrix docker compose up -d ``` 2. **Check service health:** ```bash 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: 1. **Access the UI:** - Navigate to https://admin.matrix.fig.systems - Enter homeserver URL: `https://matrix.fig.systems` 2. **Login with your admin account:** - Use your Matrix credentials (@username:fig.systems) - Must be a server admin (see below to grant admin) 3. **Grant admin privileges to a user:** ```bash docker compose exec synapse register_new_matrix_user \ -u \ -p \ -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 `.env` as `MATRIX_REGISTRATION_ADMIN_SECRET`) ### Creating Registration Tokens: **Via Web UI:** 1. Go to https://reg.matrix.fig.systems/admin 2. Enter the admin secret above 3. Click "Create Token" 4. 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 5. Copy the token and share with users **Registration URL format:** ``` https://reg.matrix.fig.systems?token= ``` ### Creating Tokens via API: ```bash # 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/ \ -H "Authorization: Bearer 4a385519f20e015faf06996f12532236aa02d15511ea48bf1abec32e21d40188" \ -H "Content-Type: application/json" \ -d '{"disabled": true}' ``` ### User Registration Process: 1. Admin creates token via web UI or API 2. Admin shares URL: `https://reg.matrix.fig.systems?token=abc123` 3. User opens URL and fills in: - Username - Password - Email (if required) 4. 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: 1. **Generate initial config:** ```bash docker compose run --rm maubot ``` 2. **Access the management UI:** - URL: https://maubot.fig.systems - Default credentials are in `/mnt/media/matrix/maubot/config.yaml` 3. **Login and change password:** - First login with default credentials - Go to Settings → Change password ### Creating a Bot User: 1. **Register a bot user on your homeserver:** ```bash docker compose exec synapse register_new_matrix_user \ -u bot \ -p \ -c /data/homeserver.yaml \ http://localhost:8008 ``` 2. **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 3. **Get access token:** ```bash curl -X POST https://matrix.fig.systems/_matrix/client/r0/login \ -H "Content-Type: application/json" \ -d '{ "type": "m.login.password", "user": "bot", "password": "" }' ``` Copy the `access_token` from the response. ### Installing Plugins: **Popular plugins:** 1. **Giphy** - `/giphy ` command - Download: https://github.com/TomCasavant/GiphyMaubot - Upload .mbp file in Maubot UI 2. **Tenor** - `/tenor ` GIF search - Download: https://github.com/williamkray/maubot-tenor 3. **Reminder** - `/remind