Public | Automated Build

Last pushed: 2 months ago
Short Description
Send messages to a Slack channel from the command line
Full Description

Send a Slack message

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.

Build

docker build --rm --force-rm -t suhlig/slack-message .

Run

  1. Source this Bash function:

     slack-message(){
       docker run                  \
           --interactive           \
           --tty                   \
           --rm                    \
           --env SLACK_WEBHOOK_URL \
         suhlig/slack-message      \
         "$@"
     }
    
  2. Run it:

     slack-message --help
    

Example

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.

Acknowledgements

Docker Pull Command
Owner
suhlig
Source Repository