This Node.js app demonstrates the Conversation service in a simple chat interface simulating ordering a simple pizza with Dashbot Analytics.
- 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
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!
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.
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.
For pricing plans, keep the Lite plan, but notice your limits.
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.
The page that loads contains your workspaces. Click the icon to import a workspace.
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.
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.
...
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.
Download Bot Design Instructions
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.
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.
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.
...
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.
- 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.
Click over to the DASHBOT.md. Follow the steps in a browser.
-
Install the demo app package into the local Node.js runtime environment:
npm install
-
Start the app:
npm start
-
Point your browser to http://localhost:3000 to try out 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.
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.
You can use Cloud Foundry to deploy your local version of the app to IBM Cloud.
- In the project root directory, open the
manifest.yml
file:
- In the
applications
section of themanifest.yml
file, change thename
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
- Push the app to IBM Cloud:
cf push
Access your app on IBM Cloud at the URL specified in the command output.
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.
This sample code is licensed under Apache 2.0. Full license text is available in LICENSE.
See CONTRIBUTING.
Find more open source projects on the IBM Github Page.