Slackpipe allows you to easily post messages to Slack from the command line. You might for example use this to post the results of a nightly script to a Slack channel.
You can provide the message to post as a command line argument or you can just pipe the output of another program to it.
$ gem install slackpipe
$ slackpipe -m "hello world"
$ echo "hello world" | slackpipe
$ slackpipe -m "hello world" -c "#general" -f "my robot" -i ":ghost:" -u https://hooks.slack.com/services/ABCDEFGHIJKLMNOPQRSTUVWX`
- You should first Add an Incoming WebHook Configuration on Slack's website and get the
Webhook URLthey provide for it. - Next set the
SLACKPIPE_URLenvironment variable to theWebhook URLthat Slack assigns you.export SLACKPIPE_URL=https://hooks.slack.com/services/ABCDEFGHIJKLMNOPQRSTUVWX
- If you prefer not using an environment variable you can also provide the URL as a command line option using
--urlor-u
SLACKPIPE_URLor--urlor-u- (Required) Your Slack IncomingWebHook URL(provided by Slack)SLACKPIPE_CHANNELor--channelor-c- (Optional) The channel to post your message to (e.g.#generalor@jane)SLACKPIPE_USERNAMEor--fromor-f- (Optional) The username that the message should come from (e.g.my robot)SLACKPIPE_ICONor--iconor-i- (Optional) The icon emoji to use for the message icon (e.g.:ghost:)