Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions docs/guides/solution/openclaw.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,13 @@ sidebar_position: 8

# 如何接入OpenClaw

本文面向使用 OpenIM 的用户,说明如何通过 OpenClaw Gateway 接入 OpenIM,并完成“发送第一条消息”的验证。
本文面向使用 OpenIMSDK 的用户,说明如何通过 OpenClaw Gateway 接入 OpenIMServer,并完成“发送第一条消息”的验证。

## 1. 前置条件

- 你已部署并启动 OpenClaw Gateway,并能在运行 Gateway 的机器上执行 `openclaw` 命令。
- 你已从管理员/运维/业务系统获取以下 OpenIM 连接信息:
- `userID`:OpenClaw 在 OpenIM 中使用的用户 ID
- `wsAddr`:OpenIM SDK WebSocket 地址(例如:`ws://127.0.0.1:10001`)
- `apiAddr`:OpenIM REST API 地址(例如:`http://127.0.0.1:10002`)
- `platformID`:平台 ID(需与签发该 Token 时使用的 platformID 一致)
- 你已经[部署了OpenIMServer 和 ChatServer](../gettingStarted/dockerCompose),已部署并启动 OpenClaw Gateway,并能在运行 Gateway 的机器上执行 `openclaw` 命令。

## 2. 准备用户 Token
## 2. 注册OpenClaw用户

### 1.注册用户

Expand All @@ -32,15 +27,13 @@ sidebar_position: 8





### 获取管理员token

参考 [获取管理员 Token](../../restapi/apis/authenticationManagement/getAdminToken) 文档获取管理员 token。

### 获取用户token

拿到管理员 token 后,参考 [获取用户 Token](../../restapi/apis/authenticationManagement/getUserToken) 文档为指定用户签发登录 token。userID填写刚刚注册的用户的userID,platformID建议填写12
拿到管理员 token 后,参考 [获取用户 Token](../../restapi/apis/authenticationManagement/getUserToken) 文档为指定用户签发登录 token。userID填写刚刚注册的用户的userID,platformID填写12(表示bot)

## 3. 安装 OpenIM Channel 插件

Expand Down
2 changes: 1 addition & 1 deletion docs/restapi/commonFields.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ title: 常用字段说明
| 字段名 | 类型 | 字符串长度限制 | 说明 | 取值说明 |
| -------------- | ------ | -------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
| secret | string | 32 | 服务端秘钥 | 字符串 |
| platformID | int | | 用户登录时的终端类型 | 1:iOS, 2:Android, 3:Windows, 4:OSX, 5:Web, 6:MiniWeb, 7:Linux, 8:APad, 9:IPad, 10:Admin, 11:HarmonyOS,12:Bot|
| platformID | int | | 用户登录时的终端类型 | 1:iOS, 2:Android, 3:Windows, 4:OSX, 5:Web, 6:MiniWeb, 7:Linux, 8:APad, 9:IPad, 10:Admin, 11:HarmonyOS|

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Restore bot platform ID in shared platformID enum docs

This edit removes 12:Bot from the canonical platformID value list, but the same commit explicitly instructs OpenClaw users to mint tokens with platformID=12 (docs/guides/solution/openclaw.md:38). Since REST API pages such as getUserToken reference /commonFields.md for valid terminal types, this contradiction will lead users to treat 12 as invalid and issue unusable tokens for bot scenarios; keep the common enum and the OpenClaw flow consistent.

Useful? React with 👍 / 👎.

| userID | string | 64 | 用户ID,保证唯一,不能包含特殊字符 | 字符串 |
| nickname | string | 255 | 昵称 | 字符串 |
| faceURL | string | 255 | 头像URL | URL 链接 |
Expand Down
Loading