Interpreting webhook response from trello

I was observing json response from a webhook on two different actions i.e commentCard and deleteComment. The json response were different for both the actions.

object[“action”][“data”] for commentCard action has 4 object nested in it and object[“action”][“data”] for deleteComment action has 3 actions in it. So observing this i have concluded that different actions have different object[“action”][“data”] format.

Is there some way to know possible json response of each possible action? or i have to just brute force?

Will the inner structure of a json response will always be the same for an action? Given the fact that contents will be different for different scenarios.

Also in deleteComment action i have object[“action”][“data”][“action”]["id], what exactly is this ID?

object		{2}
 	model		{12}
	action		{8}
             id	:	5e222dfb3b08b52b1820c70a
             idMemberCreator	:	6e12d235cc3d081fab183d5e
 	   data		{3}
          	action		{1}
                        id	:	5e20856481b08529b6237bae

The id is the id of the action. Every action like updating a card description, changing a label or creating a comment has its own id.

For most cases that isn’t useful for anything else, but when the action is createComment the action is also the id of the comment itself.

Because of that in your deleteComment webhook action.id is the id of the deletion action, but action.data.action.id is the id of the comment being deleted.

2 Likes

Check out: https://developers.trello.com/reference#action-types

If you scroll down to the section Actions in Webhooks, you’ll find a link to a Google Sheet that breaks down the types of objects you’ll receive for each kind of action.

1 Like