> For the complete documentation index, see [llms.txt](https://doc.duaer.com/zh/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.duaer.com/zh/troubleshooting/dingtalk-robot-310000.md).

# 在 Duaer 里排查钉钉机器人 310000 发送失败

Duaer 用 HTTP Request 发钉钉群机器人，返回 errcode 310000，是机器人安全设置没通过：关键词、加签或 IP 白名单。
## 在 Duaer 里发钉钉群机器人

[HTTP Request](/zh/build/http-request.md)：Method 选 POST，URL 填机器人 Webhook 地址，Send Body 选 JSON，内容写 {"msgtype":"text","text":{"content":{{ JSON.stringify($json.message) }}}}。

钉钉出错时 HTTP 状态也是 200，Duaer 节点显示成功。看输出里的 errcode，不是 0 就是失败，后面接 [If](/zh/build/if.md) 和 [Stop and Error](/zh/build/stop-and-error.md) 让它变红。

## 310000 看 errmsg

- keywords not in content：机器人设了自定义关键词，消息里没有。把关键词写进消息开头。
- sign not match 或 invalid timestamp：开了加签，签名或时间戳不对。时间戳要用毫秒，并且在一小时内。
- ip … not in whitelist：开了 IP 地址段，Duaer 的出口 IP 不在里面。自托管把服务器出口 IP 加进去；云端用关键词或加签。

## 在 Duaer 里生成加签

1. 加 [Edit Fields](/zh/build/edit-fields.md)，新字段 ts，值 {{ $now.toMillis() }}（毫秒时间戳）。
2. 加 [Crypto](/zh/build/crypto.md)：Action 选 Hmac，Type 选 SHA256，Encoding 选 BASE64，Property Name 写 sign。凭证里的 Hmac Secret 填机器人的 SEC 开头密钥。
3. Value 写 {{ $json.ts + "\n" + "SEC你的密钥" }}，也就是「时间戳 + 换行 + 密钥」。
4. [HTTP Request](/zh/build/http-request.md) 的 URL 末尾加 &timestamp={{ $json.ts }}&sign={{ encodeURIComponent($json.sign) }}。

密钥会出现在 Crypto 节点里。不需要加签时，改用关键词更简单。每个机器人每分钟最多发 20 条，多条合并后再发。
## Questions

### Duaer 有钉钉节点吗？

Duaer 用 HTTP Request 调钉钉机器人的 Webhook 地址，加签用 Crypto 节点生成。

### Duaer 发钉钉显示成功但群里没消息？

钉钉失败也返回 HTTP 200。看 Duaer 节点输出的 errcode 和 errmsg，310000 是安全设置没通过。

## 相关

- [在 Duaer 里用 HTTP Request 调接口](https://doc.duaer.com/zh/build/http-request.md)
- [在 Duaer 里用 Crypto 做哈希](https://doc.duaer.com/zh/build/crypto.md)
- [在 Duaer 里排查企业微信、飞书群机器人发送失败](https://doc.duaer.com/zh/troubleshooting/wecom-feishu-bot-webhook-errors.md)
- [在 Duaer 里配置 Stop and Error 节点](https://doc.duaer.com/zh/build/stop-and-error.md)

