Skip to main content
The Web SDK lets you embed the Totebot chat widget on your site and control it from JavaScript: identify signed-in users, show or hide the widget, and react to chat events.

Embed the widget

Chat bubble

Add the snippet from Channels → Web before the closing </body> tag. It loads the widget and shows a floating chat bubble:
The id attribute is your agent ID. Copy the ready-made snippet from the dashboard so it’s filled in for you.

Inline iframe

To place the full chat inside a page instead of a floating bubble:

JavaScript API

Once the script loads, it exposes a global window.totebot object. Calls made before the widget finishes loading are queued and replayed once it’s ready, so you can call them at any time.

Identify a user

For signed-in users, pass a userId together with a userHash so the agent can trust the identity and recognize the person across sessions and channels. Generate the hash on your server (never expose your agent secret in the browser): it’s an HMAC-SHA256 of the userId, keyed with your agent secret. Find your agent secret in Channels → Web under the identity section.
Then pass the id, hash, and any metadata to the widget in the browser:
Identity verification requires the Personalization feature, available on the Basic, Pro, and Scale plans.

Listen for events

The widget posts messages to the host page so you can react to what happens in the chat:

E-commerce and voice

On Shopify and WooCommerce, the widget syncs the live cart automatically, so the agent can read and update it. Voice input (the iframe’s allow="microphone") and attachments are controlled from Settings → Chat Interface. For server-to-server access to conversations, analytics, and more, use the Public API.