Last active
August 18, 2020 12:56
-
-
Save d-shimizu/34687af7f764c462d8293283c7be81d2 to your computer and use it in GitHub Desktop.
SlackのIncoming Webhooksを使って外部から通知するためのシェルスクリプトのサンプル ref: https://qiita.com/d-shimizu/items/07eee4bc876ec508e66c
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
$ ./slack-notify.sh test |
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 | |
URL="https://hooks.slack.com/services/*********/*********/************************" | |
CHANNEL='#test_channel' | |
USERNAME='test-bot' | |
ICON=':sushi:' | |
MESSAGE='```'$@'```' | |
PAYLOAD="payload={ | |
\"channel\": \"${CHANNEL}\", | |
\"username\": \"${USERNAME}\", | |
\"icon_emoji\": \"${ICON}\", | |
\"text\": \"${HEAD}${MESSAGE}\" | |
}" | |
curl -s -S -X POST --data-urlencode "${PAYLOAD}" ${URL} > /dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment