# 前言

这里介绍如何在开放应用中设置TAPD事件订阅

# 界面配置

查看快速入门

# 代码方式配置webhook

代码方式配置webhook可以让开发者自定义事件订阅回调处理

# 配置文件示例

app:
  code: demo 
  name: demo
  desc: demo
  icon: demo
  tag:
    - name: demo
  envs:
    - key: API_SECRET
      secret: strings
  modules:
    webhooks: #webhook订阅
      - events:
          - story::update
        handler: story_update.handle
      - events:
          - bug::update
          - bug::delete
          - bug::create
        handler: bug_events.handle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

# 关键配置

webhooks: 
  - events:
      - story::update
    handler: story_update.handle
  - events:
      - bug::update
      - bug::delete
      - bug::create
    handler: bug_events.handle
  - events:
      - iteration::update
    handler: https://tapd.woa.com
1
2
3
4
5
6
7
8
9
10
11
12

支持配置多组webhooks,每组webhook对应一个handler,如示例配置中第一个表示订阅"需求更新"事件,收到事件后执行modules/webhooks/story_update.py文件的handle方法,如示例配置中第三个表示订阅"迭代更新"事件,收到事件后会将webhook payload发往https://tapd.woa.com

# 代码示例

def handle(data):
    #在这里处理TAPD事件回调
    print("========== receive tapd webhook request ==========")
    print(data)
1
2
3
4

# 日志查看

enter image description here

上次更新: 2025-04-17 22:49:32