New Drupal module for contextual assistants

To enable visitors to the site to navigate more effectively via individual assistants that inform and direct them to the relevant topics depending on the context - that's what we wanted to realize for one of our projects. The goal behind this is to give end users the information they need quickly and easily at the time they need it.

In the World Wide Web such assistants can be found more and more. However, for our Drupal project we did not find the right thing for our needs - neither an existing Drupal module nor a service provider offering such a solution. So it was clear: A new module was needed. And this module should be available as a contribution for the whole Drupal community. Voilá, a few days later we developed the Site Assistant module.

View of a site assistant in action.
View of a site assistant in action.

 

Requirements for the assistant

The overall requirement for the assistant is: It must be easy to use and well adaptable. Editorial teams should be able to create their own assistants with customized content for different areas. In addition, we defined the following requirements for the new module:

  • The content is created and maintained editorially.
  • There can be multiple assistants with different content.
  • The assistants are displayed depending on conditions (condition plugins).
  • The design of the assistants is customizable.
  • The assistants are sticky and usable in the different viewports.
  • Editors create assistants themselves, without a site builder and without the need for deployment.

This is inside the new Drupal module

From a technical perspective, the condition handling for the context-dependent display of the assistant is certainly the most exciting part. The Site Assistant module uses the existing condition plugin system and builds on it.

The display of our assistants is controlled by the conditions. A big advantage of the condition plugin system is that the Drupal community continuously provides new condition plugins and expands the selection more and more. For example, there are already condition plugins for the Drupal Commerce module for online stores. So if your Drupal site already has a store that uses this module and its condition plugin(s), you only need to activate the Site Assistant module and you can directly use the existing conditions from the store for the assistant as well.

The Site Assistant module itself is divided into three sets: the assistants, the assistant list items, and the assistant library content.

  • The assistants themselves are composed of a content field and a display options field. In the content field, the content to be displayed is placed and arranged using multiple list entries as needed. The display field is used to configure the conditions (condition plugins) on the basis of which the assistant is to be displayed.
  • The assistant list items are the contents that are displayed in the assistant. The module already brings a set of predefined list item types: headline, link, link list, subpage, library content, free text (wysiwyg). Site builders can create their own list item types, giving editors more choices in content design.
  • Assistant library items are content stored separately for reuse, and can be used in different assistants. An assistant library item consists of any number of list items. For example, for recurring contact opportunities, an assistant library item can be created with the heading "Contact" and a wysiwyg field with address, phone number and email, which is then used in different assistants.

The design of the assistant can be customized at different levels. Since each item in the assistant is a separate entity, they can be customized and formatted as usual via Drupal templates. The general design of the assistant can be customized via CSS.

Entry form for the fields of a site assistant
Entry form for the fields of a site assistant.

 

And what's more?

With our new module there is now also the possibility to easily and quickly introduce context-dependent assistants in Drupal in order to better support the end user. The Site Assistant module brings a good base, but of course there is still a lot of potential for extensions and customizations. With a little development effort, you can create your own custom conditions (a tutorial can be found on Drupal.org) and customize the functionality exactly to your needs.

We would like to see more assistant list item types shared by and for the Drupal community so that the possibilities with the assistant grow. For example, I can very well imagine chat bots (possibly directly via service providers) being integrated into an assistant.