Trello Webhook provides malformed Json?

André Marques October 16, 2017

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

0 votes
Oscar Triscon
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 16, 2017

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?

André Marques October 18, 2017

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 😊

Oscar Triscon
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 19, 2017

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
TAGS
AUG Leaders

Atlassian Community Events