Setup

@wix/ai-site-chat

To use the WidgetSettings API, install the @wix/ai-site-chat package using npm or Yarn:

Copy

or

Copy

Then import { widgetSettings } from @wix/ai-site-chat:

Copy
Did this help?

Widget Settings: Sample Use Cases and Flows

This article shares some possible use cases your app or site could support, as well as a sample flow that could support each use case. This can be a helpful jumping-off point.

Retrieve and update widget settings

To retrieve and update the widget settings:

  1. Call Get Widget Settings to retrieve the current settings.
  2. Update the settings retrieved. For example, update the intro message.
  3. Call Set Widget Settings, specifying the updated settings, to save the updated settings.

Display a message if the AI assistant is offline.

To display a message if the AI assistant is offline:

  1. Call Get Widget Settings.
  2. Check the value of assistantOnline in the response.
  3. If it's false, display a message on the site.
Did this help?

getWidgetSettings( )


Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Retrieves the widget settings for the site.

Method Declaration
Copy
function getWidgetSettings(): Promise<GetWidgetSettingsResponse>;
Request
This method does not take any parameters
Returns
Return Type:Promise<GetWidgetSettingsResponse>
JavaScript
import { widgetSettings } from "@wix/ai-site-chat"; async function getWidgetSettings() { const response = await widgetSettings.getWidgetSettings(); }
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?