Log clinic chatbot inquiries from a website widget with OpenAI and Google Sheets

Quick overview This workflow receives website chatbot messages via a webhook, uses OpenAI to generate an AI receptionist reply with session-based context, extracts structured inquiry details, and appends or updates a single visitor row in Google Sheets before returning a clean JSON reply to the widget.

How it works Receives a POST request from the website chat widget containing the visitor message, sessionId, and timestamp. Uses an OpenAI-powered receptionist agent with per-session memory to generate a contextual reply and a hidden JSON block of extracted inquiry details. Strips the hidden data block from the reply, parses the JSON into fields (name, contact, intent, appointment details, summary, status), and flags whether any meaningful data was captured. If collectible data exists, appends or updates a Google Sheets row matched on Session ID with the latest extracted details and a Last Updated timestamp. Returns the cleaned reply to the chat widget as a JSON response with CORS headers.

Setup Add an OpenAI API credential for the OpenAI chat model used by the receptionist agent. Add a Google Sheets OAuth2 credential and set the target spreadsheet document ID and sheet/tab name used for logging. Create the Google Sheet with column headers that match the mapped fields (for example: Session ID, Last Updated, Name, Contact, Intent, Service Interested, Appointment Date/Time, Doctor Preference, Reason for Visit, Conversation Summary, Status). Activate the workflow, copy the webhook URL for the chat endpoint, and configure your website widget to POST messages to it (including message and sessionId).

0
Downloads
0
Views
8.51
Quality Score
beginner
Complexity
Created:7/2/2026
Updated:7/19/2026

πŸ”’ Please log in to import templates to n8n and favorite templates

Workflow Visualization

Loading...

Preparing workflow renderer

Comments (0)

Login to post comments