Created
October 31, 2017 15:22
-
-
Save dfreniche/52e0fdb19c1d87761db346254999c9ca to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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