Created
April 6, 2017 06:40
-
-
Save madcoda/9a57530edfbe32a9df4ce113312fa768 to your computer and use it in GitHub Desktop.
Slack Webhook bash script
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 | |
CHANNEL="#general" | |
USERNAME="MyBot" | |
EMOJI=":ghost:" | |
MSG=$1 | |
PAYLOAD="payload={\"channel\": \"$CHANNEL\", \"username\": \"$USERNAME\", \"text\": \"$MSG\", \"icon_emoji\": \"$EMOJI\"}" | |
HOOK=https://hooks.slack.com/services/T00000000/XXXXYYYZ/XXXXXXXX | |
curl -X POST --data-urlencode "$PAYLOAD" "$HOOK" |
How might one attach an image link in here?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Chang MSG to $* to get the full line passed instead of just the first word