Skip to content

theopenconversationkit/tock-node-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tock-node-example

Chatbot sample using Tock and stories written in Javascript running on Nodejs (see tock-node).

Bot setup

  • Create a bot application on a Tock platform (Bot API mode), such as the Tock demo public instance.

  • Add a Web connector to the bot and copy the API key.

Node setup

  • In index.js (L11) replace the API key.

  • If necessary, declare the Tock platform host, port and WebSocket protocol to use. Default values are demo-bot.tock.ai (the public demo), 443 and wss (secured port/protocol).

Tock demo example:

const bot = new Bot('<YOUR_API_KEY_HERE>');

Local instance example:

const bot = new Bot('<YOUR_API_KEY_HERE>', 'localhost', '8080', 'ws');

NOTE: Don't prefix the host with http:// or https://. Don't suffix it with a relative path or the Web connector path.

Run

  • Run tock-node-example from root folder:

Using YARN:

yarn install
yarn start

NPM alternative:

npm install
npm start
  • When Connection established, Tock Nodejs stories are ready to test.

About

Sample code for a chatbot coded using Tock and tock-js

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published