For the complete documentation index, see llms.txt. This page is also available as Markdown.

Embed MaiGPT in Window Mode

Embed a full ChatGPT-style conversation interface directly into your website using MaiGPT window mode, with Deep Research and tool selection.

In addition to the common "floating button in the bottom-right corner," MaiAgent's Web Chat SDK introduces MaiGPT window mode, which lets you embed a full ChatGPT-style conversation interface (conversation history list on the left + main conversation area on the right) directly into any position on your own page as the primary UI, rather than a small widget tucked in a corner.

This page explains how to embed MaiGPT window mode on your own website. If you have not yet created a Web Chat channel, please refer to Connect a Conversation Channel: Website to complete the basic setup first.

Where to Start? Get the Embed Code

The embed code on this page is obtained from Basic Settings. Follow the steps below:

1

Open the Conversation Channel Settings

Under "Customer Conversations > Conversation Channels", select your Web Chat channel and click "Actions" to open the settings page.

2

Click "Embed"

In Basic Settings, find the Public Access URL section and click the "Embed" button to open the embed window.

Embed button in Basic Settings
Basic Settings > Embed
3

Select the MaiGPT Embed Method

Switch between the three embed methods at the top of the window and select "MaiGPT":

Embed Method
Description

JavaScript

Loaded via <script>, the most common method

Iframe

Embedded directly via <iframe>

MaiGPT

The full ChatGPT-style interface described on this page

On the left side, you can adjust the embed container (targetElement), locale (locale), and title (maigptTitle).

Embed window with MaiGPT method selected, real-time code preview on the right
Embed Window > Select MaiGPT > Real-time code preview on the right
4

Copy the Code and Paste It into Your Website

The code preview on the right updates in real time based on the left-side settings. Click "Copy" to get the embed code as shown below:

<script>
  window.maiagentChatbotConfig = {
    webChatId: 'Your Web Chat ID',
    baseUrl: 'https://your-maiagent-domain/web-chats',
    enabledWindowModes: ['maigpt'],
    targetElement: '#maigpt-container',
  }
</script>
<script src="https://your-maiagent-domain/js/embed.min.js" defer></script>

For a full description of each parameter and the two layouts (embed container / bottom-right full-screen button), see 3. Embed Setup below.

1. What Is MaiGPT Window Mode?

The Web Chat SDK provides four window modes, specified via enabledWindowModes in the embed configuration:

Window Mode
Description

floating

Default mode. A floating button in the bottom-right corner that expands into a conversation window when clicked. Suitable for general customer service.

sidebar

Sidebar mode. The conversation window slides out from the side of the page.

inline

Inline mode. The conversation window is embedded within the page content area.

maigpt

The mode described on this page. A full ChatGPT-style interface with the conversation history list expanded by default, suitable as the primary page UI.

Key features of MaiGPT window mode:

MaiGPT window mode interface overview
MaiGPT Window Mode: Conversation history list on the left + main conversation area on the right (ChatGPT style)
  • Full interface: The iframe fills the container you specify (or the entire browser window), with the conversation history list on the left and the main conversation area on the right

  • No floating button, cannot be minimized: Once embedded, it becomes the main body of the page, with no collapsible corner button

  • Conversation history expanded by default: Users can see past conversation records as soon as they arrive

  • Advanced feature access points: The input area provides Deep Research and the tool toggle

2. Prerequisites

Before embedding MaiGPT window mode, please confirm the following:

  1. Your MaiAgent version supports MaiGPT window mode: MaiGPT window mode is a new Web Chat SDK feature and requires both the SDK (embed.min.js) and the backend to be versions that support MaiGPT. Only then will the "MaiGPT" option appear in the embed window.

  2. You have created a Web Chat channel and obtained its Web Chat ID (see Connect a Conversation Channel: Website).

  3. Obtain the embed script: Click the "Embed" button on the conversation channel settings page to get the embed code.

MaiAgent cloud service (chat.maiagent.ai) has MaiGPT window mode built in and ready to use. For private deployments or older versions, the "MaiGPT" option may not appear in the embed window. Please confirm with MaiAgent and upgrade to a supported version.

3. Embed Setup

1. Basic Embed Code

The code copied from the embed window can be used as is (see Get the Embed Code above). Paste it before the </body> tag on your website. enabledWindowModes is an array, and the first element is the default window mode. To use MaiGPT window mode, put 'maigpt' as the first item.

2. Two Embed Methods

Whether you set targetElement determines how MaiGPT is displayed:

  • Embed in a specified container (set targetElement): MaiGPT stays permanently in the block you specify as the main body of the page. No floating button is displayed, and window modes cannot be switched. Suitable for the main workspace of an AI portal or system.

  • Open full screen from a bottom-right button (do not set targetElement): A button appears in the bottom-right corner of the page, and clicking it opens MaiGPT in full screen. You can close it from the top-right corner to return to the button. Suitable when you don't want to change the existing layout and just want to add an entry point.

When targetElement is not set, the SDK provides a floating button in the bottom-right corner
When targetElement is not set, a button appears in the bottom-right corner of the page, and clicking it opens full screen

For the complete code for both methods, container height requirements, behavior when the container cannot be found, and how to embed in an SPA, engineers should refer to MaiGPT Mode Embedding in the Technical Manual.

4. Configuration Parameter Reference

The code generated by the embed window already includes the required fields: webChatId and baseUrl are required, and MaiGPT will not appear without them; enabledWindowModes is set to ['maigpt']. The optional fields you can adjust on the left are targetElement (embed container), locale (language), and maigptTitle (sidebar title, which displays MaiGPT by default).

For the types and descriptions of all fields, see MaiGPT Mode Embedding: Full Parameter Reference in the Technical Manual. The legacy defaultWindowMode field is no longer recommended; please use enabledWindowModes instead.

5. Interface and Features

1. Conversation History List

The left side of MaiGPT window mode features a persistent conversation history list (ChatGPT style), expanded by default. Users can:

  • Browse and switch between past conversations

  • Start a new conversation

  • Collapse / expand the sidebar

2. Deep Research

When opened in MaiGPT window mode, a Deep Research entry point appears in the input area. Users can click Deep Research first and then send a message, and the Agent will perform deep research on that message.

Deep Research goes through the following states: Not used → Started → Running → Completed / Failed.

While Deep Research is in progress (running), it cannot be triggered again; it can only be started again after it has "Completed" or "Failed".

3. Tool Toggle

When opened in MaiGPT window mode and the Agent has tools attached, users can check the tools they want to use this time in the tool menu, and the message they send will specify the checked tools. If none are checked, the Agent decides on its own from all available tools. Selections apply only to the current conversation.

4. Settings Menu

Click Settings in the bottom-left corner to open the settings menu. The items actually displayed depend on the backend settings of that Web Chat, and may include:

  • Text language: Switch the interface language

  • Text size: Small / Medium / Large (requires the font size switching feature to be enabled in the backend)

  • Theme mode: Auto / Light / Dark (requires theme mode switching to be enabled in the backend)

  • Voice language: The language used for voice input

MaiGPT window mode settings menu
Settings menu (actual items depend on backend settings)

6. Notes

  • Responsive: The MaiGPT layout supports both desktop and mobile devices, and supports dark mode.

  • Compatible with existing modes: MaiGPT is a new window mode and does not affect the behavior of the existing floating / sidebar / inline modes; existing integrations require no changes.

Last updated

Was this helpful?