Skip to content

RiyaMRoy04/watson-dashbot-sample

Repository files navigation

Conversation Sample Application With Dashbot

This Node.js app demonstrates the Conversation service in a simple chat interface simulating ordering a simple pizza with Dashbot Analytics.

Before you begin

  • Create an IBM Cloud account
    • Sign up in Bluemix, or use an existing account. Your account must have available space for at least 1 app and 1 service.
  • Make sure that you have the following prerequisites installed:
    • The Node.js runtime, including the npm package manager

Installing locally

If you want to modify the app or use it as a basis for building your own app, install it locally. You can then deploy your modified version of the app to the IBM Cloud.

Clone this repo!

Setting up the Conversation service

Create an IBM Cloud account if you haven't already.

Click "Catalog" in the upper menu. This will take you to the list of available services, platforms, and other offerings on the IBM Cloud. To make it simple, use the column menu and click "Watson" at the very bottom. This will filter the catalog to just show Watson Services.

alt text

Click on Conversation to start the provisioning of the service.

Name the service, and select a region/location to deploy in. If applicable, choose an organization and space or leave it to the default if you only have one of each.

alt text

For pricing plans, keep the Lite plan, but notice your limits.

alt text

Click "Create" and wait for the service to provision. This may take some time.

Once the service is provisioned successfully, click on the Launch Tool button. This opens the Watson Conversation tool and may require you to login again.

alt text

The page that loads contains your workspaces. Click the icon to import a workspace.

alt text

Import the json file from the Pizza Ordering Code Pattern. Choose the file and import everything. This will create a new workspace with all the intents, entities, and dialog intact.

Click the new workspace tile to open it.

alt text

Click the Deploy icon.

Click Credentials (next to Deploy Options). Copy your workspace ID, username and password. Enter these as strings in the .env file to access the API.

alt text

...

Alternatively, from the IBM Cloud Conversation page (page where the Launch tool button sits), click "Service credentials" then expand "View credentials" to reveal your username and password. Enter these as strings in the .env file to access the API. This does not show your workspace ID.

alt text

DIY bot

Download Bot Design Instructions

Importing from Bot Asset Exchange (BAE) [optional]

In your browser, navigate to the Bot Asset Exchange.

Choose a bot you want to use and click download.

Login with your IBM Cloud account information.

The page that loads contains your workspaces. Click the icon to import a workspace.

alt text

Import the json file that you downloaded. Choose the file and import everything. This will create a new workspace with all the intents, entities, and dialog intact.

Click the new workspace tile to open it.

alt text

Click the Deploy icon.

Click Credentials (next to Deploy Options). Copy your workspace ID, username and password. Enter these as strings in the .env file to access the API.

alt text

...

Alternatively, from the IBM Cloud Conversation page (page where the Launch tool button sits), click "Service credentials" then expand "View credentials" to reveal your username and password. Enter these as strings in the .env file to access the API. This does not show your workspace ID.

Add credentials

  1. On the local system, paste the workspace ID into the WORKSPACE_ID variable in the .env file. Paste in the USERNAME and PASSWORD for your conversation service as well. Save and close the file.

alt text

Dashbot!

Click over to the DASHBOT.md. Follow the steps in a browser.

Installing and starting the app (via bash)

  1. Install the demo app package into the local Node.js runtime environment:

    npm install
  2. Start the app:

    npm start
  3. Point your browser to http://localhost:3000 to try out the app.

Testing the app

After your app is installed and running, experiment with it to see how it responds.

For more information about intents, see the Conversation service documentation.

To see details of how these intents are defined, including sample input for each intent, launch the Conversation tool.

Modifying the app

After you have the app deployed and running, you can explore the source files and make changes. Try the following:

  • Modify the .js files to change the app logic. (add Dashbot lines here)
  • Modify the .html file to change the appearance of the app page.
  • Use the Conversation tool to train the service for new intents, or to modify the dialog flow. For more information, see the Conversation service documentation.

Deploying to IBM Cloud

You can use Cloud Foundry to deploy your local version of the app to IBM Cloud.

  1. In the project root directory, open the manifest.yml file:
  • In the applications section of the manifest.yml file, change the name value to a unique name for your version of the demo app.

The following example shows a modified manifest.yml file:

---
applications:
- name: conversation-simple-app-test1
 command: npm start
 path: .
 memory: 256M
 instances: 1
 env:
   NPM_CONFIG_PRODUCTION: false
  1. Push the app to IBM Cloud:
cf push

Access your app on IBM Cloud at the URL specified in the command output.

Deploying to Slack (not covered in this workshop)

Follow the documentation in the Deploy section of your workspace.

This is a clone of chatbot-dashbot-workshop Github repo with few edits! Thanks to Amara Keller for this sample code.

License

This sample code is licensed under Apache 2.0. Full license text is available in LICENSE.

Contributing

See CONTRIBUTING.

Open Source @ IBM

Find more open source projects on the IBM Github Page.

About

Watson Assistant and Dashbot integration

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published