Chatway Chatway
  • Home
  • Product
  • Pricing
  • Built For
  • Resources
    • Help Center
    • Blog
    • Integrations
    • Social Media Buttons
    • Glossary
  • What’s New
  • Sign In →
Sign In Sign Up for Free Free Sign Up

How to install Chatway on Drupal

  • Help Center >
  • How to install Chatway >
  • How to install Chatway on Drupal

Looking to enhance your Drupal site with live chat? Chatway makes it easy to connect with visitors in real time, improving engagement and customer support. In this guide, we’ll show you how to integrate Chatway into your Drupal site using a custom module. Whether you’re a developer or a site owner, this step-by-step tutorial will ensure a smooth setup, so you can start chatting with your visitors right away.

We will add the Chatway script by creating a custom module. It is the easiest way and considered the best practice as there is no need to modify the core Drupal files.

Let’s start!

Step #1: Copy your Chatway unique identifier from your Chatway installation page.

Step #2: Using SSH, navigate to your custom modules directory (If the custom folder doesn’t exist, create it).

  
  
cd modules/custom
  

Step #3: Create a new folder for the Chatway module.

  
  
mkdir chatway_integration
  

Step #4: Create the Chatway Module info file chatway_integration.info.yml and add the following content:

  
  
name: 'Chatway Integration'
type: module
description: 'Adds Chatway live chat script to the site.'
core_version_requirement: ^10 || ^11
package: Custom
dependencies: []
  

Step #5: Edit the code below and replace xxxxxxxxxxxx with the Chatway unique identifier you copied from Step #1. Then create the Chatway Module code file chatway_integration.module and add your updated content.

  
  
<?php

use Drupal\Core\Session\AccountInterface;

/**
 * Implements hook_preprocess_HOOK() for HTML document templates.
 */function chatway_integration_preprocess_html(array &$variables) {
    $current_user = \Drupal::currentUser();

    // Load Chatway only for non-admin users
    if (!$current_user->hasPermission('administer site configuration')) {
        $variables['#attached']['html_head'][] = [
            [
                '#type' => 'html_tag',
                '#tag' => 'script',
                '#attributes' => [
                    'id' => 'chatway',
                    'src' => 'https://cdn.chatway.app/widget.js?id=xxxxxxxxxxxx',
                    'async' => 'true',
                ],
            ],
            'chatway_script',
        ];
    }
}
  

Step #6: Log in to your Drupal admin panel to activate the Chatway module.

Step #7: Tick the checkbox for Chatway Integration and click Install.

Once installed, check your website and the Chatway widget should show right away. Please see below on how it looks depending on your customizations.

When the chat window is closed and preview text bubble is enabled

Chat window open

A Plan That Grows With You Free Forever or Go Pro

Our free plan is built for most businesses. Pro is there when you need extra power and flexibility.

Sign Up for Free

No Credit Card Required

Chatway essential features
Capterra Capterra 2 Grid Leader Grid Leader High performancer 1 High performancer 2 High performancer 3 High performancer 4 High performancer 5 GetApp Customer Support
chatway footer logo

Improve live chat communication and unlock customer satisfaction with Chatway

app store logo play store logo

Company

  • About Us
  • Privacy Policy
  • GDPR
  • Terms of Service
  • Pricing

Resources

  • Contact Us
  • Integrations
  • Built For
  • Help Center
  • Comparison Page

© 2025 Chatway. All rights reserved.