webchat-cli v1.4.1
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-cliGeneral Commands
Init
Sets controlled webchat api url
$ webchat initLogin
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 loginHistory
The CLI stores the history of write operations. This history may be displayed using:
$ webchat historyThe 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-lsSet Valve Config
Set Business Hours Probability
$ webchat valve-set businessHours 0.2Override Current Value
$ webchat valve-set valve.overrideCurrent " -1"Delete Valve Config
Delete Business Hours probability
$ webchat valve-delete valve.businessHoursChannel Operations
Here are just some examples, see webchat help for full reference:
Create Channel
$ webchat channel-add CHANNEL_NAMEAdds 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 CHANNELAdds the channel CHANNEL and links all applications but ge_bot_error to this
channel.
Modify Channel
$ webchat channel-mod -w +http://localhost:3000 CHANNELAdds the whitelisted origin http://localhost:3000 to the channel CHANNEL.
Delete Channel
$ webchat channel-rm CHANNELApplication Operations
Create Application
$ webchat app-add -w http://localhost:8030/APP -c CHANNEL_1,CHANNEL_2 APPCreates 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 APPRemoves the application APP from the channels CHANNEL_1 and CHANNEL_2.
Delete Application
$ webchat app-rm APPDeletes the application APP.
Setting up for development (locally)
$ git clone
$ cd webchat-cli
$ npm install
$ node ./bin/webchat.js