Portfolio case study

WhatsApp AI assistant with RAG for a dental clinic.

An end-to-end demo connecting a web chat widget, WhatsApp, a private knowledge base, n8n, pgvector and HubSpot CRM to answer patients and qualify appointment requests.

<5s
chat reply, 24/7
<30s
lead qualified in the CRM
12+
edge cases tested
studio-rossi-ai-demo live
Studio Dentistico Rossi demo landing with AI assistant and appointment booking.
// Astro · React · n8n · OpenAI · WhatsApp · HubSpot · pgvector

Real problem

The front desk answers the same questions every day and enters CRM leads by hand.

A professional clinic receives requests about opening hours, prices, urgent cases, insurance and appointments. A generic chatbot is not enough: the system must connect to real channels, the clinic knowledge base and the CRM used by the team.

Solution

Two automations in the same demo scenario.

The Studio Dentistico Rossi landing shows the customer-facing side. Behind it, n8n orchestrates AI, a vector database, CRM updates and notifications to turn conversations and forms into operational work.

[ 01 ]

AI assistant with RAG on WhatsApp and web widget

The patient writes from the website or WhatsApp. The workflow retrieves context from the knowledge base, keeps conversational memory and answers only from controlled information.

  • Private clinic knowledge base
  • OpenAI embeddings and pgvector search
  • Human handoff for out-of-scope requests
[ 02 ]

Appointment form with lead qualification

The form sends a structured payload to n8n. AI identifies urgency, requested service, estimated value and the next action for the front desk.

  • Input validation and privacy consent
  • Controlled AI output and manual review
  • Email or automatic confirmation to the patient
[ 03 ]

Automatic write-back to HubSpot CRM

The workflow checks duplicates, creates or updates the contact, opens a deal, creates a task and stores a note with the AI summary of the request.

  • Contact, Deal, Task and Note
  • Deduplication by email or phone
  • Logs and fallback when HubSpot does not respond

Architecture

From patient message to CRM, with no manual handoff.

01

Channels

WhatsApp Business Cloud API, chat widget and appointment form on the demo landing.

02

Orchestration

n8n receives webhooks, normalizes data, handles routing, errors and frontend responses.

03

AI + RAG

OpenAI creates embeddings, searches the knowledge base through pgvector and returns contextual answers.

04

Systems

Neon PostgreSQL stores memory and documents; HubSpot receives leads, deals, tasks and operational notes.

User
WhatsApp / Widget / Form
n8n Webhook
OpenAI + pgvector
HubSpot CRM
Email / Human handoff

Proof of work

What this project proves technically.

The important part is not the clinic landing, but the system behind it: real channels, controlled knowledge, CRM automations and predictable behavior when something goes wrong.

Realistic knowledge base

Services, opening hours, prices, urgent cases, insurance, medical team and booking rules are collected in a KB file, split into 1000-character chunks and retrieved with cosine top-4 search on pgvector.

Conversational memory

The chat uses a session ID or phone number as the key and keeps a 10-message window, so each turn stays consistent with the previous exchange instead of being isolated.

Local fallback

The widget can return demo answers even when the webhook is unavailable, avoiding a broken UX during tests or maintenance.

CRM workflow

The lead does not remain in an email: the AI returns urgency, service and estimated value as structured JSON, which becomes a HubSpot contact, a deal in the pipeline, a task within 24h and a note for the front desk.

Human handoff

Out-of-scope, urgent or ambiguous requests can be logged and passed to a person instead of forcing an AI answer.

Demo security

The repo documents credentials outside the frontend, fictional data, tokens in n8n credentials and no real health data in the demo.

Beyond the demo

Edge cases a real client expects to see handled.

01

Out-of-scope questions

The answer must stay grounded in the KB and suggest human contact when the request cannot be handled by the assistant.

02

Urgency and symptoms

Pain, swelling, trauma or broken teeth must trigger high priority and fast-contact guidance, without medical diagnosis.

03

Prompt injection

Messages trying to change operating rules must not alter amounts, priorities or workflow behavior.

04

API errors

Timeouts, unavailable webhooks, HubSpot 429s or failed email should produce logs, retries or manual review without losing the lead.

Stack

Tools used in the demo.

I chose cost-conscious, realistic tools for small businesses: static hosting for the landing, n8n for orchestration, Postgres with pgvector for RAG and HubSpot as the sales CRM.

Demo frontend

Astro, React, Tailwind CSS, chat widget, appointment form, Vercel deployment.

AI & RAG

OpenAI, GPT-4o-mini, text-embedding-3-small, retrieval over a private knowledge base.

Database

Neon PostgreSQL, pgvector, document table, chat memory, messages and handoff requests.

Automation

n8n, webhooks, WhatsApp Business Cloud API, HubSpot CRM API, SMTP or Resend.

Need a similar system?

I can adapt this architecture to clinics, local services, agencies and SMBs.

The demo is built around a fictional dental clinic, but the same pattern works for clinics, consultants, hospitality, education, real estate and professional services.

Prefer email? Reach me at luigi.scorzelli87@gmail.com