@devartsite/whm

Webhook cli manager

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
@devartsite/whm
001.2.23 years ago3 years agoMinified + gzip package size for @devartsite/whm in KB

Readme

WHM (WebHookManager) ========================

npm npm


npm version GitHub package.json version Standard - JavaScript Style Guide GitHub top language GitHub code size in bytes GitHub repo size Libraries.io dependency status for latest release, scoped npm package npm GitHub commit activity npm collaborators NPM

discord GitHub issues Twitter Follow GitHub followers GitHub stars GitHub watchers GitHub forks

Webhookmanager is a manager of webhook in cli
Easy to use, it will allow you to send notifications on Discord or your phone with Macrodroid

Features

Add a webhook (Discord, Macrodroid) Delete a webhook View infos of webhook by name View list of webhooks Execute webook with message

Installation

To install whm :
npm install -g @devartsite/whm
And run this command to see help :
whm -h

Usage

To add a webhook (-d for discord or -m for macrodroid):
``` sh
whm add <name> <url> <option>
```
To delete a webhook:
``` sh
whm del <name>
```
To get info of webhook by name:
``` sh
whm info <name>
```
To list your webhooks:
``` sh
whm list
```
To execute a webhook:
``` sh
whm exec <name> <message>
```
Options (-d --date to attach a new date to the message, -w --who to find out who did what):
* date option:
  ``` sh
  whm exec mywebhook "my message at {{date}} with date on middle" -d
  ```
  ``` sh
  whm exec mywebhook "my message with date on end of message, at " -d
  ```
* who option:
  ``` sh
  whm exec mywebhook "my message by {{who}} with who on middle" -w
  ```
  ``` sh
  whm exec mywebhook "my message with who on end of message, at " -w
  ```

Pratical usage

If you need to receive a notification on a webook when someone connects to your server in ssh, you can use the example below.
Example 1 (Discord webook)
First you do add your webhook
``` sh
whm add mywebhook https://discordapp.com/api/webhooks/<channelid>/<webhookid> -d
```
Now in the user file ".bashrc" add this line:
``` bash
whm exec mywebhook "Connection shell to example by {{who}} at {{date}}" -w -d
```
Now when someone connects to shell example you receive this notification on your server Discord
Example 2 (Macrodroid webook)
WARNING!! You have to add your macrodroid url in tiny url else if you don't so that, your webhook will not work
________

First you do add your webhook
``` sh
whm add mywebhook https://tinyurl.com/<id>/<secret> -m
```
Now in the user file ".bashrc" add this line:
``` bash
whm exec mywebhook "Connection shell to example by {{who}} at {{date}}" -w -d
```
Now when someone connects to shell example you receive this notification on your Device where you have previously configured this webhook in Macrodroid

Todo list

API to use this module easily by importing it into a project Possibility to send custom data
Maybe more ...