ChatbyteChatbyte Docs

Frontend API

Control the Widget from your frontend.

This reference lists the core Widget API exposed by createWidget.

For JavaScript examples, see Frontend API (JavaScript).

Methods

open()

Opens the Widget.

close()

Closes the Widget.

toggle()

Toggles the widget open/closed.

showNotification(options)

Shows a contextual notification next to the launcher.

widget.showNotification({
  id: 'pricing-page',
  text: 'Ask us about this page.',
  oncePerSession: true,
});

Returns the notification ID, or null when the text is empty. Saved automatic prompts are configured in Chatbyte settings. Use this method for runtime context from the host page.

hideNotification(id?)

Removes a runtime notification by ID. Without an ID, removes all current runtime notifications. Saved automatic prompts keep their own dismissal behavior.

setNotificationsSuppressed(suppressed)

Temporarily hides the launcher notification surface and pauses automatic prompt timers without dismissing queued notifications. Pass false when the host-page surface no longer overlaps the launcher notifications.

widget.setNotificationsSuppressed(true);
// Show a host-page prompt or overlay.
widget.setNotificationsSuppressed(false);

setNavigationHandler(handler)

Called when the widget requests navigation.

identify({ token })

Associates a JWT with the current session.

onRequestToken(handler)

Registers a callback for the Widget to request a fresh JWT.

getWidget(agentId)

Returns a previously initialized widget instance, or null when the agent has not been initialized.

Deprecated Bit aliases

createBit, getBit, Bit, and CreateBitOptions remain available for existing integrations. New code should use createWidget, getWidget, Widget, and CreateWidgetOptions.

On this page