Our experimental initiative to prototype a bot-ready information solution using Google’s Dialogflow
This post is part of a series. For more information and links to other posts in the series, see the “Building bot-ready knowledge bases” home page.
As we mentioned in post #10 of this series, Dick has expanded our “Building bot-ready knowledge bases” project with two additions:
- A Python data wrangling script to pull metadata out of the grocery shopping HTML output files and populate a CSV file, which he is using as a knowledge base connector to a Dialogflow-based, follow-on version of GROCERYbot
We call our new Dialogflow bot “GROCERYbot2.”
- An integration of GROCERYbot2 with the Telegram instant messaging app.
The integration allows users to take advantage of Telegram’s advanced text and voice messaging platform to access grocery shopping information from multiple devices.
We call the Telegram-based bot “SHOPbot.”
Objectives of our grocery shopping / Telegram integration package
We’ve designed our integration to do the following:
- Based on a relevant user query, select one or more KB articles from the grocery shopping set
- Use the article title and description as “teaser text”
- Provide the user with a link to an article that matches their query
Steps we followed to create GROCERYbot2 and integrate it with Telegram
1. Using the oXygen editor, created the DITA/XML-based grocery shopping files and published them to HTML
As we mentioned in prior posts in this series, this is a user content knowledge base that we created long ago and updated at the beginning of this project. New in these files is the FAQ metadata shown in Step 4, below.
2. Uploaded the HTML files to a website
We temporarily stored our grocery shopping KB files on a subdomain of our professional site, vrcommunications.us.
3. Created a Python data-wrangling script
As the code comments say, this script extracts data from the HTML files generated from the DITA source files and creates a set of CSV files as output.
4. Ran the Python data-wrangling script to pull the relevant information out of the metadata in the HTML files and put it into a CSV file
GROCERYbot2 gets its information and training solely from the metadata entered into the DITA/XML-based files that are part of our grocery shopping KB set. As shown in the following image, the metadata we used is title, description, keywords, and faqs.
One of our objectives was to make the DITA/XML source files as complete as possible, so that:
- The most critical and definitive content and metadata is produced by the articles’ authors, editors, and owners at the time of their creation
- Having a well-structured and relatively complete content collection in the early stages of the bot-building project, means that time can be saved in training, testing, and putting the bot-based KB set into production
5. In the Dialogflow console, created and configured a new agent called GROCERYbot2
The GROCERYbot2 agent has only one intent (the default) and a single knowledge base connector.
We populated the Dialogflow knowledge base connector with the CSV file created in Step 4.
6. In the Dialogflow console, tested GROCERYbot2
Here is a sample Dialogflow console test interaction.
7. In the Telegram app, created a bot instance we called “SHOPbot.”
SHOPbot’s role is to communicate with GROCERYbot2 in Dialogflow, and to return information to the Telegram user.
You can read about creating a Telegram bot here.
8. In the Dialogflow console, connected GROCERYbot2 with SHOPbot
This is done by selecting Telegram in the Integrations tab for the Dialogflow agent. You can read information on how to do that here.
9. In the Telegram app, tested SHOPbot with GROCERYbot2
The image at the top of this post shows the Telegram app in action talking to our Dialogflow bot. The bot can be consulted on any device or operating system Telegram supports. You can see a list of current platforms here.
We are already moving to include both questions and answers in the DITA/XML “faq” metadata.
We are working on a new set of KB articles (who wouldn’t get a little tired of “grocery shopping”?!).
We plan to experiment with other Dialogflow integrations; for example, Slack and Facebook Messenger.
We are thinking of trying out a Microsoft Luis-based bot.