plugins/plugin-matrix/README.md
Matrix messaging integration plugin for ElizaOS agents.
npm install @elizaos/plugin-matrix
You can get an access token by:
curl or a tool like matrix-commanderSet the following environment variables:
| Variable | Description |
|---|---|
MATRIX_HOMESERVER | Homeserver URL (e.g., https://matrix.org) |
MATRIX_USER_ID | Full Matrix user ID (@user:homeserver.org) |
MATRIX_ACCESS_TOKEN | Access token for authentication |
| Variable | Description | Default |
|---|---|---|
MATRIX_DEVICE_ID | Device ID for this session | Auto-generated |
MATRIX_ROOMS | Comma-separated room IDs/aliases to auto-join | - |
MATRIX_AUTO_JOIN | Auto-accept room invites | false |
MATRIX_ENCRYPTION | Enable E2EE support | false |
MATRIX_REQUIRE_MENTION | Only respond when mentioned in rooms | false |
import matrixPlugin from "@elizaos/plugin-matrix";
const agent = new Agent({
plugins: [matrixPlugin],
});
Matrix messaging is exposed through the canonical message connector actions.
Use source: "matrix" when a request needs to target Matrix explicitly.
| Primary action | Operation | Description |
|---|---|---|
MESSAGE | send | Send a message to a Matrix room, channel, thread, or DM |
MESSAGE | react | React to a Matrix message with an emoji |
MESSAGE | list_channels | List joined Matrix rooms |
MESSAGE | join | Join a Matrix room by ID or alias |
MESSAGE | leave | Leave a Matrix room |
Provides context about the current Matrix room:
Provides context about the user in the conversation:
The plugin emits the following events:
| Event | Description |
|---|---|
MATRIX_MESSAGE_RECEIVED | A message was received |
MATRIX_MESSAGE_SENT | A message was sent |
MATRIX_ROOM_JOINED | Joined a room |
MATRIX_ROOM_LEFT | Left a room |
MATRIX_INVITE_RECEIVED | Received a room invite |
MATRIX_REACTION_RECEIVED | Received a reaction |
MATRIX_SYNC_COMPLETE | Initial sync completed |
MATRIX_CONNECTION_READY | Client connected |
MATRIX_CONNECTION_LOST | Connection lost |
@localpart:homeserver.org!opaque_id:homeserver.org#human_readable:homeserver.orgMIT