Skip to content

sudharshan-govindan/DevConnectTelcoChatBot

Repository files navigation

Build a Telco Conversation Dashboard application using Bluemix & Watson Services

Overview

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:

  1. Watson Conversation
  2. Watson Cloudant
  3. Watson Discovery

See the app demo

For more information about Conversation, see the detailed documentation.

How the app works

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

Technical Architecture - Telco Chatbot

                                                                                 
  • 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

Pre-requisities

Ensure that you have a Bluemix account

Deploy the app and explore the conversation flow

  1. Select "Deploy to Bluemix" icon below.

            Deploy to Bluemix

  1. This action deploys 1 application and 3 services. You can view this on your Bluemix Dashboard.

  2. Log in with your existing Bluemix account or Sign up

  3. 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

  1. The deploy performs two actions:

    • deploys the app run time
    • creates a Conversation, Cloudant and Discovery service instances
  2. The deployment can take some time. You can see its status like the one given below:

            

Note:

  • Existing Bluemix users with Toolchain Id will see a screen like this.

  1. Once your app is deployed, select VIEW YOUR APP

            

Importing a workspace

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.

  1. Navigate to the Bluemix dashboard, select the Conversation service that you created

  2. 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.

  3. 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
  4. 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.

  5. Refresh your browser. A new workspace tile is created in the tool. Select the menu button within the workspace tile, then select View details:

            Workpsace 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.

            

Configure the Services

WCS

  1. Click on "conversation-service" from Bluemix Dashboard. In the landing page, click on "Launch Tool" button.

  2. Sign in to Watson Conversation editor. Import the workspace - telcobot-workspace.json from resources folder.

  3. In the editor, click on "Deploy" from left hand navigation page. Copy the value of Workspace ID.

  4. Click on the deployed app from Bluemix Dashboard

  5. Go to Runtime -> Environment variables section

  6. Under "User defined" section at the botton, click on Add button

  7. Under Name, enter WORKSPACE_ID (with out quotes) and under Value, copy the workspace id from step 3 above

  8. Click on Save button. The app will automatically restart.

Discovery.

  1. In Bluemix, create a Discovery Service instance.
  1. Navigate to your Discovery instance in your Bluemix dashboard

  2. Launch the Discovery tooling

  3. 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
  4. On the collection tooling interface, click "Switch" on the Configuration line and select your new configuration

  5. Download and unzip the manualdocs.zip in this repo to reveal a set of JSON documents

  6. 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

Cloudant

  1. Click on "cloudant-db" from the Bluemix Dashboard. In the landing page, click on Launch button.

  2. Click on Databases from left hand navigation. Click on "Create Database" from top right corner.

  3. Give a name to the database, like telco-users

  4. 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

  5. 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

Running the app

  1. Launch the application from bluemix dashboard

  2. Enter an username, say, ajay to login and see the chat bot working

Troubleshooting in Bluemix

In the Classic Experience:

  • 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"

            

In the new Bluemix:

  • 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)

            

License

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

Open Source @ IBM

Find more open source projects on the IBM Github Page.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published