How to Add Asyntai AI Chatbot to October CMS

Step-by-step guide for October CMS websites

Get Embed Code

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 Layout Template (Recommended)

The recommended way to add the chatbot is by editing your default layout in the October CMS backend:

  1. Log in to your October CMS backend
  2. Go to CMS > Layouts in the main menu
  3. Open your default layout (usually default.htm)
  4. Find the closing </body> tag and the {% scripts %} placeholder
  5. Add your Asyntai embed code just before {% scripts %} and </body>:
    <script async src="https://asyntai.com/static/js/chat-widget.js" data-asyntai-id="YOUR_WIDGET_ID"></script> {% scripts %} </body>
  6. Click "Save" to apply your changes

Tip: Placing the script before {% scripts %} and </body> ensures it loads after the page content, which is recommended for chat widgets and won't slow down your page loading.

Alternative Method 1: Using {% put scripts %} Block

You can use the October CMS scripts placeholder to inject the chatbot from a page or partial:

  1. Open any page or partial in the CMS editor
  2. Add the following code using the {% put scripts %} block:
    {% put scripts %} <script async src="https://asyntai.com/static/js/chat-widget.js" data-asyntai-id="YOUR_WIDGET_ID"></script> {% endput %}
  3. Replace YOUR_WIDGET_ID with your actual widget ID from the dashboard
  4. Click "Save"

Note: For this method to work, your layout must include the {% scripts %} placeholder in its markup. This is where October CMS renders all injected scripts. Most default layouts already include this tag.

Alternative Method 2: Using Component PHP

If you prefer a programmatic approach, you can add the chatbot script via a custom component:

  1. Create or modify a component in your October CMS plugin
  2. In the component's onRun() method, use the addJs() method:
    public function onRun() { $this->addJs('https://asyntai.com/static/js/chat-widget.js', [ 'async' => true, 'data-asyntai-id' => 'YOUR_WIDGET_ID' ]); }
  3. Replace YOUR_WIDGET_ID with your actual widget ID
  4. Register the component on the pages where you want the chatbot to appear

Tip: Using a component gives you programmatic control over when and where the chatbot loads. You can add conditional logic inside onRun() to control loading based on user roles, page types, or other criteria.

Alternative Method 3: Using a Partial

You can create a reusable partial for the chatbot widget:

  1. Go to CMS > Partials in the October CMS backend
  2. Click "+ Add" to create a new partial
  3. Name it asyntai-widget.htm
  4. Add your Asyntai embed code to the partial:
    <script async src="https://asyntai.com/static/js/chat-widget.js" data-asyntai-id="YOUR_WIDGET_ID"></script>
  5. Click "Save"
  6. Open your layout template and include the partial before </body>:
    {% partial 'asyntai-widget' %}
  7. Save the layout

Tip: Using a partial makes it easy to enable or disable the chatbot across your entire site by simply adding or removing the partial include from your layout.

Step 3: Verify Installation

After saving your changes, visit your October CMS 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 saved all changes in the CMS backend. Clear your browser cache or view in an incognito window. If your site uses caching, clear the October CMS cache by running php artisan cache:clear from the command line, or use the Settings > System > Clear Cache option in the backend.

Layout Selection: Make sure the pages where you want the chatbot to appear are using the correct layout. You can check which layout a page uses by opening the page in CMS > Pages and looking at the Layout dropdown in the page settings.