# 前言

这里介绍如何在插件中设置TAPD事件订阅

# 配置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
1
2
3
4
5
6
7
8
9

支持配置多组webhooks,每组webhook对应一个handle,如示例配置中第一个表示订阅"需求更新"事件,收到事件后执行modules/webhooks/story_update.py文件的handle方法

  • 附目前支持的所有事件:
    const EVENT_LAUNCHFORM_ADD      = 'launchform::create';
    const EVENT_LAUNCHFORM_UPDATE   = 'launchform::update';
    const EVENT_BUG_ADD             = 'bug::create';
    const EVENT_BUG_UPDATE          = 'bug::update';
    const EVENT_BUG_DELETE          = 'bug::delete';
    const EVENT_STORY_ADD           = 'story::create';
    const EVENT_STORY_UPDATE        = 'story::update';
    const EVENT_STORY_DELETE        = 'story::delete';
    const EVENT_TASK_ADD            = 'task::create';
    const EVENT_TASK_UPDATE         = 'task::update';
    const EVENT_TASK_DELETE         = 'task::delete';
    const EVENT_TOBJECT_ADD         = 'tobject::create';
    const EVENT_TOBJECT_UPDATE      = 'tobject::update';
    const EVENT_TOBJECT_DELETE      = 'tobject::delete';
    const EVENT_RELEASE_ADD         = 'release::create';
    const EVENT_RELEASE_UPDATE      = 'release::update';
    const EVENT_RELEASE_DELETE      = 'release::delete';
    const EVENT_ITERATION_ADD       = 'iteration::create';
    const EVENT_ITERATION_UPDATE    = 'iteration::update';
    const EVENT_ITERATION_DELETE    = 'iteration::delete';
    const EVENT_BOARD_ADD           = 'board::create';
    const EVENT_BOARD_UPDATE        = 'board::update';
    const EVENT_BOARD_DELETE        = 'board::delete';
    const EVENT_BOARD_CARD_ADD      = 'board_card::create';
    const EVENT_BOARD_CARD_UPDATE   = 'board_card::update';
    const EVENT_BOARD_CARD_DELETE   = 'board_card::delete';
    const EVENT_BRANCH_RELATE       = 'branch::relate';
    const EVENT_BRANCH_UNRELATE     = 'branch::unrelate';
    const EVENT_COMMIT_LINK         = 'commit::link';
    const EVENT_COMMIT_UNLINK       = 'commit::unlink';
    const EVENT_STORY_COMMENT_ADD           = 'story_comment::add';
    const EVENT_STORY_COMMENT_UPDATE        = 'story_comment::update';
    const EVENT_STORY_COMMENT_DELETE        = 'story_comment::delete';
    const EVENT_BUG_COMMENT_ADD             = 'bug_comment::add';
    const EVENT_BUG_COMMENT_UPDATE          = 'bug_comment::update';
    const EVENT_BUG_COMMENT_DELETE          = 'bug_comment::delete';
    const EVENT_TASK_COMMENT_ADD            = 'task_comment::add';
    const EVENT_TASK_COMMENT_UPDATE         = 'task_comment::update';
    const EVENT_TASK_COMMENT_DELETE         = 'task_comment::delete';
    const EVENT_OPEN_APP_ATTACHMENT_DELETE  = 'open_app_attachment::delete';
    const EVENT_OPEN_APP_ATTACHMENT_UPDATE  = 'open_app_attachment::update';
    const EVENT_OPEN_APP_ATTACHMENT_ADD     = 'open_app_attachment::add';
    const EVENT_STORY_ATTACHMENT_ADD        = 'story_attachment::add';
    const EVENT_STORY_ATTACHMENT_DELETE     = 'story_attachment::delete';
    const EVENT_BUG_ATTACHMENT_ADD        = 'bug_attachment::add';
    const EVENT_BUG_ATTACHMENT_DELETE     = 'bug_attachment::delete';
    const EVENT_TASK_ATTACHMENT_ADD         = 'task_attachment::add';
    const EVENT_TASK_ATTACHMENT_DELETE      = 'task_attachment::delete';
    const EVENT_VERSION_ADD             = 'version::add';
    const EVENT_VERSION_UPDATE          = 'version::update';
    const EVENT_VERSION_DELETE          = 'version::delete';
    const EVENT_APP_CREATE_AUTH         = 'open_app::create_auth';
    const EVENT_APP_CANCEL_AUTH         = 'open_app::cancel_auth';
    const EVENT_APP_OPEN                = 'open_app::open';
    const EVENT_APP_CLOSED              = 'open_app::closed';
	const EVENT_KANBAN_UPDATE			= 'kanban::update';
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56

# 代码示例

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

# 日志查看

enter image description here

上次更新: 2023-10-24 15:37:31