Drupal Integration Guide
Complete guide to integrate CallMeBack with Drupal
Integrate CallMeBack with your Drupal website to capture leads from contact forms, webforms, and custom forms. Drupal powers over 1 million websites worldwide and offers powerful content management capabilities.
Prerequisites
- A CallMeBack account - Sign up here
- Your CallMeBack integration code from your dashboard
- Drupal admin access (Administrator role)
- Drupal 8.x, 9.x, or 10.x installation
- Basic understanding of Drupal modules (for custom module method)
Integration Methods
Custom Module
Create a custom Drupal module for CallMeBack integration. This is the most maintainable and Drupal-friendly approach.
Create Module Directory
- Navigate to
/modules/custom
in your Drupal root directory - Create a new directory called
callmeback_integration
- Create the module info file
callmeback_integration.info.yml
name: 'CallMeBack Integration'
type: module
description: 'Integrates CallMeBack lead capture widget with Drupal'
package: Custom
core_version_requirement: ^8 || ^9 || ^10
version: '1.0.0'
dependencies:
- drupal:system
Important Note
Create Module Files
- Create
callmeback_integration.module
file - Create
callmeback_integration.libraries.yml
file - Create
js/callmeback.js
file in your module directory
<?php
/**
* @file
* CallMeBack Integration module.
*/
use Drupal\Core\Routing\RouteMatchInterface;
/**
* Implements hook_help().
*/
function callmeback_integration_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
case 'help.page.callmeback_integration':
return '<p>' . t('CallMeBack integration for capturing leads.') . '</p>';
}
}
/**
* Implements hook_page_attachments().
*/
function callmeback_integration_page_attachments(array &$attachments) {
$attachments['#attached']['library'][] = 'callmeback_integration/callmeback';
}
Important Note
Create Library Definition
callmeback:
js:
js/callmeback.js: {}
dependencies:
- core/drupal
- core/jquery
Important Note
Add JavaScript File
(function ($, Drupal, drupalSettings) {
'use strict';
Drupal.behaviors.callmebackIntegration = {
attach: function (context, settings) {
// Use once() to ensure the script only runs once per element
$(context).find('body').once('callmeback').each(function() {
// Load CallMeBack script dynamically
var script = document.createElement('script');
script.src = 'https://widget.callmebackbutton.com/widget.js';
script.setAttribute('data-account', 'YOUR_ACCOUNT_ID');
script.setAttribute('data-drupal', 'true');
document.head.appendChild(script);
});
}
};
})(jQuery, Drupal, drupalSettings);
Important Note
Enable and Test Module
- Go to Extend in your Drupal admin
- Find 'CallMeBack Integration' and check the checkbox
- Click Install
- Clear cache via Configuration → Performance → Clear all caches
- Visit your site to verify the widget appears
Important Note
Troubleshooting
Still having issues?
Can't find the answer you're looking for? Our support team is here to help with your integration.
Related Integrations
References & Official Documentation
Next Steps
Configure CallMeBack
- Set up your business hours and timezone
- Configure callback phone numbers
- Set up email notifications
- Add team members to your account
Advanced Features
- Set up custom form templates
- Configure lead scoring rules
- Integrate with your CRM
- Set up automated workflows