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

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.

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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

1,745 views 1 5
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