Slackcat is a simple commandline utility to post snippets to Slack.
Quickstart
Installing
Download the latest release for your platform:
OS X
brew install slackcat
or
curl -Lo slackcat https://github.com/vektorlab/slackcat/releases/download/v0.9/slackcat-0.9-darwin-amd64 sudo mv slackcat /usr/local/bin/ sudo chmod +x /usr/local/bin/slackcat
Linux
wget https://github.com/vektorlab/slackcat/releases/download/v0.9/slackcat-0.9-linux-amd64 -O slackcat sudo mv slackcat /usr/local/bin/ sudo chmod +x /usr/local/bin/slackcat
Configuration
Generate a new Slack token with:
slackcat --configure
A new browser window will be opened for you to confirm the request via Slack, and you'll be returned a token.
Create a Slackcat config file and you're ready to go!
echo '<your-slack-token>' > ~/.slackcat
For configuring multiple teams and default channels, see Configuration Guide.
Usage
Pipe command output as a text snippet:
$ echo -e "hi\nthere" | slackcat --channel general --filename hello *slackcat* file hello uploaded to general
Post an existing file:
$ slackcat --channel general /home/user/bot.png *slackcat* file bot.png uploaded to general
Stream input continously as a formatted message:
$ tail -F -n0 /path/to/log | slackcat --channel general --stream *slackcat* posted 5 message lines to general *slackcat* posted 2 message lines to general ...
Options
OptionDescription
--tee, -tPrint stdin to screen before posting
--stream, -sStream messages to Slack continuously instead of uploading a single snippet
--plain, -pWhen streaming, write messages as plain text instead of code blocks
--noopSkip posting file to Slack. Useful for testing
--configureConfigure Slackcat via oauth
--channel, -cSlack channel, group, or user to post to
--filename, -nFilename for upload. Defaults to given filename or current timestamp if reading from stdin.