Trello 可以发送哪些类型的 webhook?每个都有什么属性?

What are the possible kinds of webhooks Trello can send? What attributes come in each?

我正在开发一个与 Trello 紧密集成的应用程序,并使用 Trello webhooks 做很多事情。但是,我无法在 Trello 的开发人员文档中找到任何地方 可能触发 webhook 的 "actions" 是什么 以及每个这些中将包含哪些数据。

事实上,根据我的经验,每个 webhook 附带的数据有点随机。例如,虽然大多数 webhook 包含 cardshortLink 是某些操作的目标,但有些 webhook 却没有,以一种完全不可预测的方式。此外,从清单创建卡片似乎不会触发正常创建卡片时触发的相同 webhook,依此类推。

那么,在某处记录了吗?

在解决了这些问题以及我对每个 webhook 中应该包含哪些数据以及每个不同操作的名称的原始记忆之后,我决定自己记录下来并将其发布为(当我发现新的时不断更新) webhooks)一组 JSON 文件显示每个 webhook 将发送到您的端点的数据样本:

https://github.com/fiatjaf/trello-webhooks

例如,当一个板关闭时,将发送一个 webhook

{
  "id": "55d7232fc3597726f3e13ddf",
  "idMemberCreator": "50e853a3a98492ed05002257",
  "data": {
    "old": {
      "closed": false
    },
    "board": {
      "shortLink": "V50D5SXr",
      "id": "55af0b659f5c12edf972ac2e",
      "closed": true,
      "name": "Communal Website"
    }
  },
  "type": "updateBoard",
  "date": "2015-08-21T13:10:07.216Z",
  "memberCreator": {
    "username": "fiatjaf",
    "fullName": "fiatjaf",
    "avatarHash": "d2f9f8c8995019e2d3fda00f45d939b8",
    "id": "50e853a3a98492ed05002257",
    "initials": "F"
  }
}

事实上,出现的是 JSON 对象,如 {"model": ..., "action": ... the data you see up there...},但为了简洁起见,我删除了这些对象,我只展示了 [=21= 中出现的内容]键。

基于@flatjaf 的 repo,我收集并总结了所有* webhooks 类型。

addAttachmentToCard
addChecklistToCard
addLabelToCard
addMemberToBoard
addMemberToCard
commentCard
convertToCardFromCheckItem
copyCard
createCard
createCheckItem
createLabel
createList
deleteAttachmentFromCard
deleteCard
deleteCheckItem
deleteComment
deleteLabel
emailCard
moveCardFromBoard
moveCardToBoard
moveListFromBoard
moveListToBoard
removeChecklistFromCard
removeLabelFromCard
removeMemberFromBoard
removeMemberFromCard
updateBoard
updateCard
updateCheckItem
updateCheckItemStateOnCard
updateChecklist
updateComment
updateLabel
updateList

希望对您有所帮助!

*我不知道该列表是否包括所有可用的 webhooks 类型,因为正如我已经说过的,它基于 2 年前创建的 flatjaf 的 repo