Send messages to a Slack channel from the command line
1.3K
This is an executable script for sending messages to a Slack channel from the command line. It wraps the slack-notifier gem. It is also available as Docker image.
docker build --rm --force-rm -t suhlig/slack-message .
Source this Bash function:
slack-message(){
docker run \
--interactive \
--tty \
--rm \
--env SLACK_WEBHOOK_URL \
suhlig/slack-message \
"$@"
}
Run it:
slack-message --help
This command builds a colored Slack message with a title and an image of a random cat (courtesy of thecatapi.com):
# grab a random cat URL
random_cat=$(curl --write-out "%{url_effective}\n" --head --location --silent --show-error --output /dev/null http://thecatapi.com/api/images/get)
# send a Slack message with a cat
slack-message --color 'e86537' --title "Cat #$RANDOM" --image_url "$random_cat" Please have a look at this cute cat.
Content type
Image
Digest
Size
80.3 MB
Last updated
over 7 years ago
docker pull suhlig/slack-message