Coder Social home page Coder Social logo

ronwthompson / watsonsocketbot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kostickm/watsonsocketbot

0.0 1.0 0.0 151 KB

Get started with Watson services in Bluemix by building a simple chatbot.

License: MIT License

JavaScript 84.28% HTML 6.36% CSS 9.36%

watsonsocketbot's Introduction

watsonSocketBot

Prequisites

  1. Bluemix Account
  2. Bluemix CLI
  3. Github Account
  4. Git

Steps

1. Clone repo

  1. Git clone this sample project

$ git clone https://github.com/kostickm/watsonSocketBot.git

  1. Change to your the newly cloned repo

$ cd watsonSocketBot/

2. Create Watson Services

Watson Conversation Service

  1. Create service in Bluemix named conversation
  2. Click Launch tool. This will open the Conversation UI.
  3. Import the workspace-example.json file located in your locally cloned watsonSocketBot directory
  4. On your newly imported workspace click View details and save your Workspace ID

Watson Language Translator Service

  1. Create service in Bluemix named language-translator

Watson Tone Analyzer Service

  1. Create service in Bluemix named tone-analyzer

3. Update Configuration

  1. Replace <workspace_id> with your Watson Conversation Workspace ID in your local app.js file
  /***********************************************************************
  Watson Socket
  ************************************************************************/
  socket.on('watson', function (data) {

      console.log('Watson socket called');

      const payload = {
        workspace_id: process.env.WORKSPACE_ID || '<workspace_id>',
        input: { text: data.message },
        context: context,
      };

4. Deploy App to Bluemix

You are now ready to deploy your application to Bluemix.

Note: You may also use the shorthand command bx instead of bluemix.

  1. Log into Bluemix CLI using your Bluemix credentials

$ bluemix api https://api.ng.bluemix.net

$ bluemix login

  1. From your local app directory deploy your app to Bluemix

$ bluemix app push <YOUR_APP_NAME>

5. Start chatting with Watson

Once your app has finished deploying, you are ready to start chatting.

  1. From your Bluemix Dashboard, find your deployed app and click the assigned URL route.

  2. Enter a nickname, select a language, and hit return to enter the chatroom.

Commands

* Chat with Watson *
/watson <text>

Sample commands:
/watson Hey there!
/watson What can you do?

* Have Watson translate text *
/translate <language> <text_to_translate>

Sample commands:
/translate spanish My name is Megan
/translate french Hello

* Analyze the tone of all messages *
All messages are analyzed looking for Angry or Sad text.

Chat Sample

Next Steps

  • Update Watson Conversation Workspace with new Intents, Entities, and Dialog Flow.
  • Add in an additional Watson service. Find examples here.

watsonsocketbot's People

Contributors

kostickm avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.