Skip to content

andrewl/slack_notify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Slack Notify

Why?

This simple script enables you to post a message into slack from the command line without the need to install a Ruby, Node, PHP application with their boatload of dependencies. It's not magic!

Install

  1. Create an Incoming Webhook on your Slack channel (https://api.slack.com/incoming-webhooks)

  2. (Optional) Copy slack_notify.sh to your path.

Usage

Set the environment variable SLACK_WEBHOOK_URL to the url of your Incoming Webhook. Optionally set the environment variables SLACK_CHANNEL and SLACK_USERNAME to the channel and username of the channel to post to and username to post as.

The message to send is passed as the parameter to the script.

Example

Sending "Hello, Slack"

SLACK_WEBHOOK_URL="https://hooks.slack.com/services/AB12CD34EF/56GH78IJ90/KLMN9876opqr5432stu" slack_notify.sh "Hello, Slack"

Sending "Hello random Channel" to the channel 'random' with the username 'Ran Dom'

SLACK_CHANNEL="random" SLACK_USERNAME="Ran Dom" SLACK_WEBHOOK_URL="https://hooks.slack.com/services/AB12CD34EF/56GH78IJ90/KLMN9876opqr5432stu" slack_notify.sh "Hello random Channel"

Sending the amount of free space on the boot partition

FREE_SPACE=`df -h --output=used /boot | tail -n 1` SLACK_WEBHOOK_URL="https://hooks.slack.com/services/AB12CD34EF/56GH78IJ90/KLMN9876opqr5432stu" slack_notify.sh "Boot partition has $FREESPACE free space"

About

Enables pushing notifications into slack from the commandline using only bash & curl

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages