https://github.com/andrewl/slack_notify
Enables pushing notifications into slack from the commandline using only bash & curl
https://github.com/andrewl/slack_notify
shell slack
Last synced: about 1 month ago
JSON representation
Enables pushing notifications into slack from the commandline using only bash & curl
- Host: GitHub
- URL: https://github.com/andrewl/slack_notify
- Owner: andrewl
- Created: 2017-05-22T11:50:48.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-08-29T08:40:18.000Z (almost 9 years ago)
- Last Synced: 2025-08-11T04:28:44.752Z (11 months ago)
- Topics: shell, slack
- Language: Shell
- Size: 1000 Bytes
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
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"