By Khuduga-Makhunga, Steve Martinelli | Last updated October 11, 2018
WordPress is a popular blogging and content management system. Watson Assistant is IBM’s answer to the chatbot question. Let’s learn how to integrate the two! IBM has created a WordPress plugin that greatly simplifies the deployment process for you. Install the plugin, specify your credentials and desired workspace – that’s it! We actually use this plugin on Cognitive Class.ai.
The goal of this tutorial is to have the Watson™ Assistant plugin installed on a local WordPress server where we can test the conversation dialog.
This tutorial is split into three parts:
For this section, inspiriation and credit goes to the author of How to Install WordPress on Docker (Windows, MacOS and Linux) on Hostringer Tutorials.
Create an empty project directory and go into it. You can name the directory whatever you like. The point is that this directory should only contain resources to build our Docker image.
Create a docker-compose.yml file that starts your WordPress blog and a separate MySQL instance with a volume mount for data persistence:
Run Docker Compose to pull the necessary images and start the WordPress and database containers:
$ docker-compose up -d
Creating network "assistant-wordpress_default" with the default driver
Creating volume "assistant-wordpress_db_data" with default driver
Pulling db (mysql:5.7)...
5.7: Pulling from library/mysql
802b00ed6f79: Pull complete
30f19a05b898: Pull complete
3e43303be5e9: Pull complete
94b281824ae2: Pull complete
51eb397095b1: Pull complete
54567da6fdf0: Pull complete
bc57ddb85cce: Pull complete
c7c0a9c25d8a: Pull complete
cce6c47ac3fc: Pull complete
499b9c7376c8: Pull complete
6c5e08e005ea: Pull complete
Status: Downloaded newer image for mysql:5.7
Creating assistant-wordpress_db_1 ... done
Creating assistant-wordpress_wordpress_1 ... done
If at any point you decide to stop this tutorial, run docker-compose down to gracefully stop the containers.
Bring up WordPress in a browser:
WordPress should now be running on port 8000, where you can complete the installation as a WordPress administrator; just navigate to http://localhost:8000 in a web browser.
Give your site a name and provide a username for the administrator, then click Install WordPress. You’ll be brought to your WordPress console.
The next major step is to install the Watson Assistant WordPress plugin. This plugin will enable us to deploy and configure our chatbot on a WordPress site.
From the admin console, click Plugins on the sidebar.
Click on the Add New button, search for “Watson Assistant,” and click Install Now.
Once the plugin is installed, click the Activate button.
When brought back to the plugin overview section, a message will appear below the Watson Assistant plugin, suggesting that you configure the plugin. Click that message to begin configuring your chatbot.
The first tab provides a short overview you can read if you desire, but let’s skip to the second tab: Plugin Setup. It’s here that we are presented with two options to configure out chatbot: username and password, or API key. This entirely depends on the region into which your Watson Assistant service was deployed. The easiest way to find this information is from the Deploy section of your Watson Assistant workspace.
In the example below, because we deployed in the US East region, we were given an API key.
Configure the plugin with the values from Watson Assistant and click Save Changes.
Optionally, check out the Customize Plugin section. This section allows us to customize how and where we want the chatbot to appear, how large, which fonts to use, and a whole bunch of other options.
Optionally, check out the Advanced Features section. This has details on how you can limit API requests should you be concerned about billing on a production Watson Assistant service.
Now for the fun part – let’s see our chatbot in action. Go to http://localhost:8000/, see if your chatbot appears, and start chatting!
Hope you enjoyed reading this tutorial as much as we enjoyed writing it. Happy hacking and good luck on creating your next chatbot with Watson Assistant.
Get the Code »
Apache SparkArtificial Intelligence+
October 19, 2018
Back to top