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:

  • colorful shape on git console during push
  • Importing projects in a BitBucket repository into Eclipse
  • Problem with git push and entering password
  • How do force merge everything i have locally into the remote master?
  • Deleting remote master branch, refused due to being current branch
  • Git add: Why do I have to manually specify which files to commit?
  • 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?

  • How does git GC commit objects inside a tree?
  • Extra modifications coming in commits
  • Merging EMDX (Entity Framework) files with Git
  • Gemfile.lock not checked in - Heroku
  • github who am I? (OSX)
  • How could I display the current git branch name at the top of the page, of my development website?
  • 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 listener.py (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.