Oyster Widget Developer Docs (v0.2.0)
This is the legacy documentation for integrations pinned to v0.2.0. New integrations should use v1 docs.
What you ship
One script tag plus a small init call. The widget opens as an embedded overlay and can be opened, minimized, or closed.
Two display modes
Float shows a floating launcher automatically. Inline lets you control when to call open().
Events
Your callback receives checkout, minimized, and closed events.
Overview
The Oyster widget is embedded by loading a UMD bundle that exposes a global OysterskinWidget. You create a widget instance using one of the factory methods:
- OysterskinWidget.createScanWidget(options)
- OysterskinWidget.createChatWidget(options)
- OysterskinWidget.createUnifiedWidget(options)
- OysterskinWidget.createConsultationWidget(options)
Each factory returns an instance with open(), minimize(), and close().
Permissions: the widget is embedded using an iframe with allow="camera *; geolocation *". If camera access is needed, your site must be served over HTTPS.
Quickstart
Replace placeholders like YOUR_VENDOR_KEY and YOUR_END_USER_ID. Your callback is required and receives widget events.
Minimal standalone examples: float mode and inline mode.
Use the playground below to validate your key + event plumbing quickly (no code changes required).
Playground
This snippet reflects your current playground settings. Your vendor key is never inlined; replace YOUR_VENDOR_KEY.
Loading the bundle
The widget is distributed as a UMD script that exposes a global OysterskinWidget. Load exactly one:
<script src="https://sandbox.widget-lib.oysterskin.com/v0.2.0/oysterskin-vendor-widget-web.umd.js"></script>
<script src="https://widget-lib.oysterskin.com/v0.2.0/oysterskin-vendor-widget-web.umd.js"></script>
Modes (float vs inline)
Float mode
Create the widget with mode: "float". A floating launcher appears immediately; users open the widget by clicking it.
Inline mode
Create the widget with mode: "inline". No launcher is shown automatically. You decide when to call instance.open().
Both modes support minimize() which hides the widget and shows the floating launcher again.
Widget types
- Scan: createScanWidget
- Chat: createChatWidget
- Unified: createUnifiedWidget
- Consultation: createConsultationWidget
All widget types share the same instance contract and most options.
Options reference
- key (string, required): vendor key.
- user (object, required): { id, name?, email? }.
- callback (function, required): called with widget events.
- mode ("float" | "inline", optional): defaults to "float".
- primaryColor (string, optional): affects launcher styling and widget theme.
- displayLogo (boolean, optional): defaults to true.
- introMessage / messageBody (string, optional): launcher hover popup.
- minBudget/maxBudget (number, optional).
- conversationStarters (string[], chat/unified only).
Events and callback
- closed: widget requested close.
- minimized: widget requested minimize.
- checkout: user completed checkout; payload in data.
function onWidgetMessage(message) {
switch (message.event) {
case "checkout":
break;
case "minimized":
break;
case "closed":
break;
default:
break;
}
}
Framework patterns
See v1 docs for updated inline embedding patterns.
Advanced patterns
See v1 docs for updated inline embedding patterns.
Versioning
// Sandbox base
https://sandbox.widget-lib.oysterskin.com/<VERSION_OR_ALIAS>/oysterskin-vendor-widget-web.umd.js
// Production base
https://widget-lib.oysterskin.com/<VERSION_OR_ALIAS>/oysterskin-vendor-widget-web.umd.js
If you’re on v0, prefer pinning exact versions (or patch-only channels like /v0.2/), since 0.x can introduce breaking changes in minor releases.
CSP / security headers
Allow the widget script + iframe origins for the environment you use.
Performance
Prefer lazy-loading in inline mode for best page performance.
Troubleshooting
If OysterskinWidget is undefined, verify your script URL and CSP.
Launch checklist
- Keys: no keys committed; loaded at runtime from your config/secret system.
- Callback: events are handled and logged in staging.
- CSP: script-src and frame-src updated for the widget domains.