> ## Documentation Index
> Fetch the complete documentation index at: https://rpa.bazhuayu.com/helpcenter/llms.txt
> Use this file to discover all available pages before exploring further.

# 机器人接收消息

# 指令输入

<img src="https://mintcdn.com/bazhuayu-rpa-docs/anGtSOP5rOnWAbQR/helpcenter/commands/custom-commands/zVqFJbuW/images/zNevOgUo-01.png?fit=max&auto=format&n=anGtSOP5rOnWAbQR&q=85&s=2eed155342b958623bd9730158af0b48" alt="image" width="823" height="504" data-path="helpcenter/commands/custom-commands/zVqFJbuW/images/zNevOgUo-01.png" />

<strong>app\_key：获取方式如下</strong>

<strong>app\_secret: 获取方式如下</strong>

<strong>文件存储路径：用来存放输出消息文件的路径。</strong>

<strong>是否提前终止进程：布尔值类型</strong>

<strong>收到的消息：当选择提前终止进程时，会返回当前收到的消息</strong>

<strong>当是否提前终止进程为false：机器人会持续监听钉钉消息，并将接收到的消息数据写入日志文件；日志文件按自然日划分，每日生成一个独立文件，存储路径格式为：文件夹路径\YYYYMMDD.txt（例如：D:\ 测试文件 \20260228.txt）。</strong>

<strong>当是否提前终止进程为True：</strong>机器人仅监听一条钉钉消息，收到消息后立即停止监听；监听到的消息数据会写入按自然日划分的日志文件（路径格式：文件夹路径\YYYYMMDD.txt，示例：D:\ 测试文件 \20260228.txt，每日生成一个独立文件），同时返回该条消息的文本内容。

企业内部应用获取 AppKey 和 AppSecret，开通机器人

打开网址[https://open-dev.dingtalk.com/fe/app](https://open-dev.dingtalk.com/fe/app) 登录钉钉开发者后台

1.创建企业内部应用

<img src="https://mintcdn.com/bazhuayu-rpa-docs/anGtSOP5rOnWAbQR/helpcenter/commands/custom-commands/zVqFJbuW/images/zNevOgUo-02.png?fit=max&auto=format&n=anGtSOP5rOnWAbQR&q=85&s=4d2c5467faaa32c5f592ae5d26479c9a" alt="image" width="500" height="678" data-path="helpcenter/commands/custom-commands/zVqFJbuW/images/zNevOgUo-02.png" />

2.填写创建应用相关信息：

<img src="https://mintcdn.com/bazhuayu-rpa-docs/anGtSOP5rOnWAbQR/helpcenter/commands/custom-commands/zVqFJbuW/images/zNevOgUo-03.png?fit=max&auto=format&n=anGtSOP5rOnWAbQR&q=85&s=747fb467225ae637a7d76f0dd3f7565b" alt="image" width="620" height="1250" data-path="helpcenter/commands/custom-commands/zVqFJbuW/images/zNevOgUo-03.png" />

3.添加机器人

<img src="https://mintcdn.com/bazhuayu-rpa-docs/anGtSOP5rOnWAbQR/helpcenter/commands/custom-commands/zVqFJbuW/images/zNevOgUo-04.png?fit=max&auto=format&n=anGtSOP5rOnWAbQR&q=85&s=4661db04ea47375f7598ac4b485493b2" alt="image" width="2158" height="919" data-path="helpcenter/commands/custom-commands/zVqFJbuW/images/zNevOgUo-04.png" />

4.机器人配置并发布机器人

<img src="https://mintcdn.com/bazhuayu-rpa-docs/anGtSOP5rOnWAbQR/helpcenter/commands/custom-commands/zVqFJbuW/images/zNevOgUo-05.png?fit=max&auto=format&n=anGtSOP5rOnWAbQR&q=85&s=e2c1806f98580258b45b97efe0abd44a" alt="image" width="923" height="1129" data-path="helpcenter/commands/custom-commands/zVqFJbuW/images/zNevOgUo-05.png" />

5.需开通一下权限: 成员信息读权限，调用企业API基础权限，企业内机器人发送消息权限，3个权限都需要开通

<img src="https://mintcdn.com/bazhuayu-rpa-docs/anGtSOP5rOnWAbQR/helpcenter/commands/custom-commands/zVqFJbuW/images/zNevOgUo-06.png?fit=max&auto=format&n=anGtSOP5rOnWAbQR&q=85&s=0c11e13b06a2a8daea0c7a3c72a94610" alt="image" width="2430" height="851" data-path="helpcenter/commands/custom-commands/zVqFJbuW/images/zNevOgUo-06.png" />

6.应用发布：

点击查看版本详情

<img src="https://mintcdn.com/bazhuayu-rpa-docs/anGtSOP5rOnWAbQR/helpcenter/commands/custom-commands/zVqFJbuW/images/zNevOgUo-07.png?fit=max&auto=format&n=anGtSOP5rOnWAbQR&q=85&s=46085b5f3b09a6ab234ad0efd02acb29" alt="image" width="2419" height="799" data-path="helpcenter/commands/custom-commands/zVqFJbuW/images/zNevOgUo-07.png" />

点击编辑标志，把版本信息补充完整

<img src="https://mintcdn.com/bazhuayu-rpa-docs/anGtSOP5rOnWAbQR/helpcenter/commands/custom-commands/zVqFJbuW/images/zNevOgUo-08.png?fit=max&auto=format&n=anGtSOP5rOnWAbQR&q=85&s=164576d80f2cc9327a1f04bcafd5de0d" alt="image" width="1109" height="564" data-path="helpcenter/commands/custom-commands/zVqFJbuW/images/zNevOgUo-08.png" />

<img src="https://mintcdn.com/bazhuayu-rpa-docs/anGtSOP5rOnWAbQR/helpcenter/commands/custom-commands/zVqFJbuW/images/zNevOgUo-09.png?fit=max&auto=format&n=anGtSOP5rOnWAbQR&q=85&s=0fe487a36522ca82c41fcc95e4984cd1" alt="image" width="1229" height="1035" data-path="helpcenter/commands/custom-commands/zVqFJbuW/images/zNevOgUo-09.png" />

### 获取 AppKey 和 AppSecret

<img src="https://mintcdn.com/bazhuayu-rpa-docs/anGtSOP5rOnWAbQR/helpcenter/commands/custom-commands/zVqFJbuW/images/zNevOgUo-10.png?fit=max&auto=format&n=anGtSOP5rOnWAbQR&q=85&s=f72b7bba0220695b343ffd6d44f64dd7" alt="image" width="2280" height="824" data-path="helpcenter/commands/custom-commands/zVqFJbuW/images/zNevOgUo-10.png" />

## 应用功能介绍：

开发完成后，你需要添加机器人入群[添加机器人入群](https://open.dingtalk.com/document/dingstart/add-robot-to-group#)，当你@机器人发送“你好”，服务端接收消息格式如下：

<img src="https://mintcdn.com/bazhuayu-rpa-docs/anGtSOP5rOnWAbQR/helpcenter/commands/custom-commands/zVqFJbuW/images/zNevOgUo-11.png?fit=max&auto=format&n=anGtSOP5rOnWAbQR&q=85&s=4dd61b32e1cfa8cefbcf5f33322199c6" alt="image" width="2359" height="1051" data-path="helpcenter/commands/custom-commands/zVqFJbuW/images/zNevOgUo-11.png" />

\{

"specVersion": "1.0",

"type": "CALLBACK",

"headers": \{

"appId": "04230b68-51f5-4a1c-82fc-b6fbf533d6e8",

"connectionId": "d140d440-b4c9-11f0-80c0-7e88154b8801",

"contentType": "application/json",

"messageId": "bf8fbd2\_cb7\_19a253627d1\_be1219",

"time": "1761743946669",

"topic": "/v1.0/im/bot/messages/get"

},

"data": "\{"senderPlatform":"Win","conversationId":"cidOiieLDYJxHfrB1hBWzQpEQ==","atUsers":\[\{"dingtalkId":"$:LWCP_v1:$8DTBn0eia1aGdGgC6f7xwcA7d/J5O826"}],"chatbotCorpId":"dingd8b60689774870bd4ac5d6980864d335","chatbotUserId":"$:LWCP_v1:$8DTBn0eia1aGdGgC6f7xwcA7d/J5O826","openThreadId":"cidOiieLDYJxHfrB1hBWzQpEQ==","msgId":"msg7P5xLAscj5F9hsF92D5fxA==","senderNick":"李杰","isAdmin":true,"senderStaffId":"014642481450846306","sessionWebhookExpiredTime":1761749346646,"createAt":1761743946379,"senderCorpId":"dingd8b60689774870bd4ac5d6980864d335","conversationType":"2","senderId":"$:LWCP_v1:$50JPibHrGYbxrBSiKEjpeeugJTCEnq7v","conversationTitle":"机器人接收消息测试群","isInAtList":true,"sessionWebhook":"[https://oapi.dingtalk.com/robot/sendBySession?session=42aaaa8895a53636c7cda100a5cb22ef\\",\\"senderUnionId\\":\\"XiSYLMsEjy52jBIYfHHiiIgwiEiE\\",\\"text\\":\\\{\\"content\\":\\](https://oapi.dingtalk.com/robot/sendBySession?session=42aaaa8895a53636c7cda100a5cb22ef\\",\\"senderUnionId\\":\\"XiSYLMsEjy52jBIYfHHiiIgwiEiE\\",\\"text\\":\\\{\\"content\\":\\)" 你好"},"robotCode":"dingbkjzpxkfcjlhfsat","msgtype":"text"}"

<Info>
  使用指令过程中遇到问题？前往 [八爪鱼RPA 开发者社区问答板块](https://rpa.bazhuayu.com/community/questions) 提问，获取官方与社区帮助。
</Info>
