评论 Webhook
Available in Team plan
设置和管理 Webhook,以改善您的评论集成。评论 Webhook 的常见用例包括:
- 在创建、解决、更新或删除线程时发送通知。
- 在添加、更新或删除评论时通知用户。
- 结合使用 提及扩展,在用户被提及时向用户发送电子邮件或通知。
启用评论事件
对于 2024 年 3 月 1 日后创建的账户,评论 Webhook 默认启用。否则,您可能仍在使用旧版本的 Webhook 系统,需要手动升级:
该升级有必要以便适应多种新事件被路由到同一 Webhook 端点的引入,新的 type 和 trigger 字段作为区别。
配置 Webhook
要配置评论通知的 Webhook:
- 访问您账户中的 协作设置。
- 在 Webhooks 部分,添加您希望的端点 URL。
添加 URL 后,Webhook 会立即生效。您将开始接收指定事件的通知,毫无延迟。
Webhook 事件
评论 Webhook 触发与评论扩展内线程和评论相关的多种事件的通知。这些事件在其关联操作发生时立即触发。
comment.addedcomment.updatedcomment.deletedthread.createdthread.resolvedthread.updatedthread.deleted
示例有效载荷
以下是不同类型 Webhook 事件的示例有效载荷:
线程/评论创建
{
"trigger": "comment.added",
"thread": {
"id": "128ba3a9-c684-4956-8c9f-fe5dc147c7e5",
"createdAt": "2024-03-02T22:17:51.304Z",
"comments": [
{
"id": "0259e4cb-43ad-4eb2-a7e9-a7a7d5207a76",
"createdAt": "2024-03-02T22:17:51.307Z",
"updatedAt": "2024-03-02T22:17:51.307Z",
"data": {
"userName": "Cyndi Lauper",
"userAvatar": "https://api.dicebear.com/7.x/lorelei/svg?seed=Cyndi Lauper"
},
"content": "线程创建评论"
}
],
"updatedAt": "2024-03-02T22:17:51.305Z"
},
"comment": {
"id": "0259e4cb-43ad-4eb2-a7e9-a7a7d5207a76",
"createdAt": "2024-03-02T22:17:51.307Z",
"updatedAt": "2024-03-02T22:17:51.307Z",
"data": {
"userName": "Cyndi Lauper",
"userAvatar": "https://api.dicebear.com/7.x/lorelei/svg?seed=Cyndi Lauper"
},
"content": "线程创建评论"
},
"appName": "",
"user": "",
"name": "documentName",
"type": "THREAD"
}评论更新
{
"trigger": "comment.updated",
"thread": [
{
"id": "0259e4cb-43ad-4eb2-a7e9-a7a7d5207a76",
"createdAt": "2024-03-02T22:17:51.307Z",
"updatedAt": "2024-03-02T22:18:04.246Z",
"data": {
"userName": "Cyndi Lauper",
"userAvatar": "https://api.dicebear.com/7.x/lorelei/svg?seed=Cyndi Lauper"
},
"content": "线程创建评论(已编辑)"
}
],
"comment": {
"id": "0259e4cb-43ad-4eb2-a7e9-a7a7d5207a76",
"createdAt": "2024-03-02T22:17:51.307Z",
"updatedAt": "2024-03-02T22:18:04.246Z",
"data": {
"userName": "Cyndi Lauper",
"userAvatar": "https://api.dicebear.com/7.x/lorelei/svg?seed=Cyndi Lauper"
},
"content": "线程创建评论(已编辑)"
},
"appName": "",
"user": "",
"name": "documentName",
"type": "THREAD"
}评论删除
{
"trigger": "comment.deleted",
"thread": {
"id": "128ba3a9-c684-4956-8c9f-fe5dc147c7e5",
"createdAt": "2024-03-02T22:17:51.304Z",
"comments": [
{
"id": "0259e4cb-43ad-4eb2-a7e9-a7a7d5207a76",
"createdAt": "2024-03-02T22:17:51.307Z",
"updatedAt": "2024-03-02T22:18:04.246Z",
"data": {
"userName": "Cyndi Lauper",
"userAvatar": "https://api.dicebear.com/7.x/lorelei/svg?seed=Cyndi Lauper"
},
"content": "线程创建评论(已编辑)"
}
],
"updatedAt": "2024-03-02T22:17:51.305Z"
},
"comment": {
"id": "1841e650-2202-42b6-a868-907fee42ccf7",
"createdAt": "2024-03-02T22:18:20.974Z",
"updatedAt": "2024-03-02T22:18:20.975Z",
"data": {
"userName": "Cyndi Lauper",
"userAvatar": "https://api.dicebear.com/7.x/lorelei/svg?seed=Cyndi Lauper"
},
"content": "第二条评论,相同线程"
},
"appName": "",
"user": "",
"name": "documentName",
"type": "THREAD"
}线程删除
{
"trigger": "thread.deleted",
"thread": {
"id": "128ba3a9-c684-4956-8c9f-fe5dc147c7e5",
"createdAt": "2024-03-02T22:17:51.304Z",
"comments": [
{
"id": "0259e4cb-43ad-4eb2-a7e9-a7a7d5207a76",
"createdAt": "2024-03-02T22:17:51.307Z",
"updatedAt": "2024-03-02T22:18:04.246Z",
"data": {
"userName": "Cyndi Lauper",
"userAvatar": "https://api.dicebear.com/7.x/lorelei/svg?seed=Cyndi Lauper"
},
"content": "线程创建评论(已编辑)"
}
],
"updatedAt": "2024-03-02T22:18:52.050Z",
"resolvedAt": null
},
"appName": "",
"user": "",
"name": "documentName",
"type": "THREAD"
}线程解决
{
"trigger": "thread.resolved",
"thread": {
"id": "128ba3a9-c684-4956-8c9f-fe5dc147c7e5",
"createdAt": "2024-03-02T22:17:51.304Z",
"comments": [
{
"id": "0259e4cb-43ad-4eb2-a7e9-a7a7d5207a76",
"createdAt": "2024-03-02T22:17:51.307Z",
"updatedAt": "2024-03-02T22:18:04.246Z",
"data": {
"userName": "Cyndi Lauper",
"userAvatar": "https://api.dicebear.com/7.x/lorelei/svg?seed=Cyndi Lauper"
},
"content": "线程创建评论(已编辑)"
}
],
"updatedAt": "2024-03-02T22:18:48.531Z",
"resolvedAt": "2024-03-02T22:18:48.531Z"
},
"appName": "",
"user": "",
"name": "documentName",
"type": "THREAD"
}线程更新(即未解决)
{
"trigger": "thread.updated",
"thread": {
"id": "128ba3a9-c684-4956-8c9f-fe5dc147c7e5",
"createdAt": "2024-03-02T22:17:51.304Z",
"comments": [
{
"id": "0259e4cb-43ad-4eb2-a7e9-a7a7d5207a76",
"createdAt": "2024-03-02T22:17:51.307Z",
"updatedAt": "2024-03-02T22:18:04.246Z",
"data": {
"userName": "Cyndi Lauper",
"userAvatar": "https://api.dicebear.com/7.x/lorelei/svg?seed=Cyndi Lauper"
},
"content": "线程创建评论(已编辑)"
}
],
"updatedAt": "2024-03-02T22:18:52.050Z",
"resolvedAt": null
},
"appName": "",
"user": "",
"name": "documentName",
"type": "THREAD"
}