Matrix (प्लगइन)
Matrix is an open, decentralized messaging protocol. OpenClaw connects as a Matrix user on any homeserver, so you need a Matrix account for the bot. Once it is logged in, you can DM the bot directly or invite it to rooms (Matrix “groups”). Beeper is a valid client option too, but it requires E2EE to be enabled. Status: supported via plugin (@vector-im/matrix-bot-sdk). Direct messages, rooms, threads, media, reactions, polls (send + poll-start as text), location, and E2EE (with crypto support).प्लगइन आवश्यक
Matrix एक प्लगइन के रूप में आता है और कोर इंस्टॉल के साथ बंडल नहीं होता। CLI के माध्यम से इंस्टॉल करें (npm रजिस्ट्री):सेटअप
-
Matrix प्लगइन इंस्टॉल करें:
- npm से:
openclaw plugins install @openclaw/matrix - स्थानीय चेकआउट से:
openclaw plugins install ./extensions/matrix
- npm से:
-
किसी homeserver पर Matrix खाता बनाएँ:
- होस्टिंग विकल्प देखें: https://matrix.org/ecosystem/hosting/
- या स्वयं होस्ट करें।
-
बॉट खाते के लिए एक एक्सेस टोकन प्राप्त करें:
- अपने homeserver पर Matrix लॉगिन API को
curlके साथ उपयोग करें:
matrix.example.orgको अपने homeserver URL से बदलें।- या
channels.matrix.userId+channels.matrix.passwordसेट करें: OpenClaw वही लॉगिन एंडपॉइंट कॉल करता है, एक्सेस टोकन को~/.openclaw/credentials/matrix/credentials.jsonमें संग्रहीत करता है, और अगली शुरुआत पर उसे पुनः उपयोग करता है।
- अपने homeserver पर Matrix लॉगिन API को
-
क्रेडेंशियल्स कॉन्फ़िगर करें:
- Env:
MATRIX_HOMESERVER,MATRIX_ACCESS_TOKEN(याMATRIX_USER_ID+MATRIX_PASSWORD) - या config:
channels.matrix.* - यदि दोनों सेट हों, तो config को प्राथमिकता दी जाती है।
- एक्सेस टोकन के साथ: उपयोगकर्ता ID स्वचालित रूप से
/whoamiके माध्यम से प्राप्त की जाती है। - जब सेट हो, तो
channels.matrix.userIdपूर्ण Matrix ID होना चाहिए (उदाहरण:@bot:example.org)।
- Env:
- Gateway को पुनः प्रारंभ करें (या onboarding पूरा करें)।
-
Start a DM with the bot or invite it to a room from any Matrix client
(Element, Beeper, etc.; see https://matrix.org/ecosystem/clients/). Beeper requires E2EE,
so set
channels.matrix.encryption: trueand verify the device.
एन्क्रिप्शन (E2EE)
एंड-टू-एंड एन्क्रिप्शन Rust क्रिप्टो SDK के माध्यम से समर्थित है।channels.matrix.encryption: true के साथ सक्षम करें:
- यदि क्रिप्टो मॉड्यूल लोड हो जाता है, तो एन्क्रिप्टेड कमरे स्वचालित रूप से डिक्रिप्ट हो जाते हैं।
- एन्क्रिप्टेड कमरों में भेजते समय आउटबाउंड मीडिया एन्क्रिप्ट किया जाता है।
- पहली कनेक्शन पर, OpenClaw आपकी अन्य सत्रों से डिवाइस सत्यापन का अनुरोध करता है।
- Verify the device in another Matrix client (Element, etc.) to enable key sharing.
- यदि क्रिप्टो मॉड्यूल लोड नहीं हो पाता, तो E2EE अक्षम हो जाता है और एन्क्रिप्टेड कमरे डिक्रिप्ट नहीं होंगे; OpenClaw एक चेतावनी लॉग करता है।
- यदि आपको क्रिप्टो मॉड्यूल से संबंधित त्रुटियाँ दिखें (उदाहरण के लिए,
@matrix-org/matrix-sdk-crypto-nodejs-*), तो@matrix-org/matrix-sdk-crypto-nodejsके लिए बिल्ड स्क्रिप्ट्स को अनुमति दें औरpnpm rebuild @matrix-org/matrix-sdk-crypto-nodejsचलाएँ या बाइनरी कोnode node_modules/@matrix-org/matrix-sdk-crypto-nodejs/download-lib.jsसे प्राप्त करें।
~/.openclaw/matrix/accounts/<account>/<homeserver>__<user>/<token-hash>/crypto/
(SQLite database). Sync state lives alongside it in bot-storage.json.
If the access token (device) changes, a new store is created and the bot must be
re-verified for encrypted rooms.
Device verification:
When E2EE is enabled, the bot will request verification from your other sessions on startup.
Open Element (or another client) and approve the verification request to establish trust.
Once verified, the bot can decrypt messages in encrypted rooms.
रूटिंग मॉडल
Multi-account समर्थन: प्रति-खाता credentials और वैकल्पिकname के साथ channels.matrix.accounts का उपयोग करें। साझा पैटर्न के लिए gateway/configuration देखें।
प्रत्येक खाता किसी भी homeserver पर एक अलग Matrix user के रूप में चलता है। Per-account config
top-level channels.matrix settings से inherit करता है और किसी भी option को override कर सकता है
(DM policy, groups, encryption, आदि)।
- डिफ़ॉल्ट:
channels.matrix.groupPolicy = "allowlist"(mention-आधारित)। Usechannels.defaults.groupPolicyto override the default when unset. - Env variables (
MATRIX_HOMESERVER,MATRIX_ACCESS_TOKEN, आदि) केवल default खाते पर लागू होते हैं। - Base channel settings (DM policy, group policy, mention gating, आदि) सभी खातों पर लागू होते हैं जब तक कि प्रति-खाता override न किया गया हो।
- प्रत्येक खाते को अलग agent से route करने के लिए
bindings[].match.accountIdका उपयोग करें। - Crypto state प्रति खाता + access token के अनुसार संग्रहीत होता है (प्रति खाते अलग key stores)।
रूटिंग मॉडल
requireMention: falseउस कमरे में ऑटो-रिप्लाई सक्षम करता है।groups."*"कमरों में मेंशन गेटिंग के लिए डिफ़ॉल्ट सेट कर सकता है।
प्रवेश नियंत्रण (DMs)
- डिफ़ॉल्ट:
channels.matrix.dm.policy = "pairing"। Unknown senders get a pairing code. channels.matrix.threadRepliesनियंत्रित करता है कि उत्तर थ्रेड्स में ही रहें या नहीं:openclaw pairing list matrixopenclaw pairing approve matrix <CODE>
channels.matrix.replyToModeनियंत्रित करता है कि थ्रेड में उत्तर न देने पर reply-to मेटाडेटा कैसे हो:channels.matrix.dm.allowFromaccepts full Matrix user IDs (example:@user:server). The wizard resolves display names to user IDs when directory search finds a single exact match.- Display names या केवल localparts (उदाहरण:
"Alice"या"alice") का उपयोग न करें। ये अस्पष्ट होते हैं और allowlist matching के लिए अनदेखा किए जाते हैं। पूर्ण@user:serverIDs का उपयोग करें।
क्षमताएँ
- डिफ़ॉल्ट:
channels.matrix.groupPolicy = "allowlist"(mention-आधारित)। Usechannels.defaults.groupPolicyto override the default when unset. channels.matrix.groupsके साथ कमरों को allowlist करें (रूम IDs या उपनाम; जब डायरेक्टरी खोज में एकल सटीक मिलान मिलता है तो नाम IDs में बदले जाते हैं):
requireMention: falseउस कमरे में ऑटो-रिप्लाई सक्षम करता है।groups."*"कमरों में मेंशन गेटिंग के लिए डिफ़ॉल्ट सेट कर सकता है।groupAllowFromयह सीमित करता है कि कमरों में कौन से प्रेषक बॉट को ट्रिगर कर सकते हैं (पूर्ण Matrix उपयोगकर्ता IDs)।- प्रति-कमरा
usersallowlist किसी विशिष्ट कमरे के भीतर प्रेषकों को और सीमित कर सकती है (पूर्ण Matrix उपयोगकर्ता IDs का उपयोग करें)। - configure विज़ार्ड रूम allowlists (रूम IDs, उपनाम, या नाम) के लिए पूछता है और केवल सटीक, अद्वितीय मिलान पर नामों को रिज़ॉल्व करता है।
- स्टार्टअप पर, OpenClaw allowlists में रूम/यूज़र नामों को IDs में बदलता है और मैपिंग लॉग करता है; अनसुलझी प्रविष्टियाँ allowlist मिलान के लिए अनदेखी की जाती हैं।
- आमंत्रण डिफ़ॉल्ट रूप से ऑटो-जॉइन होते हैं;
channels.matrix.autoJoinऔरchannels.matrix.autoJoinAllowlistसे नियंत्रित करें। - कोई भी कमरे अनुमति न देने के लिए,
channels.matrix.groupPolicy: "disabled"सेट करें (या खाली allowlist रखें)। - लेगेसी कुंजी:
channels.matrix.rooms(आकृतिgroupsके समान)।
Threads
- रिप्लाई थ्रेडिंग समर्थित है।
channels.matrix.threadRepliesनियंत्रित करता है कि उत्तर थ्रेड्स में ही रहें या नहीं:off,inbound(डिफ़ॉल्ट),always
channels.matrix.replyToModeनियंत्रित करता है कि थ्रेड में उत्तर न देने पर reply-to मेटाडेटा कैसे हो:off(डिफ़ॉल्ट),first,all
क्षमताएँ
| Feature | Status |
|---|---|
| Direct messages | ✅ समर्थित |
| Rooms | ✅ समर्थित |
| Threads | ✅ समर्थित |
| Media | ✅ समर्थित |
| E2EE | ✅ समर्थित (क्रिप्टो मॉड्यूल आवश्यक) |
| Reactions | ✅ समर्थित (टूल्स के माध्यम से भेजना/पढ़ना) |
| Polls | ✅ भेजना समर्थित; इनबाउंड पोल स्टार्ट्स टेक्स्ट में परिवर्तित (प्रतिक्रियाएँ/समाप्ति अनदेखी) |
| Location | ✅ समर्थित (geo URI; ऊँचाई अनदेखी) |
| Native commands | ✅ समर्थित |
समस्या-निवारण
ट्रायेज फ़्लो के लिए: /channels/troubleshooting।- लॉग इन है लेकिन कमरे के संदेश अनदेखे हो रहे हैं: कमरा
groupPolicyया रूम allowlist द्वारा ब्लॉक है। - DMs अनदेखे: जब
channels.matrix.dm.policy="pairing"हो तो प्रेषक अनुमोदन लंबित है। - एन्क्रिप्टेड कमरे विफल: क्रिप्टो समर्थन या एन्क्रिप्शन सेटिंग्स में असंगति।
विन्यास संदर्भ (Matrix)
पूर्ण विन्यास: Configuration प्रदाता विकल्प:channels.matrix.enabled: चैनल स्टार्टअप सक्षम/अक्षम करें।channels.matrix.homeserver: homeserver URL।channels.matrix.userId: Matrix उपयोगकर्ता ID (एक्सेस टोकन के साथ वैकल्पिक)।channels.matrix.accessToken: एक्सेस टोकन।channels.matrix.password: लॉगिन के लिए पासवर्ड (टोकन संग्रहीत होता है)।channels.matrix.deviceName: डिवाइस डिस्प्ले नाम।channels.matrix.encryption: E2EE सक्षम करें (डिफ़ॉल्ट: false)।channels.matrix.initialSyncLimit: प्रारंभिक सिंक सीमा।channels.matrix.threadReplies:off | inbound | always(डिफ़ॉल्ट: inbound)।channels.matrix.textChunkLimit: आउटबाउंड टेक्स्ट चंक आकार (अक्षर)।channels.matrix.chunkMode:length(डिफ़ॉल्ट) याnewlineताकि लंबाई चंकिंग से पहले खाली पंक्तियों (अनुच्छेद सीमाएँ) पर विभाजित किया जा सके।channels.matrix.dm.policy:pairing | allowlist | open | disabled(डिफ़ॉल्ट: pairing)।channels.matrix.dm.allowFrom: DM allowlist (full Matrix user IDs).openrequires"*". The wizard resolves names to IDs when possible.channels.matrix.groupPolicy:allowlist | open | disabled(डिफ़ॉल्ट: allowlist)।channels.matrix.groupAllowFrom: समूह संदेशों के लिए allowlisted प्रेषक (पूर्ण Matrix उपयोगकर्ता IDs)।channels.matrix.allowlistOnly: DMs + कमरों के लिए allowlist नियमों को बाध्य करें।channels.matrix.groups: समूह allowlist + प्रति-कमरा सेटिंग्स मैप।channels.matrix.rooms: लेगेसी समूह allowlist/विन्यास।channels.matrix.replyToMode: थ्रेड्स/टैग्स के लिए reply-to मोड।channels.matrix.mediaMaxMb: इनबाउंड/आउटबाउंड मीडिया सीमा (MB)।channels.matrix.autoJoin: आमंत्रण हैंडलिंग (always | allowlist | off, डिफ़ॉल्ट: always)।channels.matrix.autoJoinAllowlist: ऑटो-जॉइन के लिए अनुमत रूम IDs/उपनाम।channels.matrix.accounts: account ID के आधार पर multi-account configuration (प्रत्येक खाता top-level settings inherit करता है)।channels.matrix.actions: प्रति-एक्शन टूल गेटिंग (reactions/messages/pins/memberInfo/channelInfo)।