Chat Integration
OpenClaw + Matrix
Connect to the decentralized Matrix network. Works with Element and all Matrix clients.
Category
Chat
Setup Time
~5 minutes
What you can do
- Decentralized messaging
- Works with any Matrix client
- Group rooms & spaces
- End-to-end encryption support
Setup Guide
Prerequisites
- OpenClaw running (see our deployment guide)
- A Matrix account (on any homeserver, e.g., matrix.org)
- An access token for your bot account
Step 1: Create a Matrix Account
If you don't have a Matrix account:
- Visit app.element.io or your preferred Matrix client
- Click Create Account
- Choose a homeserver (matrix.org is the default)
- Complete registration
Pro tip: Create a dedicated account for your OpenClaw bot rather than using your personal account.
Step 2: Get Your Access Token
- Log in to Element (or your Matrix client)
- Go to Settings → Help & About
- Scroll to Advanced → click Access Token
- Copy the token
Alternatively, use curl to get a token:
curl -XPOST "https://matrix.org/_matrix/client/r0/login" -d '{"type":"m.login.password", "user":"your-username", "password":"your-password"}'
Configuration
Add the Matrix channel to your OpenClaw config:
# In your openclaw config
channels:
matrix:
enabled: true
homeserver: "https://matrix.org"
access_token: "YOUR_ACCESS_TOKEN"
device_id: "OPENCLAW_BOT"
Or via environment variables in your docker-compose.yml:
environment:
- MATRIX_ENABLED=true
- MATRIX_HOMESERVER=https://matrix.org
- MATRIX_ACCESS_TOKEN=YOUR_ACCESS_TOKEN
- MATRIX_DEVICE_ID=OPENCLAW_BOT
Step 3: Restart OpenClaw
docker compose restart openclaw
Verification
- Open Element or your Matrix client
- Start a direct message with your bot account
- Send a message — OpenClaw should respond
Check logs for connection status:
docker compose logs -f openclaw | grep -i matrix
Common Issues
Access token invalid: Tokens can expire or be revoked. Generate a new token and update your config.
Homeserver URL: Make sure to use the correct homeserver URL (e.g., https://matrix.org, not matrix.org). Some homeservers use different URLs.
Rate limiting: Matrix homeservers may rate-limit messages. If you see 429 errors, reduce message frequency or contact your homeserver admin.
Encryption: Encrypted rooms (E2EE) require additional setup. For testing, use unencrypted rooms first.
Frequently Asked Questions
Does OpenClaw work with Matrix?
Yes — OpenClaw has built-in Matrix integration using the Matrix Client-Server API. It's rated as Easy difficulty to set up and takes about 5 minutes.
Is the Matrix integration free?
Yes. The Matrix integration is free and included with OpenClaw. Matrix is open-source and decentralized, so there are no API costs. You only pay for hosting (~$7/mo) and AI API usage (~$3-10/mo).
How do I set up Matrix with OpenClaw?
Create a Matrix account, get your access token from Element settings, add your homeserver URL and token to your OpenClaw config, and restart. The bot will appear online within seconds.
Do I need to run my own Matrix server?
No. You can use any public homeserver like matrix.org. However, you can also run your own Synapse or Dendrite server if you want full control over your data.
Can OpenClaw work with Element and other Matrix clients?
Yes. OpenClaw works with all Matrix clients including Element, FluffyChat, Fractal, Nheko, and any other client that supports the Matrix protocol.
Ready to set up Matrix?
Follow our free guide to deploy OpenClaw and connect Matrix in minutes.
Official docs: https://docs.openclaw.ai/channels