Trello Webhook provides malformed Json?

I've been working on setting up an event notification system for our Discord channel and that requires converting the json that the trello webhook provides the callback URL.

The issue with this is that the json is malformed as it has an additional } after the cards:{} element and another one at the end of the json.

As a result of this I cannot retrieve about half of the data that has been provided including the member that triggered the specific event (If existing)

 

What can I do about this?

1 answer

Hi Andre,

For more than a year, I've been running a system that receives a pretty large amount of webhooks from Trello, and never received malformed JSON from them.

Are you sure there isn't another part of your system that may be corrupting the data received?

It is entirely possible that I'm doing it wrong however I read that in order to get the json I need to use file_get_contents('php:input') (On my phone, excuse typos)

After logging the contents of this I found that the json is malformed. Is there a better method of doing it? 

Thanks for the reply 😊

I'm not familiar with PHP, but json_decode(file_get_contents('php://input')) seems to be the way to do this.

It's hard to figure out what's not working without understanding your setup and code. If you post the JSON you're getting it may help to see what's wrong.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Jan 18, 2018 in Trello

How two Biomed teachers use Trello to execute on Project Lead The Way

This is the first of many Showcases highlighting incredible Atlassian users in Education! And Michael Burke and Josh Clemmer are setting the Showcase bar high. The pair of Biome...

47,401 views 0 9
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you