0

In our repo there is a directory for database config and we are having trouble managing this between team members. I want to set up a webhook that watches for changes within this directory only, and if any changes are detected I want to send a slack notification to team members, so they know to pull the config and import into their local version.

Having looked through all the webhook options on Bitbucket I can't see anything that can facilitate this, although I may have missed something. If there is another way to achieve this I would love to hear it!

Thanks

Chris
  • 1,557
  • 5
  • 19
  • 36
  • 1
    You have to define your hooks for a specific repository like this https://github.com/datagrok/modular-git-hooks/blob/master/hooks - then create a slack app, get the token and to do the REST-full call to that Slack app with the token from your hook. Using git hooks with slack assumes you already have your Slack app created and endpoint with token available to be used. https://api.slack.com/apps – dmitryro May 01 '20 at 02:47
  • This seems like a dup of https://stackoverflow.com/questions/54008049/bitbucket-server-send-email-when-pushing-a-commit-that-modifies-files-inside-a – sdt Aug 23 '23 at 20:50

1 Answers1

0

The bitbucket hook post data typically contains information on files that were part of the commits that were pushed. You can parse that information out and implement your own logic to take the proper action.

Just to give an alternate approach, if you rather not build your own consumption pipeline, consider using LightFlare (I'm the creator) that has out of the box support of consuming Webhooks events from many services (bitbucket included) and notifies you at your choice(s) of destinations (slack / email etc ...).

We have a filter feature currently in alpha that allows users to write their own parsers on top of our channels and runs them on incoming post hook requests. That will solve your issue as well.

Ras
  • 21
  • 2