Connect OpenClaw to Matrix
Integrate OpenClaw with the Matrix protocol for decentralized, federated AI messaging with full data sovereignty.
- ✓Open Protocol — Decentralized, federated communication standard
- ✓Self-Hosted Option — Run your own homeserver for complete control
- ✓End-to-End Encryption — Secure messaging with E2EE support
- ✓Federation — Connect across different Matrix servers
- ✓Bridge Support — Connect to other platforms via bridges
Setup Steps
Create a Matrix Account for the Bot
Register a new account on your Matrix homeserver:
- • Use your self-hosted Synapse server, or
- • Register on a public homeserver like matrix.org
- • Create a dedicated account (e.g., @openclaw:yourserver.com)
- • Note the access token for authentication
Get an Access Token
Generate an access token for the bot account:
curl -X POST \
"https://yourserver.com/_matrix/client/r0/login" \
-H "Content-Type: application/json" \
-d '{"type":"m.login.password","user":"openclaw","password":"YOUR_PASSWORD"}'Or use Element's Settings → Help & About → Access Token
Configure OpenClaw
Add the Matrix configuration to your openclaw.json:
{
"channels": {
"matrix": {
"enabled": true,
"homeserverUrl": "https://matrix.yourserver.com",
"userId": "@openclaw:yourserver.com",
"accessToken": "YOUR_ACCESS_TOKEN",
"allowFrom": ["@youruser:yourserver.com"]
}
}
}Restart and Test
Restart OpenClaw and invite the bot to a room:
openclaw restart- • Create a new room or use an existing one
- • Invite the bot user to the room
- • Send a message to test the connection
For complete data sovereignty, run your own Matrix homeserver:
# Using Docker Compose with Synapse
version: '3'
services:
synapse:
image: matrixdotorg/synapse:latest
volumes:
- ./data:/data
ports:
- "8008:8008"
environment:
- SYNAPSE_SERVER_NAME=matrix.yourdomain.com
- SYNAPSE_REPORT_STATS=noPopular homeserver options: Synapse (reference), Dendrite (lightweight), Conduit (Rust)
{
"channels": {
"matrix": {
"enabled": true,
"homeserverUrl": "https://matrix.yourserver.com",
"userId": "@openclaw:yourserver.com",
"accessToken": "YOUR_ACCESS_TOKEN",
"allowFrom": ["@user1:server.com", "@user2:server.com"],
"allowRooms": ["!roomid:server.com"],
"enableE2EE": true,
"autoJoinRooms": true,
"respondToMentions": true,
"deviceDisplayName": "OpenClaw Bot"
}
}
}homeserverUrl— Your Matrix homeserver URLallowRooms— Restrict to specific room IDsenableE2EE— Enable end-to-end encryptionautoJoinRooms— Auto-accept room invites from allowed users
- ✓End-to-End Encryption — Secure E2EE room support
- ✓Federation — Works across different Matrix servers
- ✓Room & DM Support — Works in public/private rooms and DMs
- ✓File Attachments — Send and receive files and images
- ✓Reactions & Replies — Thread support and message reactions
Bot not responding in rooms?
Ensure the bot has been invited and joined the room. Check allowFrom and allowRooms settings.
E2EE messages not decrypting?
E2EE requires key backup. Verify the bot's device is verified in room settings.
Access token invalid?
Tokens can expire. Generate a new access token using the login API.
For more detailed configuration options and advanced features, visit the official documentation:
docs.openclaw.ai/channels/matrix →