Build a simple news chatbot with IBM Cloud
Do you have five minutes and want to build a really simple news chatbot? I tried this yesterday with IBM Cloud and the Watson Assistant and Discovery services. The result is on GitHub in my repository watson-chatbot-discovery-news. It utilizes the CLI tool from my previous blog post as a user interface and for testing. Here are the details.
Let’s talk news
The chatbot core is a simple dialog in Watson Assistant. A dialog node “client-side news” reacts to a detected “news” intent. The search phrase for the news items needs to be quoted and is defined as a pattern-based entity.
What are the headlines for “IBM acquires Red Hat”?Any news on “gift ideas technology gadgets”?
Within the dialog node for news, a client call action channels all relevant information to the client and waits for the result. That result is then used within the response in the child node.
Dialog nodes for news chatbot
Discover news and gadgets
A simple Python function retrieves news from the Discovery service. It is invoked as client action by the CLI-based chatbot. The news items are then added to the defined context variable and fed back into Watson Assistant to form the message response. The tool as chatbot client then prints the response and ask for the next user input. See the code and instructions on GitHub for more details on the setup.
And, if you are curious about the gift ideas, there are some top 10 and top 25 lists for technology gadgets in the news. Moreover, some news sites discuss security implications of those gadgets. As a security-minded person, I only provide the links to the gadget news covering security. For everything else, you need to try out the five-minute chatbot.
Please enter your input message:any news on “gift ideas technology gadgets”
>>> processing client actions…
Response:[“This is what I found: Christmas Gift Guide 2018: 25 gadget gift ideas for tech kids // 10 Cool Tech Toys For Kids 2018 | Toy Gift Ideas on Amazon // 20+ Top Tech Gift 2018 – Best Ideas for Cool Technology Gifts // Holiday gift guide 2018: CNET editors\u2019 top picks \u2013 Breaking tech // Is your gift secretly spying? Mozilla ranks tech security in holiday shopping list // Some great holiday gift ideas for beloved seniors // The Best Holiday Gifts for Tech Lovers // Mozilla ranks dozens of popular \u2018smart\u2019 gift ideas on creepiness and security \u2013 Tech Media Magazine // DUETTO – precious earbuds with professional services // 25 Tech Gifts Under $100 That Are Totally Ideal For Your Brother, Dad, or Boyfriend”]
Want to learn more? Here are my recommendations for your reading list:
My blog about how to manage and test chatbots from the command line.
Check out the documentation for Watson Assistant and the links in the navigation menu to developer communities.