@cs-chatbots/webchat-cli
v2.12.0
Published
CLI for Webchat
Downloads
3
Readme
webchat-cli
CLI tool for webchat. Can be used for the management of valve, application and channels.
Install webchat CLI
$ sudo npm i -g webchat-cli
General Commands
Init
Sets controlled webchat api url
$ webchat init
Login
A login is needed for the valve related write operations and all
channel/application operations. The command asks for a username and a password
and after a successful authorization stores an access token received from the
API locally (OAuth2). The default validity of the token is one hour. There is
a different user for valve (my_username
) and for channels/applications
(crud
).
$ webchat login
History
The CLI stores the history of write operations. This history may be displayed using:
$ webchat history
The commands are stored in the history in a normlized form (e. g. even if we use an interactive version of the command the command stored in the history is the non-interactive one with the same effect).
Valve operations
Get current valve config
$ webchat valve-ls
Set Valve Config
Set Business Hours Probability
$ webchat valve-set businessHours 0.2
Override Current Value
$ webchat valve-set valve.overrideCurrent " -1"
Delete Valve Config
Delete Business Hours probability
$ webchat valve-delete valve.businessHours
Channel Operations
Here are just some examples, see webchat help
for full reference:
Create Channel
$ webchat channel-add CHANNEL_NAME
Adds a channel. The CLI will ask for the primary application id, whitelisted origins and applications linked to the channel.
$ webchat channel-add -a !ge_bot_error CHANNEL
Adds the channel CHANNEL and links all applications but ge_bot_error
to this
channel.
Modify Channel
$ webchat channel-mod -w +http://localhost:3000 CHANNEL
Adds the whitelisted origin http://localhost:3000
to the channel CHANNEL.
Attach To Channel Own Errorbot
$ webchat channel-mod -r ge_bot_error-onb CHANNEL
Adds new errorbot application to the channel CHANNEL.
Delete Channel
$ webchat channel-rm CHANNEL
Application Operations
Create Application
$ webchat app-add -w http://localhost:8030/APP -c CHANNEL_1,CHANNEL_2 APP
Creates the application APP with the webhook http://localhost:8030/APP
and
links it to the channels CHANNEL_1 and CHANNEL_2.
Modify Application
Here are just some examples, see webchat help
for full reference:
$ webchat app-mod -c _CHANNEL_1,CHANNEL_2 APP
Removes the application APP from the channels CHANNEL_1 and CHANNEL_2.
Delete Application
$ webchat app-rm APP
Deletes the application APP.
Setting up for development (locally)
$ git clone
$ cd webchat-cli
$ npm install
$ node ./bin/webchat.js