You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+9-5Lines changed: 9 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -237,12 +237,16 @@ echo "Summarize the last three messages" | node scripts/cli.js
237
237
238
238
### Matrix (Synapse / homeserver) bot
239
239
240
-
1. On your homeserver, create a dedicated bot user (or use an existing account). Obtain an **access token** (e.g. sign in with [Element](https://element.io) and copy the token from **Help & About → Access Token**, or use `POST /_matrix/client/v3/login` against your Synapse URL).
241
-
2. In Config → Channels, enable **Matrix bot**, set **Homeserver URL** to your client API base (e.g. `https://matrix.example.org`), and paste the **access token**. Restart the server.
240
+
1. On your homeserver, create a dedicated bot user (or use an existing account).
241
+
2. In Config → Channels, enable **Matrix bot** and set **Homeserver URL** to your client API base (e.g. `https://matrix.example.org`). Choose a **sign-in method**:
242
+
-**Access token** — paste a token (e.g. from Element **Help & About → Access Token**). Easiest if you already have a token.
243
+
-**Username and password (Client-Server login API)** — enter the bot’s Matrix user ID (local part or full `@user:server`) and password. On startup, ShadowAI calls `POST /_matrix/client/v3/login` (same API Element uses) and uses the returned access token for the session. The password is stored in `config.json` when you save; it is not returned in the config API response.
244
+
- If **Access token** is selected but the token field is empty, ShadowAI will still try **user ID + password** from config when both are set (fallback).
242
245
3. Install the optional dependency: `npm install matrix-bot-sdk`
243
-
4. Invite the bot to a room or start a direct message. The bot auto-accepts invites. Each Matrix user gets their own conversation history (unencrypted rooms work out of the box; encrypted rooms require extra crypto setup and are not covered here).
244
-
5.**Restrict who can use the bot:** set **Allowed Matrix user IDs** to comma-separated full MXIDs (e.g. `@alice:example.org`). Leave empty to allow any user in rooms where the bot is present.
245
-
6. Send `reset` or `!reset` in the room to clear that user’s stored conversation (same idea as Discord `/reset`).
246
+
4. Restart the server after saving channel settings.
247
+
5. Invite the bot to a room or start a direct message. The bot auto-accepts invites. Each Matrix user gets their own conversation history (unencrypted rooms work out of the box; encrypted rooms require extra crypto setup and are not covered here).
248
+
6.**Restrict who can use the bot:** set **Allowed Matrix user IDs** to comma-separated full MXIDs (e.g. `@alice:example.org`). Leave empty to allow any user in rooms where the bot is present.
249
+
7. Send `reset` or `!reset` in the room to clear that user’s stored conversation (same idea as Discord `/reset`).
246
250
247
251
Channel conversations (CLI, Telegram, Discord, Matrix) are stored per synthetic user id (e.g. `channel_cli`, `telegram_<userId>`, `discord_<userId>`, `matrix_<localpart_homeserver>`) and appear in the web UI chat list so you can inspect or continue them from the browser. CLEAR in the web UI, or `/reset` in Discord / `reset` in Matrix, will clear that channel conversation.
<optionvalue="password">Username and password (Client-Server login API)</option>
221
+
</select>
222
+
<spanclass="section-desc">Use a token you paste, or store the bot’s Matrix ID and password and let the server call <code>POST /_matrix/client/v3/login</code> on startup.</span>
223
+
</div>
224
+
<divclass="form-group" id="matrixAuthTokenGroup">
217
225
<label>Matrix access token</label>
218
226
<inputtype="password" id="matrixAccessToken" placeholder="Bot user access token" autocomplete="off" />
219
-
<spanclass="section-desc">Create a bot user on the server, then obtain a token (e.g. login via Element or <code>/_matrix/client/v3/login</code>).</span>
227
+
<spanclass="section-desc">From Element (Help → Access Token) or any client; used when sign-in method is Access token.</span>
228
+
</div>
229
+
<divid="matrixAuthPasswordWrap" hidden>
230
+
<divclass="form-group">
231
+
<label>Matrix user ID</label>
232
+
<inputtype="text" id="matrixUserId" placeholder="localpart or @user:server" autocomplete="off" />
233
+
<spanclass="section-desc">Bot account: local username or full MXID for this homeserver.</span>
234
+
</div>
235
+
<divclass="form-group">
236
+
<label>Matrix password</label>
237
+
<inputtype="password" id="matrixPassword" placeholder="Leave blank after saving to keep unchanged" autocomplete="new-password" />
238
+
<spanclass="section-desc">Stored in <code>config.json</code> on save. Shown empty when you reload; type again only to change it.</span>
0 commit comments