Skip to content

Instantly share code, notes, and snippets.

@dfreniche
Created October 31, 2017 15:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dfreniche/52e0fdb19c1d87761db346254999c9ca to your computer and use it in GitHub Desktop.
Save dfreniche/52e0fdb19c1d87761db346254999c9ca to your computer and use it in GitHub Desktop.
#!/bin/bash
# copied from http://blog.pragbits.com/it/2015/02/09/slack-notifications-via-curl/
# format message as a code block ```${msg}```
# SLACK_MESSAGE="\`\`\`$1\`\`\`"
SLACK_MESSAGE="$1"
SLACK_URL=https://hooks.slack.com/services/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
case "$2" in
INFO)
SLACK_ICON=':slack:'
;;
WARNING)
SLACK_ICON=':warning:'
;;
ERROR)
SLACK_ICON=':bangbang:'
;;
*)
SLACK_ICON=':slack:'
;;
esac
curl -X POST --data "payload={\"text\": \"${SLACK_ICON} ${SLACK_MESSAGE}\"}" ${SLACK_URL}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment