Skip to content

Instantly share code, notes, and snippets.

@bgreenlee
Last active August 29, 2015 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bgreenlee/35c9b54263bbf65edb8a to your computer and use it in GitHub Desktop.
Save bgreenlee/35c9b54263bbf65edb8a to your computer and use it in GitHub Desktop.
Post a random gif (with random icon) to a Slack channel
HOOK_URL=https://hooks.slack.com/services/.../.../...
curl -X POST --data-urlencode "payload={\"channel\": \"#random\", \"username\": \"randombot\", \"text\": \"$(curl -s 'http://api.giphy.com/v1/gifs/random?api_key=dc6zaTOxFJmzC' | sed -nE 's/^.*image_original_url":"([^"]+)".*$/\1/gp' | sed 's/\\//g')\", \"icon_emoji\": \":$(curl -s http://www.emoji-cheat-sheet.com/ | sed -n -E 's/^.*<span class="name".*>(.*)<\/span>.*$/\1/gp' | perl -MList::Util -e 'print List::Util::shuffle <>' | head -1):\"}" $HOOK_URL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment