6

According to the Trello official documentation (https://trello.com/c/IMVYmVG1/1458-webhooks), about webhook payloads, "when an event triggers, you will receive a JSON payload in the following form :

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

But my webhook doesn't post any "action" attribute.

Look at params my callback received :

 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"=>""

       }
      }
     }
    }

Any idea ? I'm sure you the guy or woman who reads this question got the answer :) Help me !

Read you soon...

MSB
  • 854
  • 7
  • 24
krichtof
  • 83
  • 8
  • If you're using `PHP` you might want to add that as a tag... – Jon Clements Feb 27 '15 at 12:54
  • No, my callback is written in Ruby. But I think the language is not important. The problem is about the json payload sent via HTTP by the webhook which seems to be incomplete. – krichtof Feb 27 '15 at 13:00
  • Blimey... I was thinking Ruby but typed PHP... it's going to be one of those days :) – Jon Clements Feb 27 '15 at 13:01
  • Can you show the raw HTTP request? I would not be surprised if your framework eats parameters named `action`; that's a common way to get reqs to act like PUT/DELETE in browsers that don't support those actions. – Aaron Dufour Feb 27 '15 at 22:47
  • Yep ! Thanks @AaronDufour ! Rails framework eats parameters named action... – krichtof Feb 28 '15 at 09:26

1 Answers1

4

It looks like Rails eats parameters named action, probably to facilitate http verbs that some browsers don't support.

You can get at the action parameter via request.request_parameters.

Aaron Dufour
  • 17,288
  • 1
  • 47
  • 69