Oyster Widget Web SDK
Embed the skin scan on any site yourself. Two modes: float, a launcher button, and inline, mounted into a container you provide. Paste one script tag, create a widget, and the rest of this section covers what you can change: how it mounts, every option, the events it sends back, and a playground that writes the snippet for your exact settings. On WordPress the WooCommerce plugin does all of this for you, and in a native app see the mobile guide.
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)
- OysterskinWidget.createVoiceAgentWidget(options)
Each factory returns an instance with open(), minimize(), and close(). The unified widget instance additionally exposes openScan(), openConsultation(), openChat(), and openVoiceAgent() for driving the widget to a specific view from host code.
In v1, minimize() only affects float mode (it returns the widget to the launcher). In inline mode, minimize() is a no-op.
Quickstart
<!-- 1) Load the widget bundle (UMD) -->
<script src="https://sandbox.widget-lib.oysterskin.com/v1/oysterskin-vendor-widget-web.umd.js"></script>
<!-- 2) Create a widget instance -->
<script>
const instance = OysterskinWidget.createScanWidget({
publicKey: "YOUR_PUBLIC_KEY",
mode: "float",
autoOpen: true,
// Optional: your own identifier for this visitor, echoed back on the scan's
// webhooks so you can match it to a customer.
// externalUserRef: "cust_8421",
// Optional: skip the widget's own contact step when you already know who
// this is. Omit it and the widget asks when it needs to.
// user: { id: "YOUR_END_USER_ID", name: "Ada Obi", email: "[email protected]" },
callback: (message) => {
console.log("Oyster widget message", message);
},
});
</script>
Appearance, copy and budget tiers are not in here on purpose: set those once in your Oyster dashboard rather than in every embed. See where config comes from, and the playground to generate a snippet with your own settings baked in.
Minimal standalone examples: float mode and inline mode.
Loading the bundle
<script src="https://sandbox.widget-lib.oysterskin.com/v1/oysterskin-vendor-widget-web.umd.js"></script>
Versioning
Use the major channel, /v1/, in production. You receive fixes and patches without chasing every release, and no breaking change lands inside a major.
// Production (major channel)
<script src="https://widget-lib.oysterskin.com/v1/oysterskin-vendor-widget-web.umd.js"></script>
// Sandbox (major channel)
<script src="https://sandbox.widget-lib.oysterskin.com/v1/oysterskin-vendor-widget-web.umd.js"></script>
/latest/ is for testing only: it can cross a major and take a breaking change with it. If your release process needs a frozen artifact rather than a moving channel, talk to us before you build around one.
CSP / security headers
Allow the widget script + widget origins for the environment you use.
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.
- Inline container: ensure your container exists before creating the widget.