【问题标题】:Unable with a Trello webhook to get infos card after card creation创建卡片后无法使用 Trello webhook 获取信息卡片
【发布时间】:2020-09-09 08:50:11
【问题描述】:

根据 Trello 官方文档 (https://trello.com/c/IMVYmVG1/1458-webhooks),关于 webhook payloads, "当事件触发时,您将收到以下格式的 JSON 有效负载:

{
  action: { ...  }
  model: { ... }
}

但我的 webhook 没有发布任何“动作”属性。

查看我收到的回调参数:

 Started POST "/trello_hooks/doing_callback" for 127.0.0.1 at 2015-02-27 11:29:04 +0100
Processing by TrelloHooksController#doing_callback as HTML
  Parameters: {"model"=>{"id"=>"54efd4339c9ed81c24d64ced", "name"=>"Bureau", "desc"=>"", "descData"=>nil, "closed"=>false, "idOrganization"=>nil, "pinned"=>false, "url"=>"https://trello.com/b/C9Tlh6lw/bureau",
     "shortUrl"=>"https://trello.com/b/C9Tlh6lw", "prefs"=>{"permissionLevel"=>"private", "voting"=>"disabled", "comments"=>"members", "invitations"=>"members", "selfJoin"=>false, "cardCovers"=>true, "cardAging"=>"regular", "calendarFeedEnabled"=>false, "background"=>"blue", "backgroundColor"=>"#0079BF", "backgroundImage"=>nil, 
    "backgroundImageScaled"=>nil, "backgroundTile"=>false, "backgroundBrightness"=>"unknown", "canBePublic"=>true, "canBeOrg"=>true, "canBePrivate"=>true, "canInvite"=>true}, "labelNames"=>{"green"=>"Merci Edgar", "yellow"=>"LBP", "orange"=>"Kismar", "red"=>"WhiteMark", "purple"=>"", "blue"=>"", "sky"=>"", "lime"=>"", "pink"=>"", "black"=>""}},
     "trello_hook"=>{"action"=>"doing_callback", "model"=>{"id"=>"54efd4339c9ed81c24d64ced", "name"=>"Bureau", "desc"=>"", "descData"=>nil, "closed"=>false, "idOrganization"=>nil, "pinned"=>false, "url"=>"https://trello.com/b/C9Tlh6lw/bureau", "shortUrl"=>"https://trello.com/b/C9Tlh6lw", "prefs"=>{"permissionLevel"=>"private", "voting"=>"disabled", "comments"=>"members", "invitations"=>"members", "selfJoin"=>false, "cardCovers"=>true, "cardAging"=>"regular", "calendarFeedEnabled"=>false, "background"=>"blue", "backgroundColor"=>"#0079BF", "backgroundImage"=>nil, "backgroundImageScaled"=>nil, "backgroundTile"=>false, "backgroundBrightness"=>"unknown", "canBePublic"=>true, "canBeOrg"=>true, "canBePrivate"=>true, "canInvite"=>true}, 
    "labelNames"=>{"green"=>"Merci Edgar", "yellow"=>"LBP", "orange"=>"Kismar", "red"=>"WhiteMark", "purple"=>"", "blue"=>"", "sky"=>"", "lime"=>"", "pink"=>"", "black"=>""

       }
      }
     }
    }

有什么想法吗?我敢肯定,读到这个问题的男人或女人都得到了答案:) 帮助我!

请尽快阅读...

【问题讨论】:

  • 如果您使用的是PHP,您可能希望将其添加为标签...
  • 不,我的回调是用 Ruby 编写的。但我认为语言并不重要。问题在于 webhook 通过 HTTP 发送的 json 有效负载似乎不完整。
  • Blimey...我在想 Ruby 但输入 PHP...这将是那些日子之一 :)
  • 你能显示原始的 HTTP 请求吗?如果您的框架使用名为 action 的参数,我不会感到惊讶;这是在不支持这些操作的浏览器中让请求像 PUT/DELETE 一样的常用方法。
  • 是的!谢谢@AaronDufour! Rails 框架吃名为 action 的参数...

标签: ruby payload trello


【解决方案1】:

看起来 Rails 吃了名为 action 的参数,可能是为了方便一些浏览器不支持的 http 动词。

您可以通过request.request_parameters获取action参数。

【讨论】:

  • 是的,就是这样!我之前通过评论回答了你。再次感谢您。
  • @krichtof 你在 Rails 应用程序中解决了这个问题吗?你能告诉我怎么做吗?
  • 使用request.request_parameters!
  • 救命稻草!谢谢!
猜你喜欢
  • 1970-01-01
  • 2014-12-20
  • 2014-02-02
  • 2014-10-30
  • 2012-09-08
  • 1970-01-01
  • 2017-11-02
  • 2012-05-01
  • 2013-12-07
相关资源
最近更新 更多