init reference
Start with initialization and configuration priority. This reference covers initial configuration. After startup, use the separate runtime parameters.
init Parameter Reference
The loader accepts only supported top-level keys:
| Key | Type | Required / default | Purpose |
|---|---|---|---|
channel_id |
string |
Required | Widget channel ID from the generated code. |
user |
object |
Optional | Visitor data. Whenever external_id is supplied, it must have a server-generated user_hash. |
theme |
object |
Optional | Overrides for appearance, popup dimensions, text, and the floating button. Unspecified fields come from channel settings. |
features |
object |
Optional | Chat feature overrides. Unspecified fields come from channel settings. |
welcome |
object |
Optional | Greeting type: mode: "centered_text" or mode: "automation_message" with the automation_id and node_id of an allowed channel message. Omit to inherit channel settings. |
lang |
"ru" | "en" | "auto" |
"auto" |
Interface language. |
display_mode |
"popup" | "embedded" |
"popup" |
Chat placement mode. |
headless |
boolean |
false |
SDK for a custom interface: no floating button or built-in chat, with a hidden iframe for authentication and data exchange. Incompatible with embedded and button_only. Set only during initialization. |
surfaceVisible |
boolean |
true |
Whether the website container is visible, for read receipts. Update through configure for a hideable panel; this does not change its layout. |
button_only |
boolean |
false |
A non-interactive floating button without a chat iframe. Incompatible with embedded. |
container |
CSS selector or DOM Element |
Required for embedded |
Embedded-widget container. Pass it at popup startup as well if you will switch modes through the Public API later. |
shell |
object |
Empty object | collapse_button and mobile_edge_swipe; both are off until set to true. |
onCollapse |
function |
Optional | Callback for an embedded-widget collapse request. |
onReady |
function |
Optional | Called once after successful chat initialization; receives channel_id, display_mode, and button_only. In button_only mode, reports button readiness. |
onError |
function |
Optional | Receives the first startup failure: an Error with code, message, and retryable. See callback details. |
contextProvider |
function |
Optional | Synchronous provider of persistent page context. |
resolveRuntime |
function |
Optional | Synchronously selects the greeting and appearance using visitor facts and website conditions. Does not execute dialog commands. |
pageElementActions |
object |
Optional | execute / clear adapter for controlling elements of an embedded application. Contract and example. |
customActions |
object |
Empty set | Site buttons and actions available in chat. |
customActionsLanguage |
"ru" | "en" |
Not set | Description language for customActions. |
debug |
boolean |
false |
Additional loader console messages. |
Other top-level keys are errors. Calling SenlerWidget.init(...) again destroys the current instance and creates a new one, so use Public API methods for temporary changes.
Chat Features
features key |
What it enables | Default |
|---|---|---|
file_upload |
File attachments. | true |
live_voice |
Start a live conversation. It must also be enabled in channel and published-agent settings. | false |
voice_messages |
Voice-message recording. | false |
emoji |
Emoji picker. | true |
split_view |
At widths of 640 pixels and above, shows the dialog list beside the current chat. | true |
element_selection |
Selecting an element on the host page for a question. | false |
mcp_button |
Shows the Work via MCP button when the MCP connection is enabled in channel settings. Setting it to false hides the button only in this instance without disabling WebMCP. |
true |
The element_selection flag alone is not enough for stable references. Add data-ai-* markup so labels remain clear and elements can be found again.