Chatbot Drupal 8

  1. Chatbot Drupal 8 Tutorial
  2. Chatbot Drupal 8 Free
  3. Chatbot Drupal 8 Download
  4. Drupal 8 Release
  5. Drupal 8 Requirements

Bot Framework for Drupal 8 - Experimental approach to building a framework with a plugable interface for bot clients and back ends. THE CHATBOT MODULE. Drupal 8. Forked from Whitehouse’s Facebook Messenger Bot module. It’s extensible through the Plugin API. Comes with 2 plugins: Facebook and Slack COMPONENTS OF A CHATBOT. Message Type. Messages. Chatbot API facilitates the implementation of Chatbots and Personal Assistants (i.e. Alexa, Dialogflow/Api.AI, etc.) intents. It does abstracting the way of implementing your intents logic by providing Intent plugins. Documentation for Drupal. Celebrate 20 years of Drupal with us! April is DrupalFest, a month-long series of virtual events focused on community, contribution, and the positive impacts made possible with Drupal.


This is my second post based on the talk I delivered at DrupalCamp London 2018: “Hi user, I am Drupal. How can I help you?” In the first post I looked at some of the scenarios in which chatbots and personal assistants might be used to beneficially serve website content to your audiences and briefly introduced the Chatbot API for Drupal 8. In this post, I’ll walk through the second half of the talk in which I show how easy it is to surface content through a chatbot using the API.

Check out the slides and code examples used in this post on GitHub.

Chatbot API features

To recap, Chatbot API provides a common flexible extra layer that sits between Drupal, your NLP and your various chatbots and personal assistants. It makes your website chatbot-friendly so you don’t have to write new code each time you translate your conversational experiences from one interface to another.

Chatbot API works with Dialogflow and Alexa out of the box, with support for more platforms on the way.

Chatbot Drupal 8 Tutorial

Using Chatbot API, Intents become plugins, making use of the flexible Drupal Plugin API.

Entities can be supplied by your website data, and pushed easily to the NLP where you’re creating your conversational experience.

The module also provides a Views integration to easily create Intents to return lists of content items for the user to explore further e.g. event listings, news articles, pages, reviews etc.

Creating an Intent plugin

You create the plugin in the usual way, using the Intent Name (the machine name of your intent) as the Plugin ID, adding your logic and defining the responses of the bot/assistant.

The module includes a Drupal Console command generate:plugin:chatbotintent utility to easily create Intent plugin skeleton through a wizard.

Pushing Entities to your NLP

Chatbot Drupal 8

Entities are great for improving the way your NLP understands and recognises the parts of the conversation you want to perform logic on. The more the Entities entries you provide, the easier it will be for you to write your intents and their logic. Most NLPs also support synonyms, and again the more, the better.

In the Drupal context, these Entities may be nodes of a specific content type, or taxonomy terms. But what if we have a lot of entries in our Entities list? We need to push the Entities from our website to the NLP so they can be used in our logic. This is a simple matter with the Chatbot API Entities submodule: the configuration wizard will help you create an Entity Collection, selecting what from your website should be synced as an NLP Entity. It supports synonyms too, and also gives high flexibility on what or where exactly are the Entities you want to push (nodes, terms, fields, bespoke condition, results from a database query, etc) by creating new ChatbotApiEntities/QueryHandler plugins.

As part of the Entity Collection setup, you can choose to which endpoint (in this case, API.AI – the old name for Dialogflow) to push the Entities during the next cron run.

Adding new Entities within those collections can now be done entirely in Drupal. The NLP, in this case Dialogflow, will then automatically synchronise after the next cron run.

Serving content via Views integration

If we were to answer a user’s query like ‘show me a list of properties in Shoreditch’ on our Drupal website, we’d serve a list of search results using Views.

In a conversational experience, we can do the same thing, with the (voice) assistant, for example, presenting one result at a time and asking the user if they’d like to hear more or skip to the next result. To achieve this, we set up a view with pagination, showing only one result per page.

With the Views integration provided by Chatbot API you just need to create – or reuse – your view and add a Chatbot Intent display. By doing this the module will automatically select best default options (pagination, 1 item per page), but you are free to personalise anything you want. For instance you may want to add a “Footer” element (in a conversational context that will be the suffix of your response) and a No Result message (which will be our response when there are no results).

The only requirement is for you to set up the Intent Name exactly as its name on the NLP. That’s it, your view is now exposed. Go ahead and play with it.
The code examples have both the Dialogflow configuration and a View for you to play with.

Chatbot Drupal 8

Chatbots: a new way to serve your website content

Here’s an example of my Drupal Concierge in action, demoing the maintenance_support intent.

As you’ll see, the chatbot is merely serving content to the end user from the repository of available content on my site. The difference is, it’s using natural language processing to determine the user’s intent and the entities referenced, and serving content in a way that makes navigating the content easier via text and speech interfaces. Designing a conversational experience requires that you take these differences into account.

With that in mind, here are my top tips for serving content via chatbots:

  • Plan your Intents in advance – think about the context in which the user is asking for the information and the how it can be served to them in the best way;
  • Consider the variety of utterances that might be used to ask for the same thing – there will be surprises. A useful resource here is, which returns Google’s suggested searches for any query;
  • Train your bot – as sophisticated as the NLPs are, they’re still pretty dumb. But by answering queries left unanswered by the bot (kind of like marking its homework), you can train it become smarter.
  • Build your content with Intents in mind – your content may not be ready to be exposed by a chatbot. You may want to redesign some of your content types with shorter titles, chatbot-only content snippets etc.
  • Create a Display Mode for your bot – this can also help present content in a bot-friendly way, by stripping out extraneous fields or media which would be inappropriate to serve via a bot.

Have fun! And do let me know about how you’re using Chatbot API to serve content – I’m sure I’ve only thought of a small number of the potential uses for .

And finally, if you’d like to discuss the possibility of working together on an implementation or new integration, don’t hesitate to get in touch.


Historically, we have many ways of serving content digitally: through a website, through mobile apps, via social media, RSS feeds, RESTful APIs (allowing content to be consumed by other apps, websites etc), and email. Now we have a new player in the game: chatbots and personal assistants. Conversational interfaces promise a more natural way for users to interact with your organisation’s content, but without the need for humans on the other end.

In this post I’ll walk through the basic concepts involved in creating conversational experiences based on your already existing content and user journeys. It’s based on a talk I delivered at DrupalCamp London earlier this month: “Hi user, I am Drupal. How can I help you?” Here’s the recording:

Chatbot Drupal 8 Free

Conversational experiences FTW

Don’t think of this as something you need to add to your website, increasing complexity. Think of it as a new way for users to interact with your brand/content, in a more natural, conversational manner. They’re perfect for scenarios where a user doesn’t have time to hunt for an answer to their needs on your website but where the query is straightforward enough that human interaction can be avoided.

For example, how many times has your organisation received an email of the type “I’m on your website but can’t work out how to do x”, where you’ve ended up sending a link in response? This is exactly the kind of enquiry that bots can automate, saving time for both you and your user.

But of course, bots can go even further than this. Because they have access to all your content and data they can help the user by surfacing more than just links. Text, images, video, forms, can all be embedded in a conversation in response to queries. Bots can even edit the user’s data (e.g. profile info, preferences etc) on the fly. In theory, anything that a user can do on your website can be done via a conversational interface.

  • Answer FAQs
  • Provide media-rich search results
  • Provide access to services

How do chatbots and personal assistants work?

Chatbot Drupal 8

The magic is done through natural-language processing (NLP), a technique which relies on machine learning to work out the intent of a user’s query, what entities it concerns, and understand and manage the context in which the query is made.

Let’s consider a query from a housing association resident, made to the association’s website: “How can I get my boiler fixed?” A common enough case.


The intent here is a request for maintenance. But this could be expressed in many different ways to the phrasing “How can I get my boiler fixed?” e.g.

  • Can you fix my boiler?
  • I need my boiler fixed.
  • I need you to fix my boiler.
  • How can I get my boiler fixed?
  • How can I fix my boiler.
  • My boiler needs to be fixed.
  • Fix my boiler!
  • Etc

NLP engines, like those that power Alexa, Dialogflow, Watson, Conversable etc rely on being fed many examples of ways in which an intent can be phrased to accurately work out what the user is trying to accomplish.


Now that our NLP engine knows that the intent is a maintenance request, it needs to work out what entities the request concerns, so it can point the user in the right direction. NLP engines are pretty good at identifying entities already, so when programming them we can use entity placeholders, e.g.

  • Can you @task my @appliance?
  • I need my @appliance @task
  • Etc

Where @appliance could be ‘boiler’, ‘microwave’, ‘fridge’, ‘front door’ etc, and @task could be ‘replace’, ‘fix’, ‘install’ etc.

Of course, each possible value of the entity will have multiple synonyms (fix: repair, mend, sort out, see to) which the NLP will have to deal with.


The context in which the user’s query is made will often be critical to determining the desired response of the bot or assistant. In our example with the faulty boiler, the user probably needs a repair appointment, but before the bot can book that appointment for them it might need to understand what kind of property the user lives in, their address, how urgent the request is, an account number, time of day etc.

Chatbot Drupal 8 Download

The NLP engine might be able to extract some of this data from the user’s account, if they’re signed in, or from other sources (e.g. time of year, availability of repair crews) or it might need to ask follow up questions.

Each conversation will have its own context, which evolves as the conversation progresses and which is cleared when the conversation ends.

Drupal 8 Release

Designing conversational experiences

We can think of the NLP engine as the brains behind the conversational experience, while the chatbot is the face, which actually interacts with the user. This could be a bot in a messaging app (either embedded in your site or in an external app like Facebook Messenger), an Alexa skill etc.

Drupal 8 Requirements

From behind the scenes then, the conversation is three-way: the user, asking the question; the NLP which understands the query and translates it into machine-friendly language; and the chatbot/assistant, which performs the required logic (sending an email, providing a link, booking an appointment etc).

Does this mean that, to surface your website content via conversational interfaces, you need to write new code to sit between your website and each bot? That’s exactly what we found when we were asked by a client to make an Alexa skill for surfacing event listings from their Drupal website, and then a Google Home app, and then a Facebook Messenger bot, and then a website chatbot. Writing new code to sit between Drupal and the bot each time seemed excessive, when the interactions we were programming were essentially the same. That’s why we created the Drupal Chatbot API.

Chatbot API for Drupal 8

Chatbot API is an extra layer that sits between your Drupal installation, your NLP and your various chatbots and personal assistants. It makes your website chatbot-friendly so you don’t have to write new code each time you translate your conversational experiences from one interface to another.

Chatbot API works with all these systems:

  • Dialogflow
  • Alexa
  • Slack
  • Cisco Spark
  • Microsoft
  • Twilio
  • And soon, Botkit
Chatbot Drupal 8

The video embedded at the top of this post contains additional material aimed at developers which walks through creating a conversational experience with Chatbot API. I’ll follow up with a more developer-oriented post soon…