Matrix Integration
OpenClaw on Matrix: Decentralized AI for a Decentralized World
Matrix is the open standard for decentralized, real-time communication. OpenClaw integrates seamlessly with Matrix homeservers to provide AI assistance that you truly own. Host on your own server, federate with the global Matrix network, use end-to-end encryption, and maintain complete control. No corporate gatekeepers, no platform lock-in, just open-source AI on an open protocol.
Setup Guide
Prerequisites: Matrix Homeserver
Ensure you have access to a Matrix homeserver. You can use a public homeserver, your organization's server, or deploy your own. For full control, self-hosting is recommended.
# Option 1: Use matrix.org (public)
# Register at https://app.element.io
# Option 2: Deploy Synapse (most popular homeserver)
sudo apt install matrix-synapse-py3
sudo systemctl enable matrix-synapse
sudo systemctl start matrix-synapse
# Option 3: Deploy Dendrite (newer, more efficient)
# https://matrix-org.github.io/dendrite/installation
# Option 4: Deploy Conduit (Rust, resource-efficient)
# https://conduit.rs Create Bot Account
Register a dedicated Matrix account for your OpenClaw bot. Use registration tokens or admin API depending on your homeserver configuration.
# Using Element or any Matrix client:
# 1. Register new account on your homeserver
# 2. Set display name: "OpenClaw AI"
# 3. Set avatar image
# Or using Synapse admin API:
curl -X POST "https://your-homeserver/_synapse/admin/v1/register" \
-H "Authorization: Bearer ADMIN_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"nonce": "NONCE_FROM_SERVER",
"username": "openclaw",
"password": "SECURE_PASSWORD",
"displayname": "OpenClaw AI",
"admin": false
}'
# Note the user ID: @openclaw:your-homeserver.com Install Matrix Bridge Module
Add the Matrix bridge to your OpenClaw installation. The bridge uses matrix-js-sdk for protocol communication and handles encryption, room management, and message processing.
# Using OpenClaw CLI
openclaw install matrix-bridge
# Or manual installation
cd /path/to/openclaw
npm install @openclaw/matrix-bridge
# This installs matrix-js-sdk and related packages
npm install matrix-js-sdk
# For E2EE support (recommended)
npm install @matrix-org/olm
# Verify installation
openclaw plugins list | grep matrix Configure Matrix Connection
Create your Matrix configuration file with account credentials, homeserver URL, and processing settings. Configure encryption and room behavior.
# config/matrix.yaml
matrix:
enabled: true
# Account settings
homeserver: "https://your-homeserver.com"
user_id: "@openclaw:your-homeserver.com"
access_token: "YOUR_ACCESS_TOKEN"
# Or use password login:
# password: "YOUR_PASSWORD"
# Device settings (for E2EE)
device_id: "OPENCLAW_BOT"
device_name: "OpenClaw AI Assistant"
# Storage for crypto keys (E2EE)
store_path: "./data/matrix-store"
# Encryption settings
encryption:
enabled: true
verify_devices: false # Auto-verify for bot use
backup_key: true Configure Room Behavior
Set up how OpenClaw behaves in Matrix rooms. Configure invite acceptance, mention requirements, and per-room settings.
# config/matrix-rooms.yaml
rooms:
# Auto-join settings
auto_join:
enabled: true
require_invite: true # Only join when invited
allowed_servers: [] # Empty = all servers, or list specific ones
blocked_servers: [] # Block specific servers
# Message handling
messages:
require_mention: true # Only respond when mentioned
mention_patterns:
- "@openclaw"
- "!ai"
- "OpenClaw"
respond_to_dm: true # Always respond in DMs
respond_in_thread: true # Use threads when available
# Per-room overrides
room_settings:
"!roomid:your-server.com":
require_mention: false # Respond to all messages
ai_personality: "technical_expert" Configure AI Response Behavior
Set up how OpenClaw processes messages and formats responses. Configure personality, response limits, and special handlers.
# config/matrix-ai.yaml
ai_responses:
# Response formatting
format:
max_length: 16000 # Matrix allows longer messages
use_markdown: true
use_html: true # Matrix supports HTML formatting
split_long_messages: true
# Message context
context:
history_limit: 50 # Messages to consider
include_thread: true
include_room_topic: true
# Media handling
media:
images: analyze_and_respond
files: process_and_respond
audio: transcribe_and_respond
max_file_size_mb: 100
# Reactions
reactions:
acknowledge_with: "<3" # React to show message received
success: "<2"
error: "<2"
# Commands
commands:
prefix: "!"
enabled:
- help
- settings
- clear Set Up E2EE Support
Configure end-to-end encryption support for participating in encrypted rooms. This requires additional setup for key management.
# Encryption requires persistent storage for keys
mkdir -p ./data/matrix-store
# Initialize encryption on first run
openclaw matrix init-crypto
# Cross-sign the device (if using interactive verification)
# Or configure auto-verification for bot use
# config/matrix-crypto.yaml
crypto:
# Key backup
backup:
enabled: true
passphrase: "YOUR_BACKUP_PASSPHRASE"
# Cross-signing
cross_signing:
enabled: true
auto_sign: true
# Device verification
device_verification:
auto_verify_own_devices: true
trust_on_first_use: true Test and Deploy
Start your OpenClaw Matrix bot and verify it's working correctly. Test in both unencrypted and encrypted rooms.
# Start the Matrix bridge
openclaw matrix start
# Check connection status
openclaw matrix status
# View real-time logs
openclaw logs matrix --follow
# Test from a Matrix client:
# 1. Invite @openclaw:your-server.com to a room
# 2. Send a message mentioning the bot
# 3. Verify response
# Test encryption
# 1. Create an encrypted room
# 2. Invite the bot
# 3. Send encrypted message
# 4. Verify bot can decrypt and respond What You Can Do
Private Team AI
Deploy AI assistance for your organization entirely on your infrastructure. Team members chat with OpenClaw in Matrix rooms, getting help with work while keeping all data internal. No external APIs, no cloud dependencies, complete control.
Community Moderation
Add OpenClaw to public Matrix communities for automated moderation, FAQ answers, and community engagement. The bot can help manage large communities, answer repeated questions, and maintain healthy discussions.
Federated AI Network
Create a network of OpenClaw bots across federated homeservers. Each organization hosts their own instance, but users can interact across server boundaries. Collaborative AI while maintaining data sovereignty.
Multi-Platform Hub
Use Matrix bridges to bring OpenClaw to Slack, Discord, IRC, and more. One OpenClaw instance serves users across all bridged platforms. Unified AI assistance without managing multiple integrations.
Research Collaboration
Academic and research teams can use Matrix for secure collaboration with AI assistance. Discuss papers, analyze data, organize research - all in encrypted rooms that meet institutional requirements.
Open Source Projects
Add OpenClaw to open source project Matrix rooms. Help contributors with documentation, answer questions about the codebase, assist with issue triage, and improve project accessibility.
Healthcare Communication
Healthcare organizations can use self-hosted Matrix with OpenClaw for compliant AI-assisted communication. With proper configuration, this can meet HIPAA and other healthcare privacy requirements.
Government and Defense
Highly regulated environments can deploy air-gapped Matrix networks with local AI models. Complete isolation from external networks while still providing advanced AI capabilities to users.
IoT Command Center
Use Matrix as the backbone for IoT communication with AI orchestration. OpenClaw processes commands, coordinates devices, and provides a natural language interface to complex IoT systems.
Known Limitations
- E2EE verification can be complex - new devices require key verification
- Federation adds latency - messages to other servers take longer
- Matrix protocol is complex - debugging issues requires Matrix expertise
- Homeserver resources scale with users - large deployments need careful capacity planning
- Some Matrix clients have limited E2EE support, affecting encrypted room participation
- File upload limits vary by homeserver configuration
- Rich content (polls, location sharing) has inconsistent client support
- Bot presence in rooms may not update in real-time across all clients
- Matrix Spaces support is newer and may have edge cases
- Historical messages require additional API calls to fetch, impacting context retrieval speed
- Our team can help you work around these limitations with custom configurations
Related Content
Bring OpenClaw AI Power to Your Discord Server
Deploy OpenClaw as a Discord bot for your server. Automate moderation, answer questions, manage communities, run games, and provide AI assistance to all your members with slash commands and rich embeds.
Supercharge Your Gmail with OpenClaw AI
Connect OpenClaw to Gmail for intelligent email management. Automatically summarize messages, draft responses, organize your inbox, and manage emails through natural language commands.
Connect OpenClaw to LINE Messenger
Deploy OpenClaw on LINE messenger to reach 200 million users across Japan, Taiwan, Thailand, and Indonesia. Build powerful AI chatbots with rich messaging, LIFF apps, and LINE ecosystem integration.
Deploy OpenClaw on Facebook Messenger
Deploy OpenClaw as a Facebook Messenger bot for personal or business use. Automate customer service, handle inquiries, and provide 24/7 AI assistance through the platform with 1.3 billion users.