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 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 with the visitor's identity to retrieve the member information and get the contactId.

  2. Call Get Contact 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 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 to retrieve their conversation ID, then call Bulk Create Messages to send a personalized greeting message.

  6. Adjust settings in Set Widget Settings 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 with the visitor's identity and filter to identify unanswered questions.

  2. For each unanswered question, call Bulk Create Messages 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 to fetch the current widget configuration.

  2. Configure comprehensive settings with Set Widget Settings:

    • 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 to:

    • Get or create their conversation.
    • Retrieve the conversation ID for future messages.
  2. Send a personalized welcome message using Bulk Create Messages based on:

Part 3: Monitor interaction

Periodically call List Messages 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 based on:

    • Time since last interaction.
    • Specific questions asked.
    • Actions taken (or not taken) on site.
  2. Track chat performance:

    • Call List Messages to analyze conversation patterns and common questions for AI improvement.
    • Call Get Conversation to check if the current conversation has reached its quota.
Did this help?