AssistantGPTWidget('boot', settings)# Initialise the widget. Normally called once by the install snippet, but you can call it again at runtime to re-bind to a different widget key or user. Resolves nothing — fires the 'boot' event on success.
- organisation_uidrequired
- string — the Frontiers organisation that owns this widget (e.g.
org-frontiers). - widget_keyrequired
- string — public widget key (
pk_live_...) that scopes the agent, corpus, tools, and quotas. - user_id
- string? — Phase 2 identity: durable visitor id known to the host app. Paired with
user_hash; ignored on its own. - user_hash
- string? — Phase 2 identity: HMAC-SHA256 of
user_idkeyed by the widget'ssigning_secret. Mint server-side; same shape as Intercom Identity Verification. - user
- object? — descriptive profile fields shown in the assistant UI (
name,email, …). Never used for authorisation — only the(user_id, user_hash)pair is trusted. - custom_attributes
- object? — arbitrary structured properties attached to the visitor for the agent's context (plan tier, signup date, cart total…). Plain JSON only.
- capture_page_context
- boolean? — when
true, forwards a snapshot of the page (URL, title, visible text capped at 6 KB) to the iframe whenever the panel opens. Off by default — opt in only where the host page's content isn't sensitive. - api_base
- string? — override the server origin the iframe and JSAPI talk to. Defaults to the origin
loader.jswas served from. Useful for self-hosted mirrors. - alignment
- 'right' | 'left'? — which corner to dock the launcher in. Defaults to
right. - horizontal_padding
- number? — pixel offset from the docked corner along the X axis. Default 20.
- vertical_padding
- number? — pixel offset from the docked corner along the Y axis. Default 20.
- open
- boolean? — auto-open the panel right after boot. Intercom-compat. Off by default.
Giving the agent context — three patterns, pick by recency. The widget deliberately separates static, snapshot, and dynamic context so the agent sees fresh data without the host having to re-boot the widget on every page change.
custom_attributes — static, mutable. Set on boot, patch via update. Use for plan tier, signup date, role tags — things that change rarely.
capture_page_context — snapshot, opt-in. When true, the loader forwards the page's URL + title + visible text (6 KB cap) once per panel open. Use for "summarise this article" / "what does this say about X" flows on content-heavy pages.
request_host_event — dynamic, per-turn. Documented under on / off below. The agent calls a named host event from a tool call; your on('event', (name, data, reply) => reply(...)) handler returns a structured value the LLM consumes in the next turn. Use for cart contents, current role, form state — anything that changes during the conversation and the agent needs right now.
// Normally fired by the install snippet, but you can re-boot at
// runtime to re-bind to a different widget key or user.
AssistantGPTWidget('boot', {
organisation_uid: 'org-frontiers',
widget_key: 'pk_live_...',
user_id: 'usr_123', // optional, paired with user_hash
user_hash: '<hmac-sha256>', // mint server-side
custom_attributes: { plan: 'premium' },
capture_page_context: true,
})