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:

  • Pull specific branch from git
  • How to specify version with git smart commits?
  • How much space can your BitBucket account have?
  • Can GitHub/BitBucket be made as your local repository?
  • How can I push a shallow update? Set receive.shallowUpdate on remote?
  • Whats the Proper usage of .gitattributes with merge=ours
  • 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?

  • Having multiple Git repositories
  • How can I go back and test where something broke?
  • Ubuntu Linux git gc says error: failed to run repack
  • How to commit project in Unreal Engine to the github
  • Exceptions in .gitignore
  • Git asking for password from command line
  • 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.