1.0.1 • Published 10 years ago
slack-webhook-cli v1.0.1
slack-webhook-cli
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 availableConfiguration
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_URLSLACK_WEBHOOK_CLI_CHANNELSLACK_WEBHOOK_CLI_EMOJISLACK_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=sl4ckb0tCommands
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