IBM Developer Blog

Follow the latest happenings with IBM Developer and stay in the know.

Watson Assistant offers an intuitive interface for developers and business experts to build interactive chatbots

Watson Conversation is now Watson Assistant. Although some illustrations in this tutorial may show the service as Watson Conversation, the steps and processes will still work.

Building chatbots and virtual assistants continues to be extremely popular as users demand more functionality and better service around the clock. Watson Assistant offers an intuitive interface for developers and business experts to build interactive chatbots. With Watson Assistant, you can build your chatbot once and then deploy across multiple channels (web app, mobile app, call center, etc.) and platforms (Twitter, Facebook, Slack, etc.) to provide a consistent and engaging end-user experience.

Note that the main mission of a chatbot is to understand what the user is saying through natural language processing and collect enough information to take action and execute some functionality. To do so with Watson Assistant, you define a workspace, which consists of intents (what does the user mean), entities (terms that provide specific information), and a dialog flow to orchestrate the interaction with the user based on intents, entities, and context.

It is important to understand that in addition to your Assistant service, you need to develop an application which integrates with your Assistant workspace to control the interaction with the users. Once the chatbot collects enough information from the user, it delivers such knowledge to the application which then executes some action. The action could simply be looking up an answer from a database or it could be more complicated and involves a physical action such as turning on the radio in the car. Furthermore, the flow of information between the application and the Assistant service is bi-directional and it is orchestrated through context variables. Effectively, the conversation service can send information to the application via context variables and the application can send information to the conversation service via context variables. IBM Announces New and Advanced Watson APIs on the Cloud

In this blog, we show how you can integrate Watson Assistant service with another Watson service, namely Natural Language Understanding (NLU), to extract entities of interest. In some scenarios, it makes sense to define the entities of interest in your Conversation workspace; for example, when defining a “toppings” entity for a pizza ordering bot. However, in other scenarios, it is impractical to define all possible variations for an entity and it is best to rely on a service to extract the entity; for example, when extracting a “city” entity for a weather bot. We also illustrate how to integrate the information from Conversation service with a 3rd party API, namely the Weather Underground API, to look up the weather in a specific location of interest.

This section describes the commands and steps you need to execute to get the application up and running with Natural Language Understanding (NLU), Assistant, and Weather Underground API services.

Local Setup

This section describes how to set up your local space and clone a GitHub repository into your local space. You will need an IBM Cloud account, IBM’s platform as a service offering, to provision Watson services. To run locally, you need the following:

Open a terminal window on your laptop and execute the following commands:

  1. Download and install git
  2. Download and install Cloud Foundry CLI
  3. mkdir tlelab_workdir
  4. cd tlelab_workdir
  5. git clone
  6. cd conversation-nlu
  7. npm install => installs node packages defined in package.json
  8. cp .env.example .env => we define service credentials in .env file
  9. edit .env file and copy/paste the credentials for NLU, Conversation and Weather services (you will create these next).

Provisioning Watson Services

Please note that you need to provide unique names for the provision services. So if you get an error when executing the commands below, it could be because the name is not unique. To create Natural Language Understanding (NLU) and Conversation service credentials, on your terminal window, execute the following:

  1. cf login -> connects you to your IBM Cloud account

    API endpoint:

    username: your_bluemix_username

    password: your_bluemix_password

  2. cf create-service conversation free tlelab-conv-service -> create conversation using free plan and call it tlelab-conv-service
  3. cf create-service-key tlelab-conv-service svcKey
  4. cf service-key tlelab-conv-service svcKey -> returns username and password credentials for conversation service
  5. Copy the Conversation username and password to the .env file



  6. cf create-service natural-language-understanding free tlelab-nlu-service -> create NLU service using free plan and call it tlelab-nlu-service

  7. cf create-service-key tlelab-nlu-service svcKey
  8. cf service-key tlelab-nlu-service svcKey -> returns username and password credentials for NLU service
  9. Copy NLU username and password to the .env file



Weather Underground API

To get the weather, we will rely on the Weather Underground API. To use the weather underground api, you need to [sign up for an apikey][( Once you get the key, edit .env file and copy the weather api key to .env file.

  1. WEATHER_API_KEY=weatherapikey**

Integrating your Application with Assistant Workspace

The last piece of information we need is the WORKSPACE_ID. To get this, we need to create a workspace in our conversation service and build a conversation which involves defining intents, entities and building a dialog to orchestrate the interaction with the user. To do so:

  • Point your browser to IBM Cloud
  • Login with your IBM Cloud credentials
  • Find your conversation service with the name tlelab-conv-service. Click to open the page for that service.
  • Find the Launch button and click it to launch the tooling for the conversation service.
  • Click Import to import a json file which defines the conversation workspace.

    -> Choose file tlelab/conversation-nlu/training/car_workspace_nlu.json

  • This imports intents, entities, and the dialog for this conversation into a workspace called NLU_Car_Dashboard.

    ->Browse the various intents and entities as well as the dialog flow to get a better understanding of how these are defined.

  • Click on top left menu and navigate to “Back to workspaces”

    -> this shows all the workspace tiles. In your case, you would only have 1 workspace titled NLU_Car_Dashboard

  • Click the Actions menu (top right of workspace tile) to View details

  • Copy Workspace ID, edit .env file and add workspace id


Running Application Locally

Now you’re ready to run the application. On the terminal command line, execute this command:

  1. node server.js
  2. Point your browser to http://localhost:3000**
  3. Experiment with assistant application -> Ask things like: “What is the weather in Austin, TX”

Deploying Application to IBM Cloud

To push your application to IBM Cloud:

  1. edit manifest.yml and change name to a unique name (tlelab-conv-jk)**
  2. cf push
  3. point your browser to
  4. Experiment with conversation application Ask things like: “What is the weather in Austin, TX”


When designing your chatbot solution, Watson Assistant offers an intuitive and powerful interface for defining intents, entities and a dialog flow to control interaction with end-users. In your application, it is easy to integrate Watson Assistant with other services such as Watson Natural Language Understanding to extract entities in a more efficient and scalable manner. It is also seamless to integrate with 3rd party services such as Weather Underground API to execute an action such as looking up the weather forecast in a location of interest to the user.

Ready to go deeper? Access code patterns and learn how to hook it all together.