Documentation / Home

Setting Up Maison Chat Bot Integration

This guide will help you integrate the Maison Labs Chat Bot into your website. Please follow these steps carefully. If you have any questions, feel free to reach out to Maison Labs support.

Prerequisites

  • Basic JavaScript skills (enough to edit your website's code).
  • Access to edit your website's HTML and JavaScript.
  • Your Maison Labs client ID (provided by Maison Labs).

Steps to Integrate

1. Add the JavaScript File

Add the Maison Labs script to the <head> section of your HTML file.

The following is an example:

Example code
1<script type="text/javascript" src="https://maison-labs.com/agent-inject.bundle.js" id="maison-chat-js"></script>

2. Initialize the Maison Agent

Place the following script anywhere in your HTML file (e.g., before the closing </body> tag). You can use the example below to initialize the Maison Agent. If you need to retrieve a session ID, refer to the getQueryParam example provided.

This is one way to track the session ID, but you are free to implement this functionality however you prefer.

Example code
1<script type="text/javascript">
2    // Example function to get query string parameters
3    function getQueryParam(param) {
4        const queryString = window.location.search;
5        const urlParams = new URLSearchParams(queryString);
6        return urlParams.get(param);
7    }
8
9    const sessionId = getQueryParam ? getQueryParam('mcbsid') : null;
10    // Retrieve the session ID from the query string (or use your preferred method)
11
12    const mcAgent = initMcbs({
13        clientId: 'YOUR_CLIENT_ID', // Replace with your client ID
14        sessionId: sessionId, // Pass an existing session ID or do not define to create a new session.
15        locale: 'en_US', // Default language/locale
16        onSessionUpdate: (sessionId) => {
17            console.log('Updated session ID: ', sessionId);
18            // Use this callback to track session ID updates
19        },
20        onLocaleUpdate: (locale) => {
21            console.log('Chat locale updated: ', locale);
22        }
23    });
24
25    // Show the chat bot icon
26    if (document.readyState === "loading") {
27      document.addEventListener("DOMContentLoaded", mcAgent.showIcon);
28    } else {
29      mcAgent.showIcon();
30    }
31</script>

Using Maison Agent Functions

After integration, you can control the chat bot using the following functions:

Example code
Description

mcAgent.showChat()

Opens the chat interface.

mcAgent.hideChat()

Hides the chat interface.

mcAgent.hideSuggestion()

Hides any chat suggestions.

mcAgent.showIcon()

Displays the Maison Labs chat bot icon.

mcAgent.hideIcon()

Hides the Maison Labs chat bot icon.

mcAgent.updateLocale(locale)

Changes the chat bot's language/locale (e.g., 'en_US', 'fr_FR').

mcAgent.updateIconPosition(position)

Updates the icon position dynamically.
Provide { top: value_in_pixels, left: value_in_pixels, right: value_in_pixels, bottom: value_in_pixels}.

Customization Tips

Icon Position

  • Initial Setup: The iconPosition property in initMcbs sets the chat bot icon position. For example:
Javascript
1iconPosition: {
2    bottom: 80 // Position the icon 80 pixels from the bottom of the screen
3}
  • Dynamic Updates: Update the icon position at runtime using:
Javascript
1mcAgent.updateIconPosition({ top: 100, left: 20 });

Replace top, bottom, left, or right with the desired pixel values.

Session Tracking

  • The onSessionUpdate callback provides the session ID whenever the chat bot creates or updates a session. You can use this ID to track the session in your analytics or backend systems.

Custom Chat Trigger

  • If you prefer using your own element to trigger the chat instead of the Maison Labs icon, call mcAgent.showChat() directly when your element is clicked.

Troubleshooting

  • Chat Bot Icon Not Visible: Ensure the script URL (https://maison-labs.com/agent-inject.bundle.js) is accessible.
  • Errors in Console: Check the browser's developer tools for JavaScript errors and verify your client ID is correct.
  • Chat Does Not Open: Confirm that the initMcbs function is correctly configured and that you've called showIcon().

Congratulations! You've successfully integrated the Maison Labs Chat Bot into your website.

Website builder instructions

Squarespace

To integrate with sqarespace, you need access to code injection. This requires a subscription with access to "Complete Customization With CSS and JavaScript".

  1. In the sqarespace website editor, navigate to Website > Pages.
  2. Scroll to Utilities section at the bottom of the panel and open Website tools
  3. Open Code Injection and inject scripts in steps #1 and #2 into the HEADER text area

Webflow

Integrate Maison on your Webflow site by accessing your project’s custom code settings and adding the Maison scripts to the Head section.

  1. Log in to Webflow: Open your Webflow dashboard and select the project you wish to integrate with Maison.
  2. Access Project Settings: Click on the “Project Settings” for your selected site.
  3. Navigate to Custom Code: Go to the “Custom Code” tab within your project settings.
  4. Inject Maison Scripts: Paste the Maison chat bot script snippets into the “Head Code” area as provided in your Maison documentation (steps #1 and #2).
  5. Save and Publish: Click “Save Changes” and then publish your site to ensure the chat bot is active.

Framer

Integrate Maison into your Framer project by using Framer’s custom code block to inject the Maison chat bot scripts into your site’s header.

  1. Open Your Project: Log in to Framer and select the project you want to enhance with Maison.
  2. Access Code Injection Tools: Locate the option to add custom code – this can usually be done by inserting a custom code block/component.
  3. Add Maison Scripts: Copy the Maison chat bot script snippets (steps #1 and #2) and paste them into the custom code block, ensuring they are placed within the <head> section.
  4. Confirm and Preview: Save your changes and preview your site to verify that the Maison chat bot loads correctly.
  5. Publish Your Site: Once confirmed, publish the site so visitors can access the chat bot.

WIX

1<script>
2    const script = document.createElement('script');
3    script.src = 'https://maison-labs.com/agent-inject.bundle.js';
4    script.onload = function () {
5        function getQueryParam(param) {
6            const queryString = window.location.search;
7            const urlParams = new URLSearchParams(queryString);
8            return urlParams.get(param);
9        }
10        const sessionId = getQueryParam('mcbsid');
11        const mcAgent = window.initMcbs({
12            clientId: 'ea4d0d2d-9f03-41de-8864-179e74c2cd0b',  // Replace with your client id
13            sessionId: sessionId,
14            locale: 'en_US'
15        });
16        mcAgent.showIcon();
17    };
18    document.head.appendChild(script);
19</script>

  1. Inject above code toWix dashboard -> settings -> custom code -> add custom code.
  2. In the add custom code dialog, set to all pages, head, load code once.

WordPress

Integrate Maison into your WordPress site by injecting the Maison chat bot scripts into your site’s header, either via a plugin or theme editor.

  1. Log in to WordPress: Sign in to your WordPress dashboard
  2. Choose Your Integration Method:
    • Using a Plugin: Install and activate a plugin like “Insert Headers and Footers.”
    • Using Theme Editor: Alternatively, navigate to Appearance > Theme Editor.
  3. Inject Maison Scripts:
    • For Plugin Users: Go to the plugin’s settings and paste the Maison chat bot script snippets (steps #1 and #2) into the header section field.
    • For Theme Editor Users: Open your header.php file and insert the Maison chat bot script snippets right before the closing </head> tag.
  4. Save Your Changes:
    • For plugin users, simply save the settings.
    • For theme editor users, update the file.
  5. Test and Publish: Visit your site to verify the chat bot is active. If using the theme editor, ensure you have a backup in case of issues.

Cloudbeds - How to sign up for Maison

You can sign up for Maison for Cloudbeds in any of these ways:

After sign-up, you will receive access to the Maison Operator Panel to configure your chat agent.

How to connect Maison with Cloudbeds for the first time

  1. Log in to Cloudbeds.
  2. Click Account (top right) and open Apps & Marketplace.
  3. Search for Maison.
  4. Click Connect App.
  5. Authorize Maison to access your Cloudbeds account.
  6. You will be redirected to Maison to finish setup.
  7. Select the property (or properties) you want to connect.
  8. Confirm your hotel name, hotel id, and api key in the Maison Operator Panel.

Once connected, Maison will incorporate the availability, rates, and inventory feeds into the guest conversations.

Specific functionality of the integration

With the Cloudbeds integration enabled, Maison can support:

  • Availability-aware guest answers (when configured), to reduce booking friction
  • Policy and property information alignment using Cloudbeds-connected context plus your website/other content you upload
  • Lead capture routing for group, event, and room-block inquiries
  • Operational deflection by answering repetitive questions more accurately using connected data
  • Property-level configuration for multi-property accounts (each property can have its own agent)

Note: Exact data fields available depend on Cloudbeds permissions and the integration configuration enabled for your account.

Disconnection steps

  • Go to apps and market place by clicking on the profile icon
  • Open the "connected apps" tab
  • Look for maison
  • Click on disconnect
  • In the confirmation dialog, click on "Disconnect app"