Skip to content

πŸŽ‰ CLI to send messages to Slack by using their lightweight incoming webhooks API

License

Notifications You must be signed in to change notification settings

anthonyringoet/node-slack-webhook-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

97 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

slack-webhook-cli

js-standard-style

A command line interface to send messages to Slack by using their lightweight incoming webhooks API. You never need to authenticate as an actual Slack user to use this interface.

Installation

$ npm i slack-webhook-cli -g
# this should make the `slack-hook` command globally available

Configuration

Configuration can be handled using environment variables or command line options.

From least to most heavy for overruling eachother:

  • Internal defaults
  • Environment variables
    • SLACK_WEBHOOK_CLI_URL
    • SLACK_WEBHOOK_CLI_CHANNEL
    • SLACK_WEBHOOK_CLI_EMOJI
    • SLACK_WEBHOOK_CLI_USERNAME
  • Command line options
    • -m: message required when sending
    • -w: webhook url
    • -c: channel
    • -e: emoji
    • -u: username

Setting environment variables

You can use environment variables for your default options.

$ export SLACK_WEBHOOK_CLI_USERNAME=sl4ckb0t

Commands

setup

Verifies your setup and shows your active options given your input.

$ slack-hook setup

# actual example
$ slack-hook setup -c "#foobar" -e ":panda_face:"

# With the current input your resulting options are:
# url: 'https://hooks.slack.com/services/sdfq51dsf1s251/561sdfq/sdf51q51sdf20sdf1ds1f5'
# channel: '#foobar'
# icon_emoji: ':panda_face:'
# username: 'slack-webhook-bot'

send

$ slack-hook send -m "Something happened" -c "#beep"
# Sent: "Something happened" to #beep

About

πŸŽ‰ CLI to send messages to Slack by using their lightweight incoming webhooks API

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published