Skip to content

Instantly share code, notes, and snippets.

What would you like to do?

This is a short article on how we integrate stash and slack in openmind

First of all i assume you have:

  • a working stash installation
  • a repository you to notify slack on pushes
  • stash user with administration priviledges
  • full access to the server (linux) where stash is installed on
  • a team configured on slack
  • slack user with administration priviledges

Prepare your stash server

Access your stash server and create a script

vim /home/appuser/

Paste the following:


echo "Notify commits to slack"

payload="payload={\"channel\":\"$channel\",\"username\":\"webhookbot\",\"text\":\"Push on ${STASH_REPO_NAME} by ${STASH_USER_NAME} <$STASH_USER_EMAIL>\",\"icon_emoji\":\"$icon\",\"attachments\":["
while read from_ref to_ref ref_name; do
  message=`git log --format=%B -n 1 ${to_ref}`
  title="[$STASH_REPO_NAME:$ref_name] <$3/commits/$to_ref|$to_ref>: $message"

curl -X POST --data-urlencode "$payload" $1

and save.

Make it executable

chmod +x /home/appuser/

Configure Slack

  1. Access to slack: (replace YOUR_TEAM with your team name)
  2. Select "Incoming WebHooks"
  3. Choose a channel from drop-down and click "Add incoming WebHook"
  4. You have a new webhook configured! Copy the URL under "Your Unique Webhook URL"

Configure Stash

  1. Access to stash web interface
  2. Go to your repository
  3. Click on Settings
  4. Click on Hooks
  5. Click on "Add Hook" button and then on "Search"
  6. Search for "External Hooks" and click "Install"
  7. Once installed, go back to Hooks page in your repository
  8. Click on "Enable" on the "External Post Receive Hook" row (not pre-receive)
  9. Put the full path to the executable script in "Executable" field: /home/appuser/
  10. Fill "Positional Parameters" with:
    • 1st line: Web hook url you copied at last point in previous paragraph
    • 2nd line: Channel name (#general)
    • 3rd line: full path to your web interface repository page (without trailing slash)
    • 4th line: emoji for your notification (🚀)

Everything should work! Try to push something!


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.