approve-pairing
Approve pending DM pairing requests by writing directly to OpenClaw credential files — no CLI required.
How It Works
Pairing state lives in two files under ~/.openclaw/credentials/:
- -
<channel>-pairing.json — pending requests (sender ID, code, accountId) <channel>-<accountId>-allowFrom.json — approved senders allowlist
Approving = add sender ID to allowFrom file + remove code from pairing file.
Quick Approval (script)
CODEBLOCK0
Example:
CODEBLOCK1
The script:
- 1. Reads INLINECODE3
- Finds the request matching the code
- Appends the sender ID to the allowFrom file
- Removes the code from pending requests
Manual Steps (if script unavailable)
- 1. Read
~/.openclaw/credentials/<channel>-pairing.json to get id and INLINECODE6 - Write/update
~/.openclaw/credentials/<channel>-<accountId>-allowFrom.json:
{ "version": 1, "allowFrom": ["<sender_id>"] }
- 3. Clear the pending request from INLINECODE8
Notes
- - Codes expire after 1 hour — check
createdAt if approval fails - A gateway restart may be needed: INLINECODE10
- If
accountId is "default" or empty, the file is INLINECODE13 - Pending requests capped at 3 per channel; old ones must expire before new ones are created
approve-pairing
通过直接写入OpenClaw凭证文件来批准待处理的DM配对请求——无需命令行界面。
工作原理
配对状态保存在 ~/.openclaw/credentials/ 目录下的两个文件中:
- - <频道>-pairing.json — 待处理请求(发送者ID、验证码、账户ID)
- <频道>-<账户ID>-allowFrom.json — 已批准的发送者白名单
批准操作 = 将发送者ID添加到allowFrom文件 + 从配对文件中移除验证码。
快速批准(脚本方式)
bash
python3 skills/approve-pairing/scripts/approve_pairing.py <频道> <验证码>
示例:
bash
python3 skills/approve-pairing/scripts/approve_pairing.py telegram PWVW264M
该脚本将:
- 1. 读取 ~/.openclaw/credentials/<频道>-pairing.json
- 查找与验证码匹配的请求
- 将发送者ID追加到allowFrom文件
- 从待处理请求中移除该验证码
手动操作步骤(脚本不可用时)
- 1. 读取 ~/.openclaw/credentials/<频道>-pairing.json 获取 id 和 meta.accountId
- 写入/更新 ~/.openclaw/credentials/<频道>-<账户ID>-allowFrom.json:
json
{ version: 1, allowFrom: [<发送者ID>] }
- 3. 从 <频道>-pairing.json 中清除待处理请求
注意事项
- - 验证码1小时后过期——如果批准失败,请检查 createdAt
- 可能需要重启网关:openclaw gateway restart
- 如果 accountId 为 default 或为空,则文件名为 <频道>-default-allowFrom.json
- 每个频道最多保留3个待处理请求;旧请求过期后才能创建新请求