Files
Memoh/docs/docs/channels/matrix.md
T
AlexMa233 dd13e89469 Enhance Matrix bot setup documentation (#308)
* Enhance Matrix bot setup documentation

Added instructions for obtaining an access token using the Matrix Client Login API and clarified the importance of keeping it secret. Updated details on bot capabilities and linked to the roadmap for future features.

* Add warning about access token security

Added important note about keeping the access token secret.
2026-03-29 21:26:22 +08:00

2.4 KiB

Matrix Channel Configuration

Connecting your Memoh Bot to Matrix allows it to communicate via the decentralized Matrix messaging protocol. Your bot can join rooms, respond to direct messages, and participate in group conversations on any Matrix homeserver.

Step 1: Create a Matrix Bot Account

  1. Register a new account on your Matrix homeserver (e.g., via Element or any Matrix client).
  2. Note the User ID (e.g., @mybot:matrix.org).
  3. Obtain an Access Token for the account. You can do this by:
  • Option A: Using the Matrix Client Login API
curl -X POST "https://<homeserver>/_matrix/client/v3/login" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "m.login.password",
    "identifier": {
      "type": "m.id.user",
      "user": "<username>"
    },
    "password": "<password>"
  }'
  • Option B: Extract from a client

Important

: Keep the access token secret. Anyone with this token can act as your bot account.

Step 2: Configure Memoh

  1. Go to your Bot's Platforms tab in the Memoh Web UI.
  2. Click Add Channel and select Matrix.
  3. Fill in the required fields:
Field Required Description
Homeserver URL Yes The base URL of your Matrix homeserver (e.g., https://matrix.org).
Access Token Yes The bot account's access token.
User ID Yes The bot's Matrix user ID (e.g., @mybot:matrix.org).
Sync Timeout No Long-polling timeout in seconds (default: 30).
Auto Join Invites No Automatically join rooms when invited (default: enabled).
  1. Click Save and Enable.

Step 3: Invite the Bot

  1. Open your Matrix client (Element, etc.).
  2. Invite the bot's user ID to a room, or start a direct message.
  3. If Auto Join Invites is enabled, the bot will automatically accept and join.

Features Supported

  • Message Content: Full access to text messages.
  • Rooms: Join and participate in group rooms.
  • Direct Messages: Private conversations with individual users.
  • Streaming: Responses are streamed as they are generated.
  • Markdown: Support for formatted text.
  • Media/Attachment: Bots can receive and send files or photo.
  • Check the roadmap for more features of Matrix.

Official Resources