Push Webhook only sends an empty array for Payload

In BitBucket I setup a Push webhook. On the receiving side I log the data sent in the post. With a webhook I always get an empty POST array. No Payload.

If I do exactly the same thing using the deprecated Push Services it works fine. So I know I'm triggering it correctly. I even tried leaving both the Service and the WebHook active at the same time. Still blank from the WebHook. Any ideas why?

2 answers

1 accepted

2 votes

Something like this should work.

$inputJSON = file_get_contents('php://input');
$input= json_decode( $inputJSON, TRUE ); //convert JSON into array



That did it. Thanks! Now I find that what is sent doesn't have any of the information I need like what's being pushed. Mutter mutter.

That is coming soon.

0 vote

What are you using to consume the webhook payload?

At this point I'm just logging the POST info to a log file to keep it simple. PHP script <?php error_log(print_r($_REQUEST, true), 3, 'logfile.txt'); Can't get much simpler. Return the following depenfing on whether WebHoook or Service. So it's the right trigger. Array //webook ( ) Array //service ( [payload] => {"repository": {"website": "", "fork": false, "name": "DGC Ticker", "scm": "git", "owner": "arkytn", "absolute_url": "/arkytn/dgc-ticker/", "slug": "dgc-ticker", "is_private": true}, "truncated": false, "commits": [{"node": "8257c2e8e27c", "files": [{"type": "modified", "file": "assets/cmb2/readme.txt"}], "raw_author": "arkytn <abaileytn@gmail.com>", "utctimestamp": "2015-08-06 14:46:16+00:00", "author": "arkytn", "timestamp": "2015-08-06 16:46:16", "raw_node": "8257c2e8e27ca634b197c2e86c8b88588e0159f4", "parents": ["2546922f721e"], "branch": "master", "message": "Deploy test\n", "revision": null, "size": -1}], "canon_url": "https://bitbucket.org";, "user": "arkytn"} )

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

171 views 20 8
Join discussion

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