Data Flow Architecture
This document provides a detailed explanation of the data flows in our architecture. We'll break down each major flow and explain how data moves through our system.
Overview
Our system has two main types of users:
- Clients - Organizations that use our admin dashboard to set up and manage their AI bot
- Website Visitors - End users who interact with the AI bot on the client's website
The architecture is designed to handle several key flows:
- Client Onboarding Flow
- Client Management Flow
- Visitor Conversation Flow
- Analytics Processing Flow
Client Onboarding Flow
1. Signup and Payment Process
When a new client signs up, here's what happens:
-
Client visits the Admin Dashboard and selects a plan. Available plans:
- Free Trial
- Plan 1
- Plan 2
- Plan 3
-
Client is redirected to Stripe for payment processing
-
Upon successful payment, Stripe sends a webhook to our Admin API
-
Admin API creates a new Cognito user account
-
Admin API stores customer data in RDS. Data stored:
- Customer name
- Cognito ID
- Phone number
- Email address
-
Client is redirected back to the Admin Dashboard
2. Bot Customization
The bot customization process:
-
Client logs into Admin Dashboard using Cognito credentials
-
Client customizes the bot. Available options:
- Bot appearance
- Knowledge information (RAG - Retrieval Augmented Generation)
-
Changes are saved through Admin API to RDS
Note: Changes are applied directly to the production bot without a preview feature (live client side preview is implemented on UI)
Website Integration
To integrate the bot on their website, clients need to add a simple script tag.
This script.js is hosted on S3.
This script automatically:
- Creates an iframe on the client's website
- Handles all communication with our backend services
- Manages the bot UI and interactions
Visitor Conversation Flow
1. Text Chat Flow
When a visitor starts a text chat:
- Visitor sends a message through Bot UI
- Message is forwarded to AI Engine API
- AI Engine requests LLM response from Bedrock
- Response is returned through the chain
- Conversation is stored in RDS
- Response is displayed to visitor
2. Voice Call Flow
When a visitor initiates a voice call:
- Visitor clicks voice call button in Bot UI
- AI Engine API creates a new call session
- Call ID is returned to Bot UI
- Bot UI connects to call using Ultravox SDK
- Audio is streamed between visitor and Ultravox directly
Post-Conversation Analytics
After each conversation ends:
- AI Engine triggers the Post Session API
- Post Session API generates analytics, sends emails to visitor etc. and stores in RDS
- Client can view analytics in Admin Dashboard
Analytics Generated
- Intent analysis
- Sentiment analysis
- Call summary
- Other conversation metrics
Security Architecture
Admin APIs
- Protected behind AWS WAF
- Require Cognito JWT authentication
- Used for all dashboard operations
Public APIs
- Also protected by WAF
- No authentication required
- Used by bot UI for visitor interactions
- Planned to be rate limited and monitored
Environment Configuration
Development (Dev)
- Used for testing new features
- Isolated from production data
Production (Prod)
- Live environment
- Handles real client and visitor traffic
Example Flows
Example 1: Complete Client Onboarding
- Client visits dashboard and selects Plan 2
- Completes payment through Stripe ($199/month)
-
System performs automatic setup:
- Creates Cognito account
- Stores customer data in RDS
- Cognito automatically sends an email to Client with temp credentials
- Client uses these to access dashboard
-
Client customizes bot appearance
- Client adds embedding script to their website
Example 2: Visitor Interaction
- Visitor lands on client's website
- Bot iframe loads automatically
- Visitor starts chat or voice call
- AI Engine processes interaction using Bedrock / Ultravox
- Post-session analytics generated automatically
- Client views analytics in dashboard