Bitbucket webhook not sending payload

I’m new to webhooks and trying to do automated deployment to my website whenever I push to my repo.

I set up the webhook on my bitbucket repo to a URL which contains a simple php script:

if(isset($_POST['payload'])) {
    logMsg("Got stuff\n");
} else {
    logMsg("No stuff\n");

After I push to my repo, the webhook will request the script fine but no payload is sent. My log file will always say “No stuff”.

What am I missing?

  • Composer specifying 'in development' packages?
  • PHP create core code to spread between different projects
  • How to upload changes from development branch to remote branch on GIT?
  • Force composer to download git repo instead of zip
  • Is GIT a good solution for large projects like Laravel or projects using Smarty Templating
  • Deploying Fb app on Heroku
  • Deploy a PHP project from Git to a server that does not have Git installed
  • php run git got “ssh Permission denied”
  • 2 Solutions collect form web for “Bitbucket webhook not sending payload”

    The new Bitbucket webhooks send the payload in the request body, not in the request headers as the previous “Services” did.
    So to access the payload you must read the request body like this :

    $payload = file_get_contents('php://input');

    or like that:

    $payload = stream_get_contents(STDIN);

    Et voilà !

    BitBucket webhook changed recently (June 2015).

    The new event payload doc refers to a tutorial page whose example does not test for payload.
    See atlassianlabs/webhook-listener and its (python, but the idea would be the same for php)

    @app.route('/webhook', methods=['GET', 'POST'])
    def tracking():  
        if request.method == 'POST':
            data = request.get_json()

    It tries directly to decode json. If that json data were to be empty,… that would mean no payload.

    Git Baby is a git and github fan, let's start git clone.