This application demonstrates how the Bluemix Conversation service can be used to build a simple on-board telco chat application.
- We will learn and understand how to integrate the Conversation, Discovery and Cloudant services.
Following services are used from Bluemix:
- Watson Conversation
- Watson Cloudant
- Watson Discovery
See the app demo
For more information about Conversation, see the detailed documentation.
The app interface is designed and trained for chatting with the telco customers. The chat interface is on the left, and the JSON that the JavaScript code receives from the server is on the right. Your questions and commands are run against a small set of sample data trained with intents like these:
view profile
view account
edit email
These intents help the system to understand variations of questions and commands that you might submit.
Example commands that can be executed by the Conversation service are:
view profile
edit emailId
- The user writes a query about a service to the chatbot
- The orchestrator accepts query, saves the user context & starts a REST call with the Cognitive APIs.
- Depending on the nature of the query (long /Short tail), the answer is provided by either Watson Conversation API or Watson Discovery Services
Ensure that you have a Bluemix account
- Select "Deploy to Bluemix" icon below.
-
This action deploys 1 application and 3 services. You can view this on your Bluemix Dashboard.
-
Log in with your existing Bluemix account or Sign up
-
Name your app and select your REGION, ORGANIZATION and SPACE. Then select DEPLOY.
Note: If the "Space" does not get listed, please take help and create it manually
-
The deploy performs two actions:
- deploys the app run time
- creates a Conversation, Cloudant and Discovery service instances
-
The deployment can take some time. You can see its status like the one given below:
Note:
- Once your app is deployed, select VIEW YOUR APP
To use the app you're creating, you need to add a worksapce to your Conversation service. A workspace is a container for all the artifacts that define the behavior of your service (ie: intents, entities and chat flows).
For more information on workspaces, see the full Conversation service documentation.
-
Navigate to the Bluemix dashboard, select the Conversation service that you created
-
Go to the Manage menu item and select Launch Tool. This opens a new tab in your browser, where you are prompted to login if you have not done so before. Use your Bluemix credentials.
-
Download the exported file that contains the Workspace contents by clicking exported JSON file
- navigate to the resources folder to find
telcobot-conversation-workspace.json
file - click on the "Raw" link which will open a browser
- Select "Save As" and save the file as a json
- navigate to the resources folder to find
-
Select the import icon: . Browse to (or drag and drop) the JSON file. Choose to import Everything(Intents, Entities, and Dialog). Then select Import to finish importing the workspace.
-
Refresh your browser. A new workspace tile is created in the tool. Select the menu button within the workspace tile, then select View details:
In the Details UI, copy the 36 character UNID ID field. This is the WORKSPACE_ID. Retain this for the following step where we will create an environment variable. This varibale will be the handle for the application to refer to the Conversation Service that we created.
-
Click on "conversation-service" from Bluemix Dashboard. In the landing page, click on "Launch Tool" button.
-
Sign in to Watson Conversation editor. Import the workspace - telcobot-workspace.json from resources folder.
-
In the editor, click on "Deploy" from left hand navigation page. Copy the value of Workspace ID.
-
Click on the deployed app from Bluemix Dashboard
-
Go to Runtime -> Environment variables section
-
Under "User defined" section at the botton, click on Add button
-
Under Name, enter WORKSPACE_ID (with out quotes) and under Value, copy the workspace id from step 3 above
-
Click on Save button. The app will automatically restart.
- In Bluemix, create a Discovery Service instance.
-
Navigate to your Discovery instance in your Bluemix dashboard
-
Create a new data collection, name it whatever you like, and select the default configuration.
- After you're done, there should be a new private collection in the UI
-
On the collection tooling interface, click "Switch" on the Configuration line and select your new configuration
-
Download and unzip the manualdocs.zip in this repo to reveal a set of JSON documents
-
In the tooling interface, drag and drop (or browse and select) all of the JSON files into the "Add data to this collection" box
- This may take a few minutes -- you will see a notification when the process is finished
-
Click on "cloudant-db" from the Bluemix Dashboard. In the landing page, click on Launch button.
-
Click on Databases from left hand navigation. Click on "Create Database" from top right corner.
-
Give a name to the database, like telco-users
-
To load demo / sample data to the database, two versions of data are available under resources folder: telco-users-cloudant.json and telco-users-cloudant.txt
-
Install couchimport tool to upload / download data to cloudant
sudo npm install -g couchimport
export COUCH_URL="https://username:[email protected]"
export COUCH_DATABASE="telco-users"
cat telco-users-cloudant.txt | couchimport --db telco-users
-
Launch the application from bluemix dashboard
-
Enter an username, say, ajay to login and see the chat bot working
- Log in to Bluemix, you'll be taken to the dashboard
- Navigate to the the application you previously created
- Select Logs
- If you want, filter the LOG TYPE by "APP"
- Log in to Bluemix, you'll be taken to the dashboard
- Select Compute
- Select the application you previously created
- Select Logs
- If you want, filter the Log Type by selecting the drop-down and selecting Application(APP)
This sample code is licensed under Apache 2.0. Full license text is available in LICENSE.
Find more open source projects on the IBM Github Page.