How to Add Asyntai AI Chatbot to Drupal
Step-by-step guide for Drupal 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: Using Header and Footer Scripts Module (Recommended)
The easiest way to add the chatbot is using the "Header and Footer Scripts" module:
- Log in to your Drupal admin panel
- Go to Extend and click "Install new module"
- Search for "Header and Footer Scripts" or download it from Drupal.org
- Install and enable the module
- Go to Configuration → Development → Header and Footer Scripts
- Click on the "Footer" tab
- Paste your Asyntai embed code in the footer scripts text area
- Click "Save configuration"
Tip: Adding the code to the footer section ensures it loads after the page content, which is recommended for chat widgets.
Alternative: Edit Theme Template
You can add the code directly to your theme's template file:
- Navigate to your theme folder:
themes/your_theme/ - Open the html.html.twig file (or create one if it doesn't exist)
- Find the closing
</body>tag - Paste your Asyntai embed code just before the
</body>tag - Save the file
- Clear Drupal's cache: Configuration → Performance → Clear all caches
Important: Changes to theme files may be overwritten when updating your theme. Consider using a child theme or the Header and Footer Scripts module for a more permanent solution.
Alternative: Using Libraries (For Developers)
For developers who prefer using Drupal's asset library system:
- Create or edit your theme's *.libraries.yml file
- Add a new library entry:
asyntai-chatbot:
js:
https://asyntai.com/static/js/chat-widget.js: { type: external, attributes: { async: true, data-asyntai-id: YOUR_WIDGET_ID } } - Attach the library in your theme's *.info.yml file:
libraries:
- your_theme/asyntai-chatbot - Clear Drupal's cache
Step 3: Verify Installation
After saving your changes and clearing the cache, visit 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 to clear Drupal's cache by going to Configuration → Performance → Clear all caches. Also try clearing your browser cache or viewing in an incognito window.
Weebly