Skip to content

Instantly share code, notes, and snippets.

@ericboehs
Created March 25, 2022 01:42
Show Gist options
  • Save ericboehs/b5cf46a2f7f0fd090f0890d4ec2358bc to your computer and use it in GitHub Desktop.
Save ericboehs/b5cf46a2f7f0fd090f0890d4ec2358bc to your computer and use it in GitHub Desktop.
slack-notify
#! /usr/bin/env bash
curl -s -X POST -H 'Content-type: application/json' --data "{\"text\":\"${1:-Done}\"}" $BOEHS_SLACK_NOTI_HOOK
@ericboehs
Copy link
Author

ericboehs commented Mar 25, 2022

Install and run:

curl -L https://gist.github.com/ericboehs/b5cf46a2f7f0fd090f0890d4ec2358bc/raw/slack-noti > slack-noti
chmod +x slack-noti
export BOEHS_SLACK_NOTI_HOOK=https://hooks.slack.com/services/T0123ABC456/B0123ABC456/IuAeIoUAeIoUAeIoU
slack-noti "My message"

Slap it on the end of a long running command to be notified when it completes:

scp example.com:~/Movies/The.Matrix.mkv ~/Desktop; slack-noti Whoa

Setup Slack App

  1. Create an App.
  2. Activate Incoming Webhook in your new app.
  3. Install Webhook in your Workspace (same page).
  4. Set BOEHS_SLACK_NOTI_HOOK to be set in your shells (e.g. ~/zshrc.local).

Why not noti?

I couldn't figure it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment