Skip to content

Instantly share code, notes, and snippets.

@revmischa
Created December 16, 2014 21:02
Show Gist options
  • Save revmischa/72134db9389c8c1ba439 to your computer and use it in GitHub Desktop.
Save revmischa/72134db9389c8c1ba439 to your computer and use it in GitHub Desktop.
#!/bin/bash
# usage: bin/slackmsg "blah blah blah" => #engineering
# escape message for JSON:
MSG=$(printf '%q' $*)
echo $MSG
PAYLOAD="payload={\"channel\": \"#engineering\", \"username\": \"engbot\", \"text\": \"$MSG\", \"icon_emoji\": \":shipit:\"}"
echo $PAYLOAD
curl -X POST --data-urlencode "$PAYLOAD" https://hooks.slack.com/services/XXXXX
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment