Runtime configuration
First initialize a compatible widget version. Use resolveRuntime to choose settings based on website conditions, or SenlerWidget.configure(settings) to change the current instance explicitly.
Runtime parameters
Settings apply to this instance only: they are not saved in channel settings and do not survive its destruction.
SenlerWidget.configure({
lang: "ru",
themeMode: "dark",
borderRadius: 18,
});
| Parameter | Type | Effect |
|---|---|---|
welcome |
object | null |
Greeting: { mode: "centered_text" } or { mode: "automation_message", automation_id, node_id } from allowed messages. null restores channel settings. An existing conversation retains its history; the selection applies to the next new dialog. |
lang |
"ru" | "en" | "auto" |
Interface language. |
displayMode |
"popup" | "embedded" |
Placement. For embedded mode, supply container during initialization. |
surfaceVisible |
boolean |
Container visibility for read receipts. false does not hide the container or stop requests. Collapsible panel. |
themeMode |
"light" | "dark" | "auto" |
Light, dark, or the browser preference. Syncing with the website theme. |
borderRadius |
number |
Corner radius from 0 to 50. |
shell |
object |
collapse_button and mobile_edge_swipe. |
customActionsLanguage |
"ru" | "en" |
Action description language. |
Names depend on the configuration layer: init uses display_mode, theme.theme_mode, and theme.border_radius; configure uses displayMode, themeMode, and borderRadius. A resolveRuntime result still uses theme_mode and border_radius.
Parameter constraints
configure accepts presentation settings only. Unknown fields, incorrect types, and out-of-range values produce an error. Omitted fields retain their current values; shell merges field by field. If resolveRuntime overrides the same field, its result takes priority over the base setting.
Use separate methods for other tasks:
ask(options)sends a question and returns answers.selectDialog(dialogId, { contextItems, focusInput })selects a dialog and optionally replaces the next message's context.await startNewDialog({ contextItems, focusInput })creates and selects an empty dialog and returns its ID; it sends no message.setPageContext(items)replaces page context.registerAction(name, definition)registers a site action.
open() only shows the chat. In an SPA, update the required data through separate methods while retaining the current instance. See widget events for readiness and error handling.