Add Contextual Help
Context tells Sol Helps where a question was asked. It replaces the current context without remounting the widget or clearing the active conversation.
Supported context
| Field | Limit or accepted value |
|---|---|
surface, workflow, step, section, feature | non-empty string, up to 80 characters |
contentId, version | non-empty string, up to 120 characters |
environment | production, staging, or development |
trigger | non-empty string, normalised to lowercase, up to 80 characters |
tags | at most 8 unique lowercase tags; 40 characters each; letters, numbers, :, _, - |
The complete object is limited to 1 KB. Unknown fields, nested values, control characters, invalid tags, and oversized input reject the whole update.
Use stable, low-cardinality identifiers:
const result = window.ChatbotWidget.setContext({
surface: "documentation",
workflow: "widget-installation",
step: "configure-allowed-domain",
section: "allowed-domains",
contentId: "docs/embed-and-deployment",
trigger: "inline-docs-help",
tags: ["installation", "security"],
});
Do not include names, email addresses, account IDs, question text, form values, dynamic labels, or arbitrary free-form metadata.
Open and focus the existing widget
window.ChatbotWidget.open({
context: {
surface: "documentation",
section: "allowed-domains",
},
source: "host",
});
open() applies valid context, opens a floating widget, and requests focus for
its existing input. It preserves the active conversation. A later launcher can
replace context and increase the context revision without resetting that
conversation. close() closes floating placement; it returns inline for an
inline widget because inline placement is already part of the page.
For a non-default target, pass the target ID first:
window.ChatbotWidget.setContext("help-widget", {surface: "documentation"});
window.ChatbotWidget.open("help-widget");
window.ChatbotWidget.close("help-widget");
Declarative launchers
The runtime observes existing and dynamically added elements with
data-sol-open:
<button
data-sol-open
data-sol-launcher-id="docs-allowed-domains"
data-sol-surface="documentation"
data-sol-workflow="widget-installation"
data-sol-step="configure-allowed-domain"
data-sol-section="allowed-domains"
data-sol-content-id="docs/embed-and-deployment"
data-sol-trigger="inline-docs-help"
data-sol-tags="installation,security"
>
Ask about this step
</button>
Supported context attributes mirror the fields above:
data-sol-surface, -workflow, -step, -section, -content-id,
-feature, -environment, -version, -trigger, and -tags.
data-sol-target selects a non-default widget. A launcher ID must contain only
letters, numbers, :, _, or - and be at most 80 characters.
If the widget is not initialised, a declarative click is left alone. Invalid context is rejected and logged as a bounded browser warning.
SPA context and evidence
Update context when the user crosses a meaningful workflow boundary, not for every component render. Eligible messages record message-level snapshots; a conversation may show a bounded journey as context or the page path changes. Context describes where the question arose. It does not prove why it arose and is not sent to the assistant request in the current release.
See Widget Runtime API for return values and Feedback, Consent, and Evidence for interpretation.