Skip to main content

Drupal Chatbot Module

Use the official ChattyBox Drupal module when you want a Composer-managed installation for a Drupal 10 or Drupal 11 site. It loads the hosted widget on public HTML routes and keeps the production API endpoint configured automatically.

Before Installing

Complete the Getting Started flow first: connect your public Drupal URL, review indexed pages, and verify representative answers in Test Chat. Then create a browser-safe public key in Public Keys and copy it from the project Embed tab.

Composer Installation

Add the public GitHub repository to the consuming Drupal project's root composer.json:

{
"repositories": {
"chattybox-drupal": {
"type": "vcs",
"url": "https://github.com/OpenStaticFish/chattybox-drupal.git"
}
}
}

If the project already has a repositories section, merge the chattybox-drupal entry into it. Then install the tagged module:

composer require openstaticfish/chattybox-drupal:^0.1

The package is declared as a drupal-module and requires Drupal ^10 || ^11. Standard Drupal Composer installer paths place it under web/modules/contrib/.

To test the current development branch instead:

composer require openstaticfish/chattybox-drupal:dev-main

Enable and Configure

  1. Enable ChattyBox from Extend, or run drush en chattybox.
  2. Open Configuration > Web services > ChattyBox.
  3. Paste only the public widget API key from the project Embed tab.
  4. Leave the hosted widget script URL unless ChattyBox has provided a preview or self-hosted loader URL.
  5. Leave the language override blank to follow the page or browser language, or enter a two-letter code such as en, fr, or de.
  6. Enable the chatbot and save the configuration.

The module does not load on administrative routes or non-HTML responses. It adds the public key, managed production endpoint, optional locale, and widget loader through Drupal's declared library and drupalSettings.

Exclude Additional Routes

The module skips administrative routes automatically. A custom module can disable the widget on additional public routes with hook_chattybox_load_widget_alter():

/**
* Implements hook_chattybox_load_widget_alter().
*/
function mymodule_chattybox_load_widget_alter(&$should_load, $config, $route_match) {
if ('commerce_checkout.form' === $route_match->getRouteName()) {
$should_load = FALSE;
}
}

Manual Fallback

Composer is the recommended installation path. If your Drupal deployment cannot use Composer, copy the module into web/modules/custom/chattybox or another custom module directory, enable it, and configure it from Configuration > Web services > ChattyBox.

Do not paste a management credential into the module. The public widget API key is intended for frontend markup.

Verification

After configuring the module:

  • Open a public Drupal page in an incognito window.
  • Confirm the widget launcher appears once.
  • Ask a real visitor question.
  • Verify the answer includes source citations back to public Drupal pages.
  • Check the browser console for missing data-api-key, data-api-url, or key errors.

Continue with the launch checklist before announcing the chatbot.

We use optional analytics and tag-management tools to understand site use. Choose whether to allow PostHog and Google Tag Manager. Turning analytics off reloads this page so the change takes effect cleanly. Essential site functionality and error monitoring are not controlled by this choice. Read our privacy policy.