HomeBook a Demo

Integrated chat

Embed a full conversational chat in your page content. Readers pick a suggested question or type their own, and the answer streams in place.

The integrated chat placement renders a full conversational chat inside a target element on your page. It shows suggested questions about the page and a chat input, and the conversation stays in the page flow, not in an overlay. Use it below an article, in a sidebar, or anywhere you want readers to ask questions without leaving the content.

Mounting the placement

Pass Placement.IntegratedChat and a target to mount(). The target can be a string element ID:

window.InlineAI.mount(window.InlineAI.Placement.IntegratedChat, 'inline-ai-integrated-chat-embed');

The call returns a placement ID you can pass to unmount() later.

The integrated chat placement requires a target. Make sure the target element exists in the DOM before calling mount(). In auto mode, add an empty <div id="inline-ai-integrated-chat-embed"></div> where you want the chat. See placement anchor divs.

Mounting from the command queue

To mount from your page markup rather than after the script has loaded, push the command onto the command queue. Entries are buffered and replayed in order once the SDK is ready.

<div id="inline-ai-integrated-chat-embed"></div>
 
<script>
  window.InlineAI = window.InlineAI || {};
  window.InlineAI.cmd = window.InlineAI.cmd || [];
 
  // init() activates programmatic mode
  window.InlineAI.cmd.push(['init', { publisherId: 'YOUR_PUBLISHER_ID' }]);
 
  window.InlineAI.cmd.push(['mount', 'integrated-chat', 'inline-ai-integrated-chat-embed']);
</script>

Place that block before the embed snippet.

Pass the placement as the string 'integrated-chat' here rather than window.InlineAI.Placement.IntegratedChat. The enums are installed by the script itself, so they are not available to code that runs before it. See enums and the command queue.

Targeting the container

window.InlineAI.mount(window.InlineAI.Placement.IntegratedChat, 'inline-ai-integrated-chat-embed');

Positioning and sizing

By default the chat is 425px wide and 350px tall. A percentage, vw, or auto width makes it fill its container at 350px tall. When an answer runs long, a See full answer bar expands the chat (to 600px tall by default).

locationQueryInjectionLocation

Where to insert the placement relative to the target element:

  • window.InlineAI.InjectionLocation.Above: sibling before the target
  • window.InlineAI.InjectionLocation.Below: sibling after the target
  • window.InlineAI.InjectionLocation.Prepend: first child of the target
  • window.InlineAI.InjectionLocation.Append: last child of the target
widthQuerystring

Width of the chat as a CSS value (e.g. "425px", "100%").

maxWidthQuerystring

Maximum width of the chat as a CSS value.

heightQuerystring

Height of the chat as a CSS value.

maxHeightQuerystring

Maximum height of the chat as a CSS value.

breakpointsQueryBreakpointConfig[]

Responsive breakpoints with minViewportWidth, maxViewportWidth, width, and height per entry. The placement only renders when a breakpoint matches the current viewport.

Auto-answer

With auto-answer on, the chat answers one of its suggested questions as soon as it scrolls into view, so readers see an answer without typing. Ask your Inline contact to turn it on in your dashboard configuration.

Examples

window.InlineAI.mount(window.InlineAI.Placement.IntegratedChat, 'inline-ai-integrated-chat-embed');

The integrated chat stays in the page flow, so it works inside iframes where overlay placements do not. See embedding inside an iframe.

For unmounting and SPA routing patterns, see the programmatic control guide.