Skip to content

Instantly share code, notes, and snippets.

@d-shimizu
Last active August 18, 2020 12:56
Show Gist options
  • Save d-shimizu/34687af7f764c462d8293283c7be81d2 to your computer and use it in GitHub Desktop.
Save d-shimizu/34687af7f764c462d8293283c7be81d2 to your computer and use it in GitHub Desktop.
SlackのIncoming Webhooksを使って外部から通知するためのシェルスクリプトのサンプル ref: https://qiita.com/d-shimizu/items/07eee4bc876ec508e66c
$ ./slack-notify.sh test
#!/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