What This Automation Does
This workflow is a chatbot that helps provide health insurance quotes fast and personal.
It solves problem of slow and wrong answers when people ask about plans.
The result is quick, right answers based on user details, from chat to database lookups to AI answers.
The workflow gets chat messages.
It checks if user data is right.
User info gets turned into messages the AI understands.
It uses PostgreSQL to remember chat history.
It finds insurance plans in MySQL that fit user needs.
Extra APIs can add fresh price info.
Finally, AI builds friendly replies for customers.
Inputs, Processing, and Outputs
Inputs
- Incoming chatbot messages: Triggered by LangChain Chat Trigger node.
- User lead data: Demographics like age, city, profession from chat.
- Session ID: Keeps track of chat memory across interactions.
Processing Steps
- Validate lead data: If node confirms user data exists and is correct.
- Format messages: Set node (Edit Fields1) creates a detAIled intro message for AI using user inputs.
- Use OpenAI: First OpenAI assistant node reads and understands formatted message.
- Recall chat memory: Two Postgres Chat Memory nodes store and get chat history by session ID.
- Query product database: MySQL Tool node runs a SQL query checking city, age, dependents, and plan rules.
- Call external APIs: HTTP Request nodes send user info and get price or product updates.
- Format final AI prompt: Another Set node (Edit Fields2) adjusts messages with database info.
- Generate final answer: Second OpenAI assistant node creates personalized reply for user.
Output
The chatbot sends a fast, personalized, and context-aware insurance quote answer back to the user.
Who Should Use This Workflow
This workflow is for customer service teams or businesses offering health insurance quotes.
It works if users send chat messages with their info and expect quick, accurate plan recommendations.
It helps managers save hours by avoiding manual lookups and keeps better chat records.
It suits users wanting personalized answers based on age, city, and family size.
Tools and Services Used
- LangChain Chat Trigger node: Gets incoming chat messages.
- OpenAI assistant nodes: Understand user questions and generate replies.
- PostgreSQL database: Stores chat memory for conversation flow.
- MySQL database: Holds health insurance product data.
- HTTP Request nodes: Call external APIs and pricing knowledge bases.
Beginner Step-by-Step: How to Use This Workflow in n8n
Download and Import
- Download the workflow file using the Download button on this page.
- Open the n8n editor where you want to run this.
- Click Import from File, choose the downloaded workflow file, and upload it.
Configure Credentials and Settings
- Go through nodes that require credentials.
- Set your OpenAI API Key in the OpenAI assistant nodes.
- Fill PostgreSQL and MySQL connection details in their respective nodes.
- Update any IDs, emails, channels, tables, or URLs if needed, especially in HTTP Request nodes.
- If fields hold code or prompt templates, verify them and edit as needed. See code block below for the prompt used in Set node (Edit Fields1).
Test and Activate
- Run the workflow once by triggering the webhook manually or sending a test chat message.
- Check if all nodes run without errors and responses are sensible.
- Turn the workflow to active mode when ready to use in production.
For users running self-host n8n, make sure your webhook URLs are accessible externally.
="Hello, just so you can get to know me, with no intention of a response, please save this information in your memory. My name is {{ $json.leadData.name }}. I am {{ $json.leadData.age }} years old and currently live in {{ $json.leadData.city }}, {{ $json.leadData.state }}. My profession is {{ $json.leadData.profession }}, and my education level is {{ $json.leadData.educationLevel }}.
If I 9m part of an adhesion group and have an entity, it would be {{ $json.leadData.entity }}.
I am using a {{ $json.leadData.deviceType }} device to access this through the {{ $json.leadData.channel }} channel. At the moment, I am looking for a health insurance plan of type {{ $json.leadData.quotationType }}."Common Issues and How to Fix Them
- Missing or wrong session ID in PostgreSQL Chat Memory nodes: Always pass the session ID using
{{$json.session_id}}carefully from the first node onward. - SQL query returns empty results: Double-check that all AI input fields like age, city, and dependents are correctly used in the MySQL Tool node SQL WHERE conditions.
- OpenAI node gives errors or empty replies: Make sure prompt text is well formatted and lead data fields exist. Validate inputs in Set nodes.
Customization Ideas
- Change filters in the MySQL Tool node to handle different plan types or age groups.
- Adjust chat memory length in PostgreSQL Chat Memory nodes to remember more or less conversation.
- Edit the intro message in Set node (Edit Fields1) to add branding or more user data.
- Add more HTTP Request nodes to include other APIs or data sources.
- Try different AI models or assistants in the OpenAI assistant nodes for varied response styles.
Summary of Benefits and Results
✓ Saves many work hours by automating insurance quotes.
✓ Reduces errors by using real user data and databases.
✓ Gives users quick, personalized chatbot answers.
✓ Remembers past chats to keep conversations natural.
✓ Allows easy updating with new data and APIs.
→ Smooth chat flows give better customer satisfaction.
→ More accurate plan matches based on user info.
→ Monitoring and tweaking in n8n is simple and fast.

