Posting something to Slack from the command line is pretty easy with an incoming webhook, e.g.
curl -X POST -H 'Content-type: application/json' --data '{"text":"Hello, World!"}' https://hooks.slack.com/services/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
but posting multiline content with syntax highlighting is a bit more tricky. With Slackcat it’s still pretty easy, though. In order to post e.g. the output of git status, you can just use
git status | slackcat --filetype shell --filename "git status" --channel general
which will look like this in Slack
For some ecommerce websites we’re monitoring file changes with git status, so this comes in very handy.
Here’s a demo of how the usage looks like on the command line:
If you’re looking for more awesome Slack related things, here’s a great curated list. If you know of any other great command line tools in relation to Slack, please leave a comment.
Schreibe einen Kommentar