DEV Community

Dave Nugent πŸŒ‰
Dave Nugent πŸŒ‰

Posted on

Build an Edge-enabled Intelligent Chatbot with PubNub and Watson Assistant

Chatbots are a rapidly growing market for applied artificial intelligence. But what separates a smart chatbot from a virtual assistant that's just not helpful? We want to make sure our chatbot understands the end user's intents and is able to effectively respond in an intelligent manner. At the same time, we want to make sure our chat infrastructure is globally-distributed for a low-latency and high-availability experience.

In this tutorial, we'll combine the Watson Virtual Assistant technology with PubNub's global data stream network to build a React-enabled chat application that can intelligently respond to user queries.

Table of Contents

Sign Up for your Free Watson Assistant

  1. Click here to sign up for your IBM Cloud account. You'll need to provide your Email address and choose a password:

IBM Cloud Signup

ℹ️ Unable to verify your email address? Sometimes outlook.com and gmail.com domains get flagged as spam. Try using another email account.

  1. Verify your email address by entering the verification code in your confirmation email.

Finish creating your account

  1. Enter your personal information, click Next and then click Create account.

  2. Acknowledge the IBM Privacy policy.

  3. Congratulations! Your account was created, and now we can create our Watson Assistant. On the top right of your screen, click Create resource +.

  4. Now you'll see all the Services and Software you can create. We'll type assistant into the search box and press enter. Then click the box for Watson Assistant.

Search box

  1. Make sure the Lite plan is selected -- you'll get 10,000 messages per month free. In the bottom right corner, click Create.

Create Watson Assistant screen

  1. Congratulations, you've created your own Watson Assistant! For the rest of this lab you'll want to take note of the API key and URL under Credentials. Then, click Launch Watson Assistant so we can configure the assistant.

Now we can take a look at the different ways we can configure your assistant:

Watson Assistant Skills

Let's go over these briefly:

  • Intents are purposes or goals that are expressed in a customer's input, such as answering a question or processing a bill payment.
  • Entities represent information in the user input that is relevant to the user's purpose.
  • Dialog is where you'll add nodes that define how your assistant will converse with your end users.
  • Options is where you'll hook in your webhook URLs, if you decide to do other integrations in the future.
  • Analytics tells you the metrics of the conversations, and how well your assistant understands what end users are saying to it.

We could spend a lot of time building our own skill, but instead, we can import a pre-built one!

  1. On the left of your screen, click on the Assistants icon.

Assistants page

  1. Click on your assistant (mine is called My first assistant)

  2. Click the triple dot menu and click Swap skill.

Assistant skill swap

  1. Click Use sample skill and then click Customer Care Example Skill.

Customer care example skill

Yay, we've populated a sample skill with intents, entities and dialog notes!

  1. Now let's grab our API details. At the top of the page, click the left arrow next to Assistants.

Back to assistants

  1. Click the triple dot menu in your assistant and click Settings.

Assistant settings

  1. Take note of your Assistant ID and API key.

Assistant settings

Create your PubNub Account

PubNub Logo

Next we'll create a private PubNub channel and get our keys by creating an account. Click here to get started.

You'll need to copy down the publish key and subscribe key from your PubNub project. Keep a note of these keys, we'll use them to send and receive messages inside our project.

Remix our Glitch Project

Glitch is a fun, collaborative coding environment that makes it really easy to re-use, or "remix" in Glitch parlance, other people's code.

Please visit our Watson PubNub Chat Project on Glitch. Once you click Remix, you'll duplicate that code into your own project.

After that, follow the instructions in the README.md in order to complete the workshop.

Next Steps

Top comments (0)