-
-
Save JoeyBurzynski/d279d3ec18595dde83613ec7b5094432 to your computer and use it in GitHub Desktop.
Slack incoming webhooks from bash (send notification to slack from shell)
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
read -d '' SLACK_PAYLOAD_DATA << EOF | |
{ | |
"channel": "#channel", | |
"username": "Bot", | |
"text": "Message by _$(id -un)@$(hostname -f)_.", | |
"icon_emoji": ":poop:", | |
"attachments": [ | |
{ | |
"fields": [ | |
{ | |
"title": "User", | |
"value": "$(id -un)", | |
"short": true | |
}, | |
{ | |
"title": "Host", | |
"value": "$(hostname -f)", | |
"short": true | |
} | |
] | |
} | |
] | |
} | |
EOF | |
SLACK_COMMAND="curl -X POST --data-urlencode 'payload=${SLACK_PAYLOAD_DATA}' https://hooks.slack.com/services/XXX/QQQ/WWW" | |
eval ${SLACK_COMMAND} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment