jerik
jerik

Reputation: 5767

I do not receive any payload from trello when my webhook is triggered

I created a webhook in trello for a list:

curl -X POST -H "Content-Type: application/json" \
https://api.trello.com/1/tokens/$TRELLO_TOKEN/webhooks/ \
-d '{
  "key": "$TRELLO_API_KEY",
  "callbackURL": "https://at.foobar.com/trello-whook.php",
  "idModel":"5d9511856b7586142414762b",
  "description": "My first webhook"  
}'

As answer I got:

{"id":"5dc9cded49bf251341c6d32c","description":"My first webhook","idModel":"5d9511856b7586142414762b","callbackURL":"https://at.foobar.com/trello-whook.php","active":true,"consecutiveFailures":0,"firstConsecutiveFailDate":null}%

My webhook get triggered when I add/delete cards on this list. When I understood the documentation correct, I should get a HTTP POST with JSON to my webhook. But I do not see any payload in my log file...

Here is my trello-webhook.php code:

<?php
ini_set( "log_errors", 1);
ini_set( "error_log", "/var/log/trello-scripts.log");
error_log(  "trello-whook was called" );
$output = print_r( $_POST, true );
error_log( $output );
?>

And here is the output of my /var/log/trello-scripts.log:

[11-Nov-2019 21:25:54 UTC] trello-whook was called
[11-Nov-2019 21:25:54 UTC] Array
(
)

Where do I have a missunderstanding? How do I get the trello JSON?

Upvotes: 1

Views: 409

Answers (1)

Chris
Chris

Reputation: 4728

You should be able to pick up the payload by using:

$data = file_get_contents("php://input");

Upvotes: 1

Related Questions