Sign inSign up

suhlig/slack-message

By suhlig

•Updated over 7 years ago

Send messages to a Slack channel from the command line

Image
0

1.3K

suhlig/slack-message repository overview

⁠Send a Slack message

Docker Automated build

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

Tag summary

Content type

Image

Digest

Size

80.3 MB

Last updated

over 7 years ago

docker pull suhlig/slack-message