> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt ## Resource: Sample flows ## Article: Sample flows ## Article Link: https://dev.wix.com/docs/api-reference/business-management/ai-site-chat/sample-flows.md ## Article Content: # AI Site-Chat: Sample Flows This article presents possible use cases and corresponding sample flows that you can support. This can be a helpful jumping off point as you plan your implementation. ## Set up dynamic chat configuration based on visitor type Customize the chat experience for different visitor segments using widget settings and custom messages. Provide different chat experiences for new visitors, returning customers, and VIP members. ### Prerequisites Before implementing this flow, ensure VIP members are identified using contact labels. Create a label (such as "VIP") using the [Labels API](https://dev.wix.com/docs/rest/crm/members-contacts/contacts/labels/introduction.md) and assign it to VIP member contacts. This allows your code to distinguish VIP members from regular members by checking their contact label keys. To configure dynamic chat based on visitor type, follow these steps: 1. Identify visitor type by calling [Get My Member](https://dev.wix.com/docs/rest/crm/members-contacts/members/member-management/members/get-my-member.md) with the visitor's identity to retrieve the member information and get the `contactId`. 2. Call [Get Contact](https://dev.wix.com/docs/rest/crm/members-contacts/contacts/contacts/contact-v4/get-contact.md) using the `contactId` from step 1 to retrieve the contact's `info.labelKeys`. 3. Check the label keys to determine visitor type: - New visitor (no member record). - Returning customer (existing member without VIP label). - VIP member (has VIP label key). 4. For new visitors, call [Set Widget Settings](https://dev.wix.com/docs/api-reference/business-management/ai-site-chat/ai-site-chat/widget-settings/set-widget-settings.md) to configure the `ai_behavior.intro_message` and `ai_behavior.suggestions` fields with welcoming messages and suggested questions. 5. For VIP members, call [Get Conversation](https://dev.wix.com/docs/rest/business-management/ai-site-chat/ai-site-chat/conversations/get-conversation.md) to retrieve their conversation ID, then call [Bulk Create Messages](https://dev.wix.com/docs/api-reference/business-management/ai-site-chat/ai-site-chat/messages/bulk-create-messages.md) to send a personalized greeting message. 6. Adjust settings in [Set Widget Settings](https://dev.wix.com/docs/api-reference/business-management/ai-site-chat/ai-site-chat/widget-settings/set-widget-settings.md) based on member tier to control features like contact form availability and AI behavior. ## Monitor unanswered visitor questions Help ensure every visitor receives a response by identifying unanswered questions and sending follow-up messages. You want to help ensure that no visitor question goes unanswered, even if the AI assistant couldn't provide a suitable response. To monitor unanswered visitor questions, follow these steps: 1. Call [List Messages](https://dev.wix.com/docs/rest/business-management/ai-site-chat/ai-site-chat/messages/list-messages.md) with the visitor's identity and filter to identify unanswered questions. 2. For each unanswered question, call [Bulk Create Messages](https://dev.wix.com/docs/rest/business-management/ai-site-chat/ai-site-chat/messages/bulk-create-messages.md) to send a follow-up `ANSWER` message. ## Create a complete visitor engagement flow Combine all 3 APIs to create a comprehensive visitor engagement experience from first visit to ongoing conversation. Create a complete chat experience that welcomes visitors, provides AI support during business hours, captures leads during off-hours, and ensures all questions get answered. To create a complete visitor engagement flow, follow these steps: ### Part 1: Initial configuration (1-time setup) 1. Call [Get Widget Settings](https://dev.wix.com/docs/rest/business-management/ai-site-chat/ai-site-chat/widget-settings/get-widget-settings.md) to fetch the current widget configuration. 2. Configure comprehensive settings with [Set Widget Settings](https://dev.wix.com/docs/api-reference/business-management/ai-site-chat/ai-site-chat/widget-settings/set-widget-settings.md): - Set the business hours with the AI handler. - Configure the offline behavior to use a contact form. - Set engaging *intro messages*. - Add *suggested questions* to guide visitors. - Customize the avatar for brand consistency. ### Part 2: Visitor arrives (real-time) 1. When a visitor lands on a site, call [Get Conversation](https://dev.wix.com/docs/rest/business-management/ai-site-chat/ai-site-chat/conversations/get-conversation.md) to: - Get or create their conversation. - Retrieve the conversation ID for future messages. 2. Send a personalized welcome message using [Bulk Create Messages](https://dev.wix.com/docs/rest/business-management/ai-site-chat/ai-site-chat/messages/bulk-create-messages.md) based on: - The current page the visitor is viewing. - Whether the visitor is new or returning. For more sophisticated visitor segmentation, see [Dynamic chat configuration based on visitor type](#dynamic-chat-configuration-based-on-visitor-type). - The time of day and AI availability. ### Part 3: Monitor interaction Periodically call [List Messages](https://dev.wix.com/docs/rest/business-management/ai-site-chat/ai-site-chat/messages/list-messages.md) to: - Check for unanswered questions. - Analyze conversation context. - Trigger follow-up actions. > **Note:** As visitors interact with the chat, the AI assistant automatically responds to QUESTION messages during active hours, the contact form appears during offline hours, and system messages guide the visitor's experience. ### Part 4: Analyze and follow up 1. Send proactive follow-up messages using [Bulk Create Messages](https://dev.wix.com/docs/rest/business-management/ai-site-chat/ai-site-chat/messages/bulk-create-messages.md) based on: - Time since last interaction. - Specific questions asked. - Actions taken (or not taken) on site. 2. Track chat performance: - Call [List Messages](https://dev.wix.com/docs/rest/business-management/ai-site-chat/ai-site-chat/messages/list-messages.md) to analyze conversation patterns and common questions for AI improvement. - Call [Get Conversation](https://dev.wix.com/docs/rest/business-management/ai-site-chat/ai-site-chat/conversations/get-conversation.md) to check if the current conversation has reached its quota.