Skip to content

Instantly share code, notes, and snippets.

@jrobinsonc
Last active April 14, 2020 23:06
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 jrobinsonc/4258ce2db7446d686966cc451c80075f to your computer and use it in GitHub Desktop.
Save jrobinsonc/4258ce2db7446d686966cc451c80075f to your computer and use it in GitHub Desktop.
#!/bin/bash
# Usage
# ./slack <channel> <message>
# ./slack @jrobinson "Test message for a user"
# ./slack #general "Test message for a channel"
CHANNEL=$1
MSG=$2
TOKEN=xoxb...
curl \
-X POST -d "text=$MSG" -d "channel=$CHANNEL" \
"https://slack.com/api/chat.postMessage?token=$TOKEN&pretty=1&as_user=true" 2>/dev/null 1>/dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment