-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Ke Jie <[email protected]>
- Loading branch information
Showing
4 changed files
with
133 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
sidebar_position: 6 | ||
--- | ||
|
||
# 6. 恭喜你! | ||
|
||
至此,你已经完成了从零开始创建、开发和部署一个应用,并成功完成变更通知接收能力。 | ||
|
||
除了 Node.js 之外,钉钉 Stream 模式的机器人的 SDK 还支持其他主流编程语言,可以移步[钉钉 SDK 概述](/docs/develop/sdk/overview)查看所有的 SDK。 | ||
|
||
## 相关链接 | ||
|
||
* [GitHub 上完整教程代码](https://github.com/open-dingtalk/dingtalk-stream-sdk-nodejs) |
27 changes: 27 additions & 0 deletions
27
docs/explore/tutorials/stream/event/nodejs/subscribe-topic.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
sidebar_position: 4 | ||
--- | ||
|
||
# 4. 订阅事件类型 | ||
|
||
本文将介绍如何找到想要订阅的事件类型(Topic),并开启相应类型的事件订阅。 | ||
|
||
## 步骤说明 | ||
|
||
1. **进入应用**:进入钉钉[开发者后台](https://open-dev.dingtalk.com),找到[步骤2:创建应用](create-app)中创建的应用,然后点击进入应用详情页 | ||
2. **通道验证**:依次点击【事件与回调】-【已完成接入,验证连接通道】-【保存】,即可完成通道验证<br /> | ||
![通道验证](/img/explore/stream/event/stream-validate.png)<br /> | ||
:::caution 注意事项 | ||
在操作通道验证之前,务必完成[步骤3:开发事件订阅服务](build-listener),并成功启动事件订阅的服务,否则会导致“验证连接通道”异常。 | ||
::: | ||
3. **选择类型**:继续保持在当前页面,下拉到页面底部,可以找到所有的事件列表。根据需要勾选以开启对应的事件类型(Topic)变更通知。<br /> | ||
在当前教程中,我们选择了“群会话更换群名称”,请勾选以顺利进行下一步功能体验。<br /> | ||
你可以在[官方文档:配置事件订阅的推送](https://open.dingtalk.com/document/orgapp/stream)文档中,点击左侧导航栏找到所有的事件类型。例如通过[群会话更换群名称](https://open.dingtalk.com/document/orgapp/group-session-change-group-name-stream)文档,可以知道“群会话更换群名称”事件对应的英文名称(Topic)是“chat_update_title”。<br /> | ||
示意图如下:<br /> | ||
![选择 Topic](/img/explore/stream/event/select-topic.png) | ||
|
||
至此,已完成代码开发以及事件订阅的配置,接下来可以体验一下订阅变更通知的实际效果。 | ||
|
||
## 相关链接 | ||
|
||
* [官方文档:配置事件订阅的推送](https://open.dingtalk.com/document/orgapp/stream) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
sidebar_position: 5 | ||
--- | ||
|
||
# 5. 体验事件通知 | ||
|
||
本文将介绍如何体验事件变更通知的接收效果。 | ||
|
||
## 触发一个变更通知 | ||
|
||
在[步骤3:开发事件订阅服务](build-listener)中,我们在代码里记录了“群会话更换群名称”(Topic:chat_update_title)事件的消息数据。可以通过修改一个群名称,查看事件订阅的效果。 | ||
|
||
步骤如下: | ||
1. 找到一个内部群,而且确认这个内部群归属的组织与[步骤2:创建应用](create-app)所采用的是同一个组织; | ||
2. 修改群名称,任意名称即可 | ||
|
||
## 查看日志 | ||
|
||
查看[步骤3:开发事件订阅服务](build-listener)中 `index.ts` 服务运行的日志,可以看到这样一条日志表示成功接收到服务端推送的群名称变更事件。 | ||
|
||
```text wordWrap=true | ||
received event, | ||
delay=165ms, | ||
eventType=chat_update_title, | ||
eventId=44c****be0, | ||
eventBornTime=1695057173479, | ||
eventCorpId=ding****741, | ||
eventUnifiedAppId=fce39****bad, | ||
data={"timeStamp":1695057173477,"chatId":"chat****a45d","operatorUnionId":"RC****iE","title":"SDK 测试,请忽略","openConversationId":"cid9****HQ==","operator":"042****297"} | ||
``` | ||
|
||
备注:为了方便展示,手动对日志做了换行和格式优化。 |