Slack notification / web-hook for Pipelines

Issue #12826 resolved
Mike Over
created an issue

Please add the ability to select a webhook for pipeline build status (specifically for Slack integration) for notifications when a build succeeds, fails, etc.

Comments (16)

  1. Phil Manser

    @Robert Mao that is a good point. It shouldn't be hard to handle notification directly from your build scripts. The one downside to this though is you would have to build in handling of reporting the success/failure directly instead of having bitbucket do it for you automatically. Still though, your suggestion would be a workaround for the time being.

  2. Valentin Rouet

    It is indeed possible to do it from the inside, I've been using a simple Bash script:

    MESSAGE="Deployed successfully"
    if [ $1 = "failed-build" ]; then
        MESSAGE="Building failed!"
    elif [ $1 = "failed-deploy" ]; then
        MESSAGE="Deploying failed!"
    curl -X POST --data-urlencode 'payload={"text": "['"$BITBUCKET_REPO_SLUG"'/'"$BITBUCKET_BRANCH"'] '"$MESSAGE"'"}' $SLACK_WEBHOOK_CLI_URL

    And then in the .yml:

        - gulp build || (c=$?; sh failed-build; $(exit $c))
        - gulp publish || (c=$?; sh failed-deploy; $(exit $c))
        - sh

    But this is not ideal, because it forces every repository to have a copy of this script and the YML is not so clean with the "||" everywhere. Being able to select Pipelines in the triggers of a WebHook would be great:


  3. Joshua Tjhin

    Thanks for the feedback all!

    Just to add, Bitbucket already has a generic web-hook for commit status and since Pipelines uses the commit status API, it should work for Pipelines too.

    As the description specifically mentions Slack and so does most of the discussion for this request, I'll rename the issue to reflect this.

  4. Brent O'Connor

    @xtjhin, This doesn't feel resolved to me. I'm going to try out your snippet, however there is no way to currently just get failed notifications with the official bitbucket slack integration. When you get success and failed notifications, that's a lot of extra noise in your channel, when all you really care about is the builds that fail.

  5. chrsmrtn

    I too am interested in this solution. Particularly i'd like to lighten my email inbox load and keep our dev team notifications in our chosen slack channel. Looking forward to an update, Cheers!

  6. Log in to comment