This release is a pre-release and may not be stable for production use.
@elizaos/plugin-matrix
Matrix messaging integration plugin for elizaOS agents.
Features
- Decentralized Messaging: Connect to any Matrix homeserver
- End-to-End Encryption: Optional E2EE support for secure communications
- Room Support: Join, leave, and manage Matrix rooms
- Reactions: React to messages with emoji
- Threading: Support for Matrix threads
- Direct Messages: Handle DMs and group rooms
- Typing Indicators: Send typing notifications
- Read Receipts: Mark messages as read
Installation
npm install @elizaos/plugin-matrix
Prerequisites
- Matrix Account: A Matrix account on any homeserver
- Access Token: Generate an access token for your account
Getting an Access Token
You can get an access token by:
- Element/Web Client: Settings -> Help & About -> Access Token
- API Login: Use the Matrix login API with your password
- Command Line: Use
curlor a tool likematrix-commander
Configuration
Set the following environment variables:
Required
| 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 |
Optional
| 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 |
Usage
Basic Setup
import matrixPlugin from "@elizaos/plugin-matrix";
const agent = new Agent({
plugins: [matrixPlugin],
});
Actions
MATRIX_SEND_MESSAGE
Send a message to a Matrix room.
// User: "Send a message saying 'Hello everyone!'"
// Agent will send to the current room
MATRIX_SEND_REACTION
React to a message with an emoji.
// User: "React to the last message with 👍"
// Agent will add the reaction
MATRIX_LIST_ROOMS
List all rooms the bot has joined.
// User: "What rooms are you in?"
// Agent will list all joined rooms
MATRIX_JOIN_ROOM
Join a Matrix room by ID or alias.
// User: "Join #general:matrix.org"
// Agent will join the room
Providers
matrixRoomState
Provides context about the current Matrix room:
- Room ID and name
- Member count
- Encryption status
- Whether it's a DM
matrixUserContext
Provides context about the user in the conversation:
- User ID
- Display name
- Avatar URL
Events
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 |
Message Limits
- Maximum message length: 4000 characters
- Longer messages are split automatically
Matrix ID Formats
- User ID:
@localpart:homeserver.org - Room ID:
!opaque_id:homeserver.org - Room Alias:
#human_readable:homeserver.org
Security Considerations
- Token Security: Never expose your access token
- Homeserver Trust: Only connect to trusted homeservers
- E2EE: Enable encryption for sensitive communications
- Room Verification: Verify room members when using E2EE
Troubleshooting
Connection Issues
- Verify your homeserver URL is correct
- Check that your access token is valid
- Ensure your homeserver is reachable
Sync Issues
- The initial sync may take time for accounts with many rooms
- Check homeserver rate limits
- Verify network connectivity
Encryption Issues
- Ensure E2EE is enabled on both ends
- Verify device is properly set up
- Check for key verification requirements
Multi-language Support
This plugin supports:
- TypeScript - Full implementation with matrix-js-sdk
- Python - Full implementation with matrix-nio
- Rust - Full implementation with matrix-sdk
License
MIT
Metadata
Release files for elizaos-plugin-matrix 2.0.0a5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| elizaos_plugin_matrix-2.0.0a5.tar.gz | 12.3 kB | Without provenance | Details for elizaos_plugin_matrix-2.0.0a5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| elizaos_plugin_matrix-2.0.0a5-py3-none-any.whl | Python 3 | none | any | Details for elizaos_plugin_matrix-2.0.0a5-py3-none-any.whl |
Total release size: 30.1 kB
Release files / elizaos_plugin_matrix-2.0.0a5.tar.gz
| Download URL | elizaos_plugin_matrix-2.0.0a5.tar.gz |
|---|---|
| Size | 12.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c6ddd8023bf5e8f17dfc625dfecf7d97e577a00841b4141cc5b01cdd0225e86b
|
|
BLAKE2b-256 checksum How to use checksums |
3acef844b1e3851f5d1f7236aeb062988a92c7ad8059980cb3a7dfe772301b4a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.2
|
Release files / elizaos_plugin_matrix-2.0.0a5-py3-none-any.whl
| Download URL | elizaos_plugin_matrix-2.0.0a5-py3-none-any.whl |
|---|---|
| Size | 17.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
49531ed0c0c10d4fa9006e8975a2dd50c921e723c8bfef3d06bab6b87bdde6bf
|
|
BLAKE2b-256 checksum How to use checksums |
68aa4769c5bc06f4268a43cb7541a566b946aaf386d29bdaa72f92d9cd48f33e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.2
|
Security for elizaos-plugin-matrix 2.0.0a5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.