The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(mattermost): stop sending setup to a profile dialog that has no user id
xxxigm4e89a6d585bd
diff --git a/hermes_cli/gateway_setup_wizard.py b/hermes_cli/gateway_setup_wizard.pyindex b4940a98679..8214df6fb1a 100644--- a/hermes_cli/gateway_setup_wizard.py+++ b/hermes_cli/gateway_setup_wizard.py@@ -26,8 +26,11 @@ _PLATFORMS = [" (System Console → Integrations → Bot Accounts must be enabled)","2. Give it a username (e.g. hermes) and copy the bot token","3. Works with any self-hosted Mattermost instance — enter your server URL",- "4. To find your user ID: click your avatar (top-left) → Profile",- " Your user ID is displayed there — click it to copy.",+ "4. The profile dialog does not show your user ID.",+ " System Console → User Management → Users → open your user.",+ " The ID is on that User Configuration page.",+ " Or GET /api/v4/users/username/<your-username> and copy id.",+ " /api/v4/users/me with the bot token is the bot's id, not yours."," ⚠ This is NOT your username — it's a 26-character alphanumeric ID.","5. To get a channel ID: click the channel name → View Info → copy the ID",],@@ -37,7 +40,8 @@ _PLATFORMS = [{"name": "MATTERMOST_TOKEN", "prompt": "Bot token", "password": True,"help": "Paste the bot token from step 2 above."},{"name": "MATTERMOST_ALLOWED_USERS", "prompt": "Allowed user IDs (comma-separated)",- "password": False, "is_allowlist": True, "help": "Your Mattermost user ID from step 4 above."},+ "password": False, "is_allowlist": True,+ "help": "Your user ID from the System Console user page, or from GET /api/v4/users/username/<you>."},{"name": "MATTERMOST_HOME_CHANNEL","prompt": "Home channel ID (for cron/notification delivery, or empty to set later with /set-home)","password": False, "help": "Channel ID where Hermes delivers cron results and notifications."},diff --git a/plugins/platforms/mattermost/adapter.py b/plugins/platforms/mattermost/adapter.pyindex 253d65dd6f8..50459ae29de 100644--- a/plugins/platforms/mattermost/adapter.py+++ b/plugins/platforms/mattermost/adapter.py@@ -676,8 +676,11 @@ def interactive_setup() -> None:save_env_value("MATTERMOST_TOKEN", token)print_success("Mattermost token saved")print()- info("🔒 Security: Restrict who can use your bot", " To find your user ID: click your avatar → Profile",- " or use the API: GET /api/v4/users/me")+ info("🔒 Security: Restrict who can use your bot",+ " The profile dialog does not show your user ID.",+ " System Console → User Management → Users → open your user,",+ " or GET /api/v4/users/username/<your-username>.",+ " /api/v4/users/me with the bot token is the bot's id, not yours.")print()allowed_users = prompt("Allowed user IDs (comma-separated, leave empty for open access)")if allowed_users:diff --git a/website/docs/user-guide/messaging/mattermost.md b/website/docs/user-guide/messaging/mattermost.mdindex 5d86dc71c49..e64e53a8ef6 100644--- a/website/docs/user-guide/messaging/mattermost.md+++ b/website/docs/user-guide/messaging/mattermost.md@@ -100,10 +100,21 @@ For DMs, simply open a direct message with the bot — it will be able to respon## Step 4: Find Your Mattermost User ID-Hermes Agent uses your Mattermost User ID to control who can interact with the bot. To find it:+Hermes Agent uses your Mattermost User ID to control who can interact with the bot. The profile dialog (avatar → Profile) does not show it.-1. Click your **avatar** (top-left corner) → **Profile**.-2. Your User ID is displayed in the profile dialog — click it to copy.+Mattermost documents the ID in three places. See [Identify a user's ID](https://docs.mattermost.com/administration-guide/configure/user-management-configuration-settings.html#identify-a-users-id):++1. **System Console** → **User Management** → **Users** → open your user. The ID is on the User Configuration page. This needs a system admin.+2. **API**, with the bot token, looking up your username. The `id` field is yours, not the bot's:++```bash+curl -s -H "Authorization: Bearer YOUR_BOT_TOKEN" \+ https://your-mattermost-server/api/v4/users/username/YOUR_USERNAME+```++`GET /api/v4/users/me` with that same bot token returns the **bot's** id. `/users/me` is your id only when the token is a personal access token for your own account.++3. **mmctl**: `mmctl user list` prints each user id.Your User ID is a 26-character alphanumeric string like `3uo8dkh1p7g1mfk49ear5fzs5c`.@@ -111,13 +122,6 @@ Your User ID is a 26-character alphanumeric string like `3uo8dkh1p7g1mfk49ear5fzYour User ID is **not** your username. The username is what appears after `@` (e.g., `@alice`). The User ID is a long alphanumeric identifier that Mattermost uses internally.:::-**Alternative**: You can also get your User ID via the API:--```bash-curl -H "Authorization: Bearer YOUR_TOKEN" \- https://your-mattermost-server/api/v4/users/me | jq .id-```-:::tipTo get a **Channel ID**: click the channel name → **View Info**. The Channel ID is shown in the info panel. You'll need this if you want to set a home channel manually.:::diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/user-guide/messaging/mattermost.md b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/user-guide/messaging/mattermost.mdindex 09092a8a1ee..3eb1d1ad317 100644--- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/user-guide/messaging/mattermost.md+++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/user-guide/messaging/mattermost.md@@ -100,10 +100,21 @@ group_sessions_per_user: false## 第四步:查找你的 Mattermost 用户 ID-Hermes Agent 使用你的 Mattermost 用户 ID 来控制谁可以与机器人交互。查找方式:+Hermes Agent 使用你的 Mattermost 用户 ID 来控制谁可以与机器人交互。个人资料对话框(头像 → 个人资料)里没有这个 ID。-1. 点击左上角的**头像** → **个人资料**。-2. 用户 ID 显示在个人资料对话框中——点击即可复制。+Mattermost 把 ID 记在三处。见 [Identify a user's ID](https://docs.mattermost.com/administration-guide/configure/user-management-configuration-settings.html#identify-a-users-id):++1. **System Console** → **User Management** → **Users** → 打开你自己的用户。ID 在 User Configuration 页面上。这需要系统管理员。+2. **API**:用 bot token 按用户名查询。返回里的 `id` 是你的,不是 bot 的:++```bash+curl -s -H "Authorization: Bearer YOUR_BOT_TOKEN" \+ https://your-mattermost-server/api/v4/users/username/YOUR_USERNAME+```++用同一个 bot token 调用 `GET /api/v4/users/me` 得到的是 **bot** 的 id。只有当你用的是自己账号的 personal access token 时,`/users/me` 才是你的 id。++3. **mmctl**:`mmctl user list` 会列出每个用户的 id。你的用户 ID 是一个 26 位字母数字字符串,例如 `3uo8dkh1p7g1mfk49ear5fzs5c`。@@ -111,13 +122,6 @@ Hermes Agent 使用你的 Mattermost 用户 ID 来控制谁可以与机器人交你的用户 ID **不是**你的用户名。用户名是 `@` 后面显示的内容(例如 `@alice`)。用户 ID 是 Mattermost 内部使用的长字母数字标识符。:::-**替代方法**:你也可以通过 API 获取用户 ID:--```bash-curl -H "Authorization: Bearer YOUR_TOKEN" \- https://your-mattermost-server/api/v4/users/me | jq .id-```-:::tip要获取**频道 ID**:点击频道名称 → **查看信息**。频道 ID 显示在信息面板中。如果你想手动设置主频道,需要用到它。:::