Widget SDK
The Maison chat widget is loaded via a single script tag and initialised with window.initMcbs(). This page documents every configuration option, control method, and callback available on the returned object. For platform-specific setup instructions, see the Integration Guides.
Basic usage
Configuration options
Pass these properties in the object argument to initMcbs():
| Property | Type | Required | Description |
|---|---|---|---|
| clientId | string | Yes | Your Client UUID from the Business Console. |
| sessionId | string | No | An existing session ID to restore a previous conversation. If omitted, a new session is created. |
| locale | string | No | BCP-47 locale code (e.g. en_US, fr_FR). Defaults to the browser locale. |
| iconPosition | object | No | Initial icon placement. Properties: top, bottom, left, right — each a number of pixels. Values must be plain numbers (e.g. 20), not strings with units (e.g. '20px'). |
| onSessionUpdate | function | No | Callback fired when a session is created or restored. Receives the session ID as its argument. |
| onLocaleUpdate | function | No | Callback fired when the chat language changes. Receives the new locale string. |
iconPosition values are plain numbers, not strings. Use
{ bottom: 20, right: 20 }, not { bottom: '20px', right: '20px' }. The widget interprets each value as pixels automatically.Control methods
The object returned by initMcbs() exposes these methods:
| Method | Description |
|---|---|
| showChat() | Open the chat interface |
| hideChat() | Close the chat interface |
| showIcon() | Display the chat icon |
| hideIcon() | Hide the chat icon |
| hideSuggestion() | Hide the suggestion prompt |
| updateLocale(locale) | Change the chat language at runtime |
| updateIconPosition(position) | Move the icon to a new position |
Full example
All configuration options together: