跳到内容
接入应用Matrix

Matrix

Matrix 账户由归属服务器托管。找到服务器的 HTTPS 地址和你的 Matrix 用户 ID,例如 @alex:matrix.example.org。

以所有者身份登录 SwB。将这段提示词发给有所有者权限的智能体。

Read the setup guide at https://swb.one/docs/setup/matrix.

Help me exchange messages with an agent in Matrix. Give me https://swb.one/docs/connect if I need to connect this agent to SwB first.

Use a SwB client with owner access. Call `connect(what="matrix")`. Do each step marked "you" yourself. Give me each step marked "person" one at a time with the exact click path and links. Wait for me to say done after each step.

Ask me for the HTTPS address of my Matrix homeserver and my Matrix user ID. Ask me to create a private room with room encryption set to **Off**. Give me the path `Room Settings > Advanced > Internal Room ID` in Element. Ask me for that room ID.

Put my Matrix user ID in `owner_ids`. Put the room ID in `rooms`. Apply the YAML from `connect` to `config/switchboard.yaml`. If the file needs a manual edit, give me the YAML. Restart SwB after an edit.

Call `connect(what="matrix")` again for the private claim link. Ask me to create a separate account for the bot on that Matrix homeserver. Ask me to sign in to Element with the bot account in a separate browser profile. Ask me to keep that session signed in. Give me the path `Settings > Help & About > Advanced > Access Token`.

Ask me to enter the token only through the SwB claim link that connect returns. Keep tokens out of this chat and tool arguments.

Read the Matrix bot user ID from `setup.bot_user_id` in `matrix_status`. Ask me to return to my owner session in Matrix. Ask me to invite the bot from my owner account.

Call `connect(what="matrix")` again to check the connection. Ask me "Which agent answers here?" Use `targets` to show the choices. Save my choice for the room with `chat_main_set`, using the Matrix block name, space and room ID.

Ask me to send a short message in the room. In a group room, ask me to mention the bot. Ask me to confirm that the agent replies in the same room.

智能体会调用 connect(what="matrix") 获取连接指引。告诉它由哪个智能体在房间里回复。

房间

创建一个私密房间。创建时关闭房间加密。

在 Element 中打开 Room Settings > Advanced > Internal Room ID。把房间 ID 发给智能体。

机器人账户

在你的 Matrix 归属服务器上为机器人单独创建一个账户。用单独的浏览器配置打开 Element。用机器人账户登录。保持登录状态。

打开 Settings > Help & About > Advanced > Access Token。复制访问令牌。SwB 用令牌访问机器人账户。

打开智能体发来的 SwB 认领链接。在页面中粘贴访问令牌。

测试房间

回到 Matrix 中所有者的会话。用所有者账户邀请机器人。

发送一条简短的文字消息。在群聊中提及机器人。查看同一房间里的智能体回复。

Matrix 模块