如何为 trello 中的每张卡片添加唯一的整数短 ID(特征编号)?

How to add unique integer short ID (feature number) for every card in trello?

我写了一个网络脚本,它为 trello card ID 生成功能编号并将其保存在数据库中。

我还创建了一个 webhook,它在 trello board 更改时执行

当我创建卡片时,webhook 向回调发送请求URL,但该请求不包含有关事件的数据。它仅包含型号信息(关于电路板)。如何获取新卡的 ID?

{
    "model"=>{
        "id"=>"5204523d8d3432ff1a000a60",
        "name"=>"#BOARD",
        "desc"=>"",
        "descData"=>nil,
        "closed"=>false,
        "idOrganization"=>"53aaf6e5309dc12a75111fbf",
        "pinned"=>false,
        "url"=>"https://trello.com/b/ABdAaJeO/board",
        "shortUrl"=>"https://trello.com/b/ABdAaJeO",
        "prefs"=>{
            "permissionLevel"=>"org",
            "voting"=>"disabled",
            "comments"=>"members",
            "invitations"=>"members",
            "selfJoin"=>false,
            "cardCovers"=>true,
            "calendarFeedEnabled"=>true,
            "background"=>"river",
            "backgroundColor"=>nil,
            "backgroundImage"=>"https://d2a2fgsv6pobq6.cloudfront.net/images/backgrounds/river/full.jpg",
            "backgroundImageScaled"=>[
                {
                    "width"=>2400,
                    "height"=>1600,
                    "url"=>"https://d2a2fgsv6pobq6.cloudfront.net/images/backgrounds/river/large.jpg"
                },
                {
                    "width"=>1024,
                    "height"=>683,
                    "url"=>"https://d2a2fgsv6pobq6.cloudfront.net/images/backgrounds/river/medium.jpg"
                },
                {
                    "width"=>320,
                    "height"=>213,
                    "url"=>"https://d2a2fgsv6pobq6.cloudfront.net/images/backgrounds/river/small.jpg"
                }
            ],
            "backgroundTile"=>false,
            "backgroundBrightness"=>"dark",
            "canBePublic"=>true,
            "canBeOrg"=>true,
            "canBePrivate"=>true,
            "canInvite"=>true
        },
        "labelNames"=>{
            "green"=>"",
            "yellow"=>"Тесты",
            "orange"=>"frontend",
            "red"=>"bugs",
            "purple"=>"инфраструктура",
            "blue"=>"backend",
            "sky"=>"проектирование",
            "lime"=>"гипотеза",
            "pink"=>"",
            "black"=>""
        }
    },
    "feature"=>{

    }
}

P.S。 我们使用 Scrum,现在使用 Trello。我们在 trello 中为每个功能创建一张卡片。我们创建 git 个带前缀的分支,包含特征编号(f231_feature 等)。当我推送更改时,我想自动向 trello 卡片添加评论。

我们为每个功能使用整数,但 trello 卡 ID 太长,我们无法使用它。 Trello 卡片有整数代码(等 URL https://trello.com/c/2zrZE33/231-trello 中的 231),但这些代码在一个面板中是唯一的,对我们来说不是,因为我们将完成的卡片移动到另一个面板。

我收到了 Trello 团队的答复:

如果您的 webhook 被设置为在其 model 上监视一个板,那么您应该在您的 webhook POST 上收到以下信息:

 "card": {
                "shortLink": "wKiG3zv8",
                "idShort": 42,
                "name": "I'm a new card",
                "id": "55478b893a73ba2e400381c6"
            }

在这种情况下,shortLink 选项是为 Trello 保存功能编号的最佳方式——通过转到 https://www.trello.com/c/[the shortLink 的值],您可以拉起卡片。或者,您可以使用卡的完整 "id",也可以在 POST 中提供。这两个选项都可以作为卡片在 Trello 中的唯一标识符。

该信息包含在 "data" 数组中,而不是 "model" 数组中。有关已采取的操作的信息,那将是查看的最佳位置。

我检查我的脚本并发现错误。 Trello webhook POST 请求实际上不仅发送 model 对象而且发送 action 信息,包括关于新卡的信息。