• ALL
  • CATEGORIES

Introducing the Chatbot API module for Drupal 8

Drupal Chatbot API module

Conversational interfaces powered by artificial intelligences are rapidly growing in popularity for delivering more natural-feeling, convenient experiences for consumers. We’re very excited to announce the new Chatbot API module for Drupal 8, which helps surface content via bots and assistants without having to write reams of code for each AI you want to use.

Voice assistants like Amazon’s Alexa and Google Home allow people to perform a wide variety of tasks – from searching for answers to questions to ordering products – without having to pick up a device. Auto-responders (aka chatbots) which run in popular social networks like Facebook and Twitter, or in live-chat windows, can similarly help users perform common functions without requiring them to visit a separate app or website.

The ability to use Drupal as a ‘headless’ CMS makes it ideal for serving the content of a chatbot’s responses. The module we’ve created is designed specifically to help people using Drupal 8 as a CMS to surface their content for users via bots and assistants.

What’s your Intent?

In chatbot design, the Intent of the user (i.e. what they want to accomplish through their interaction) defines the range of possible responses that your bot can give. We help the artificial intelligence to determine the Intent of the user by mapping example phrases to specific Intents. The more phrases you map, the more chance the AI has of getting the Intent right.

For example, if the user is looking for an event they might utter, or type, something like:

  • “What’s on?”
  • “What’s happening?”
  • “What events are coming up?”

To which we might want to respond with a full list of upcoming events, pausing after each to ask the user if they’d like to know more.

And, of course, we can program our AI to listen for variables within such phrases:

  • “What’s happening today?”
  • “What’s happening in Brighton next Tuesday?”

With Chatbot API, we’ve simplified the coding and discovery of Intents by making them plugins (harnessing the powerful Drupal 8 Plugin API). All you have to do is make the Intent name match the Plugin ID. And because the API is platform-agnostic, you can use the same Intent for serving content via multiple services.

What does Chatbot API do?

If you’re using Drupal as a ‘headless’ CMS then you want to be able to surface your content through as many different services as possible e.g. Amazon Echo, Google Home, Facebook chatbots, or a custom service built with e.g. Api.AI

Previously you’d have to write custom code for each Intent on each chatbot/personal assistant platform you wanted to use.

before the drupal chatbot api

Chatbot API provides a common layer to serve Drupal content to any such service, so you only have to write your code for each Intent once. The handling of requests and responses is left to the specific module which implements your bot (e.g. Apa.AI) or voice assistant protocol (e.g. Alexa skill).

after the drupal chatbot api

Currently the module supports the following platforms:

  • Alexa, by using the internal chatbot_api_alexa submodule together with the Alexa module.
  • Api.Ai, by using the internal chatbot_api_ai submodule together with the Api.AI Webhook module

The roadmap

So far, in addition to a Custom Intent plugin, we’ve created a Views Intent which can be used to surface any content that you might normally surface on your site or app using Views.

Here’s an example of the kind of conversation it can power:

User: "Middle Earth, what cities have you got?"

Bot: "I've got Hobbiton, Bree, Moria, Lorien, Edoras and Minas Tirith."

User: "Tell me events in Bree happening today."

Bot: "Bilbo and Friends playing at The Prancing Pony today. Do you want to know more or skip to the next event?"

User: "Skip."

Bot: "Black Riders hanging around Bree from today to tomorrow. Do you want to know more or skip to the next event?"

User: "I want to know more."

Bot: "[...]"

At the moment this Intent is experimental. We’ll be looking to add better support for fields and taxonomies to allow for deeper and more complex experiences.

Additional functionality we’re looking to add in the short to medium term includes a Chatbot display mode, which will help you render your content in chatbot friendly way (e.g. no markup, restricted amount of characters). We also want to add the ability to suggest Drupal content entities (i.e. categories, tags etc) for the service to use when extracting parameter values in the user’s request, removing the need to maintain a full list of entries at both ends.

The long-term dream is to be able to expose forms and other complex interactions through chatbots and assistants.

How to get started

For now, you’ll find info on how to get your bots up and running at the project page and in the documentation. That documentation will expand over time, but stay tuned to the blog for walkthroughs on creating Custom Intents and surfacing content with the Views Intent.

Check out the Drupal console integration for quickly creating a Custom Intent plugin skeleton.

The module is quite stable, but it’s still in early stages. While the API may change, we’ll try to ensure backwards compatibility if and when interfaces are modified. An alpha/beta release is expected before the end of September. When the roadmap is completed and test coverage is satisfying, we’ll announce the first release candidate.

 

Are you a Drupal, WordPress or Joomla! developer, site-builder or tester? In London this Saturday 9th September? Join us for our Summer Open Source Sprint.

 

Leave a reply

You can use these tags:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Sign up for the Manifesto newsletter and exclusive event invites