How to Build A Super Basic Chatbot in 5 Minutes
Chatbots are all the rage at the moment and for good reason. They're an easy way to automate aspects of customer support and boost customer engagement. Now, I'm not talking about your regular run-of-the-mill autoresponder here. There's a new generation of bots that are smarter, faster and all around better than anything you've ever had access to.
And the great thing is...you can build your own in under 5 minutes. Now, don't get your hopes up too early. You won't be building your own Watson (although you will be using Watson's cognitive 'brain')! This super-fast tutorial will run you through the basics of setting up a chatbot on IBM's Conversation platform.
Ready to build one? Keep scrolling to get started.
Step 1: Get an IBM Bluemix Account
First things first, you’ll need a Bluemix account. You can get a free trial for 30 days which should be more than enough for this demo over at IBM Bluemix.
Step 2: Create a Conversation Service
Once you’re logged in, the next step is to create a conversation service. This allows you to tap into IBM’s pre-built natural language processing platform.
Click catalog then search for Conversation
Once you’ve opened up the conversation platform the next step is to create your own service. All you really need to do here is provide a name for your service. (Side Note: If you’re planning on building something a little more production like then you’ll need to consider what tiering is appropriate, for this example we’re using free tiering)
Once you've hit create you'll need to launch the conversation tool. You might be prompted to log in with your IBMid, plug it in and you’ll be directed to the Watson Conversation landing page. Click Launch Tool.
Step 3: Create a Workspace
We’re almost there. From the Watson Conversation dashboard, you’ll need to create a new workspace to hold your new chatbot. Click Create and throw in some dummy names for your workspace and click Create again.
Step 4: ‘Teach’ your chatbot
Let’s step back a little here. There are three basic steps to teaching your chatbot to...chat. These are:
- Determining intent: the chatbot needs to comprehend what your customer is trying to achieve.
- Defining entities: this allows the bot to recognize objects or items e.g. products, applications, locations.
- Creating dialogue: teaching your bot what to say when it recognizes different intents.
Step 4.1: Define your intent
To define your bot's intents click Create New, add a title e.g. #training and throw in some keywords associated with the intent. To speed this up, I've already defined a number of intents you can upload. Download the CSV (https://goo.gl/P76F1w) and click import to bring them into the intent dashboard. If you’ve already created your own you can skip this step.
Step 4.2: Give it a little context
Each bot that you build will need to have some sort of context. Watson conversation allows you to do this by defining entities. During this step you would define different products, services, training courses, applications or teams. This gives Watson a knowledge base from which to draw down from. In the interest of time (and given our chatbot is super simple)...we’re going to skip this step.
Step 4.3: Create a dialog
Now that we have our intents defined we can start teaching Watson to recognize user input and respond. We’re going to teach our chat bot to respond to our previously defined intents.
If the user triggers a greeting it makes sense to reply with something like:
>>Hello. How can I help you?
And if our customer comes back saying they have an issue to respond with something like:
>>Hmmm. That's not right, let me find someone to fix that for you.
Or….if they’re looking for training.
>>Let me arrange some training for you. What time works for you?
This is relatively easy to do with Watson Conversation. From the dialog tab select Add node.
You should have a new node template pop up to the right of your screen once you select Add node. This is where we’re going to do our ‘mapping’. We want to assign some dialog to the associated intent.
We’ll first assign our greeting to the #welcome intent that we created in step 4.1. There are three parts to this; naming your node, assigning the intent and telling our bot what to say. Copy down the fields shown below and close the node using the cross in the top right (next to Customize). That’s your first node done.
Rinse and repeat for the other two intents; training and issue. Your nodes should now look something like this.
Boom. Now you’re ready to try it out. Click the speech bubble in the top right-hand corner of the page to launch a demo of your new bot!
Start by saying hello. Your bot should trigger the response attached to the welcome intent...in this case, it responds by using our pre-defined responses setup in the dialogs tab.
And that's all there is to it. You can go on to deploy your chatbot to Slack or another service using the pre-built integrations.
Take the first step and start building your bot! Once you get started you'll find it oddly addictive.
Construction Project Management
7 年Nicely written Nicholas, definitely making it nice and simple for those who want to build and understand their first chatbot!