How to Add Asyntai AI Chatbot to Backdrop CMS
Step-by-step guide for Backdrop CMS websites
Step 1: Get Your Embed Code
First, go to your Asyntai Dashboard and scroll down to the "Embed Code" section. Copy your unique embed code which will look like this:
<script async src="https://asyntai.com/static/js/chat-widget.js" data-asyntai-id="YOUR_WIDGET_ID"></script>
Note: The code above is just an example. You must copy your own unique embed code from your Dashboard as it contains your personal widget ID.
Step 2: Add to Theme Template (Recommended)
Backdrop CMS uses .tpl.php template files in its themes. The recommended approach is to add the embed code directly to your active theme's page template:
- Access your Backdrop CMS installation via FTP or File Manager
- Navigate to your active theme's directory: themes/yourtheme/
- Open the page.tpl.php file (or layout.tpl.php depending on your theme)
- Find the closing </body> tag or the line <?php print $page_bottom; ?>
- Paste your Asyntai embed code just before that line
- Save the file
<!-- Asyntai AI Chatbot -->
<script async src="https://asyntai.com/static/js/chat-widget.js" data-asyntai-id="YOUR_WIDGET_ID"></script>
<?php print $page_bottom; ?>
</body>
Tip: Placing the code just before <?php print $page_bottom; ?> or the closing </body> tag ensures the chatbot loads after the page content, providing better page load performance. This method automatically adds the chatbot to every page using this theme.
Alternative Method 1: Using a Custom Module
You can create a simple Backdrop CMS module that injects the chatbot script using backdrop_add_js():
- Create the module directory: modules/custom/asyntai_widget/
- Create the module file asyntai_widget.module with the following code:
// modules/custom/asyntai_widget/asyntai_widget.module
function asyntai_widget_init() {
backdrop_add_js('https://asyntai.com/static/js/chat-widget.js', array(
'type' => 'external',
'scope' => 'footer',
'attributes' => array('async' => 'async', 'data-asyntai-id' => 'YOUR_WIDGET_ID'),
));
} - Create the asyntai_widget.info file:
name = Asyntai AI Chatbot Widget
description = Adds the Asyntai AI chatbot widget to all pages.
backdrop = 1.x
package = Custom
type = module - Go to Functionality (admin/modules) in your Backdrop admin panel
- Find "Asyntai AI Chatbot Widget" under the Custom package and enable it
- Click "Save configuration"
Note: Replace YOUR_WIDGET_ID in the module code with your actual widget ID from the Asyntai Dashboard. The custom module approach is upgrade-safe and won't be overwritten when updating your theme.
Alternative Method 2: Using Backdrop's "Add to Head" Module
The contributed "Add to Head" module provides an easy way to inject scripts without editing code:
- Download and install the "Add to Head" contributed module from the Backdrop CMS website
- Go to Configuration > Development > Add to Head
- Add your Asyntai embed code in the footer section
- Click "Save configuration"
Tip: Using the "Add to Head" module is the easiest method if you prefer not to edit theme files or create custom modules. It provides a simple admin interface for managing injected scripts.
Alternative Method 3: Using Block System
Backdrop CMS's layout and block system can also be used to add the chatbot:
- Log in to your Backdrop CMS admin panel
- Go to Structure > Layouts
- Select the layout you want to edit (e.g., the default layout)
- Click "Add block" in the footer region
- Choose "Custom block"
- Set the block format to "Full HTML" or "Raw HTML"
- Paste your Asyntai embed code into the block body
- Give the block a title (e.g., "Asyntai Chatbot") and optionally check "Hide title"
- Click "Save block" and then "Save layout"
Important: Make sure the text format is set to "Full HTML" or "Raw HTML" so the script tag is not stripped out. The default "Filtered HTML" format will remove script tags for security reasons.
Step 3: Clear Cache and Verify
After making your changes, clear Backdrop CMS's cache and verify the installation:
- Go to Configuration > Performance in your admin panel
- Click "Clear all caches"
- Open your website in a new browser tab or incognito window
- You should see the chat widget button in the bottom right corner
- Click it to make sure it opens and works correctly
Not seeing the widget? Make sure you've cleared Backdrop CMS's cache at Configuration > Performance. Try viewing your site in an incognito window or clearing your browser cache. Open the browser console (F12) to check for any JavaScript errors. If you used the custom module method, verify the module is enabled under Functionality.
Weebly