Skip to content

Instantly share code, notes, and snippets.

@nuex
Created January 9, 2015 05:28
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 nuex/638963c1410109c47c47 to your computer and use it in GitHub Desktop.
Save nuex/638963c1410109c47c47 to your computer and use it in GitHub Desktop.
Say something in a Slack channel without being there.
#!/bin/sh
#
# Say something in a slack channel.
#
# Usage:
#
# standup 't: doing a thing'
#
# Finding Values:
#
# Use the API docs to find values that you need:
#
# * Token: https://api.slack.com/web
# * Channel ids: https://api.slack.com/methods/channels.list/test
#
# Other needed variables:
#
# `icon_url` is a URL for an icon image, such as a Gravatar.
# `username` the username of the user posting the message
#
curl -X POST https://slack.com/api/chat.postMessage \
--data-urlencode "text=$@" \
-d token=$SLACK_TOKEN \
-d channel=$SLACK_CHANNEL_ID \
-d username=$SLACK_USERNAME \
-d icon_url=$SLACK_ICON_URL \
-d pretty=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment