Setup

@wix/ai-site-chat

To use the Conversations API, install the @wix/ai-site-chat package.

Install the package

To install the package, follow the instructions below based on your development environment.

Wix sites and Blocks apps

When developing with:

Copy

or

Copy

Wix apps and Headless

When developing CLI or self-hosted Wix apps, as well as headless apps or sites, run the following command:

Copy

or

Copy

Import the package

To import the package in your code:

Copy
Did this help?

Conversations: Sample Use Cases and Flows

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

Reduce the AI assistant's active hours if the quota has nearly been reached

To reduce the AI assistant's active hours if the quota has nearly been reached:

  1. Call Get Conversation Usage.
  2. In the response, if the value of current is greater than 80% of quota, call Set Widget Settings to reduce the AI assistant's active hours.
Did this help?

getConversation( )


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 conversation for the site visitor calling this method.

This method must be called using the site visitor or site member identity (SDK | REST) to identify the site visitor that is requesting the conversation.

Method Declaration
Copy
Request
This method does not take any parameters
Returns
Return Type:Promise<GetConversationResponse>
JavaScript
Errors

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

Did this help?

getConversationsUsage( )


Deprecated

This method is deprecated and was replaced with CheckQuota.

Retrives the conversation usage and quota for the site.

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

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

Did this help?