I able to create webhook but struggling to get post data of that url

rajmamidala November 5, 2017

Here is the registred webhook.

{
"id": "59fb6f025f9638a2b081201a",
"description": "Trello Webhook Server",
"idModel": "59edd17a48fa712db6465109",
"callbackURL": "https://gitbub-trello-webhook.firebaseapp.com/trelloUserWebhook",
"active": true
}

When i try to hit the callback url in the browser, I get empty output.

{}

I am really trying hard  from 2 weeks to get this working please some one help me on this.

Below is the way i am trying to get posted data:

//Code to get user activity on board.

app.get("/trelloUserWebhook", (req, res, next) => {

res.send(req.body);

});

1 answer

0 votes
bentley
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 7, 2017

The callback URL you provided when creating the webhook will be the URL that Trello sends a request to with updates whenever an action occurs related to the object representing by the idModel.

Assuming that 59edd17a48fa712db6465109 is the ID of a user that you want to receive updates about, you can change your server code to:

app.use("/trelloUserWebhook", (reqresnext=> {
  console.log(JSON.stringify(req.body, null, 2));
  res.sendStatus(200);
});

Now, whenever an action occurs for that user, Trello will POST a request to that URL and the request body will contain data about what action occurred.

You can also get all of the recent actions for the user by making a request to Trello's 1/members/{memberID}/actions API resource:

https://api.trello.com/members/59edd17a48fa712db6465109/actions?key={yourAPIkey}&token={yourAPItoken}

The difference between these two setups is that in the former, Trello is notifying you of updates and in the latter you are asking (also known as polling) Trello for the most recent information.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events