Mindket

Health plan quote chatbot with Postgres memory and tools

Newversion 1 · updated

Overview

An n8n chat in Portuguese for comparing company health insurance plans. An AI agent remembers each visitor in Postgres, finds the three cheapest plans in a MySQL table and can call two web APIs. A starter you fill with your own data.

Health plan quote chatbot with Postgres memory and tools is an n8n workflow in the Business category, listed by Mindket. It is free. This is version 1, last updated on . Download it on this page or copy its JSON, then import it into an n8n canvas. Nothing runs until you activate it in n8n.

At a glance

Runs in
  • n8n Cloud: import the file into a new workflow there
  • Your own n8n server: the same file and steps
  • Your own site: post the visitor’s message, a leadData profile and a session_id to the chat’s webhook from your front end
  • Another market: change the table, the query and the system messages

Platform

Connects 3 apps

How it works

Trigger

Chat message

It starts when a visitor sends a message in the chat, which a front end of your own can extend with:

  • A leadData object with the visitor’s profile
  • A session_id that keeps one memory per visitor

Actions

  1. If the message carries a profile, an agent saves it to memory and confirms in one line
  2. The quote agent reads the message with the last thirty interactions from Postgres
  3. It searches the Products table in MySQL for the three cheapest plans by city, lives and age
  4. It can look up operator information and a person by name and birth date through two web APIs
  5. It answers in Portuguese from what its tools return

Result

A chat reply with the cheapest plans a tool found, or a note that nothing matched

Integrations

What you need before you start.

OpenAI

Language model

Runs gpt-5.6-terra for the profile step and for the quote agent.

NeedsOpenAI API key

PostgreSQL

Database

Keeps the chat memory in a table named aimessages, one thread per session.

NeedsA Postgres database

MySQL

Database

Holds the Products table that the quote agent searches for plans.

NeedsA MySQL database and a user that can only read

Workflow check

Checked by Mindket on 13 Nov 2026

Steps
6 steps, starting on a chat message
AI
2 steps call an AI model: Quote Assistant and Save Lead Profile
Sign-ins
Signs in to: Postgres and OpenAI
API keys
No API key is left in the file
Step types
Mindket’s checker reads 3 of its 4 step types. It does not read: AI Agent

Read from the workflow’s file, not from a run.

About

What it is

This n8n workflow is a chat that helps visitors compare health insurance plans for companies, in Portuguese. A public chat takes the visitor’s message. If a front end sent the visitor’s profile, an agent saves it to memory first. A quote agent then answers, with the last thirty interactions from a Postgres table. It can search a MySQL table for the three cheapest plans by city, number of lives and the holder’s age, and it can call two web APIs. Thirteen nodes do the work, beside one sticky note.

Who it suits

Insurance brokers and benefits platforms that already hold a table of plans and prices and want a chat on top of it. Skip it if you have no such table or API. This is a starter, and the tables, the two APIs and the agent’s instructions are yours to supply.

Who uses it, and how
IndustryWho uses itHow they use itExample
InsuranceBrokersLet a visitor describe a company and get the cheapest matching plansA broker’s site shows three plans for a twelve-life company, cheapest first.
BenefitsPlatform teamsAnswer plan questions from an operator information serviceA platform’s chat looks up an operator’s details when a visitor asks.
Human resourcesHR consultanciesGive clients a first look at group plan pricesA consultancy lets a client try ages and group sizes before a call.
AgenciesBuilders of chatbotsStart a client project from a chat that already has memory and toolsAn agency swaps in the client’s table and the two APIs.

You need solid n8n and a database for this one: three kinds of credential, a MySQL table with a set of columns and two APIs of your own. The workflow’s own sticky note gives no setup time.

Where to use it

Any n8n that can reach OpenAI, a Postgres database and a MySQL database will run it. The chat opens inside n8n until you publish it and share the chat address.

  • n8n Cloud: import the file into a new workflow there
  • Your own n8n server: the same file and steps
  • Your own site: post the visitor’s message, a leadData profile and a session_id to the chat’s webhook from your front end
  • Another market: change the table, the query and the system messages

Setup

Download saves a zip with workflow.json and Mindket’s setup notes in your downloads folder. Three accounts and two web addresses cover every step.

What you need first
NeedDetail
n8nOn n8n Cloud or on a server of your own
OpenAIAn API key that can use gpt-5.6-terra
PostgresA database for the chat memory, where aimessages is created if missing
MySQLA Products table with the columns the query uses, and a user that can only read it
Web APIsAn address for each of the two tools, or a decision to delete them
  1. In n8n, create a workflow, open its menu, choose Import from File and pick workflow.json.
  2. Add an OpenAI credential and select it in Profile Chat Model and Assistant Chat Model.
  3. Add a Postgres credential and select it in Postgres Chat Memory and Postgres Chat Memory1.
  4. Add a MySQL credential for a read-only user and select it in Products in Database.
  5. In Knowledge Base, replace <YOUR_QUOTE_API_HOST> with your quote service. In External API, replace <YOUR_LOOKUP_API_HOST> with your lookup service. With neither, delete the tool and its line in the system message.
  6. Read the system messages of Save Lead Profile and Quote Assistant and rewrite them.
  7. Save the workflow, open the chat with the Chat button and ask for a plan for a company, with a city, a number of lives and the holder’s age.

How to use it

A visitor writes in the chat. The agent asks for what a tool needs, such as the city and the holder’s age, then searches the table and lists what it finds. From your own front end, a first message can also carry leadData, a profile the agent saves to memory.

What to change for a different result
To changeWhere
How the agent talks and what it must doThe system message in Quote Assistant
The profile sentenceThe text in Edit Fields1
The query and its modalityProducts in Database
The greetingThe initial message in Chat Trigger
The tools’ addresses and descriptionsKnowledge Base and External API
The modelsProfile Chat Model and Assistant Chat Model

Example

A visitor writes that a company of twelve people in São Paulo needs a plan and that the holder is 35. The agent calls the table tool with the city, the state, twelve lives and the age.

The tool returns up to three plans, cheapest for that age first. The agent lists them in Portuguese with their prices. If the table has no match, it says so and does not invent a plan.

For newcomers and experts

If you are new. n8n draws a workflow as boxes joined by lines, and each box, a node, does one job. Here an agent is a node that decides which tool to call. Test with the Chat button, watch which tool the agent picks in the run, and compare its answer with your table.

For experts. Two agents share one memory table, and the tools are plain nodes.

Where to look closer
NodeWhat it doesWhat to know
IfChecks that the message carries a leadData objectThe second condition compares two empty values and always passes
Postgres Chat MemoryMemory for Quote Assistant, window of thirtyIts key is session_id followed by sessionId, so send one of the two
Products in DatabaseA MySQL tool that runs a query with values the model fills inThe values are written into the SQL text, so use a read-only user
External APIAn HTTP Request tool that sends a POST with a JSON bodyIt fills {name} and {birthdate}, the single-brace placeholders

Good to know

The Assistants steps were rebuilt, and the system messages are ours.

  • Assistants: OpenAI’s deprecations page, read on 12 November 2026, gives 26 August 2026 as the shutdown of the Assistants API. Both steps are now AI Agents on gpt-5.6-terra. The author’s instructions were not in the file, so the two system messages are Mindket’s drafts to rewrite
  • Profile: the built-in chat page sends no leadData and no session_id. The profile step needs a front end of your own
  • Memory key: Edit Fields2 leaves out sessionId, so a front end that sends both ids would start a new memory on the next message
  • SQL: the table tool writes model-filled values into the query. Use a user that can only read the one table
  • Public chat: anyone with the address can talk to the agent and spend your key
  • Privacy: the profile is stored in Postgres and sent to OpenAI, and External API sends a name and a birth date to your service. Check your duties, for example under Brazil’s LGPD
  • One business: the modality is fixed to PME and the state in Knowledge Base to SP
  • Billing: each reply can mean several model calls
  • Credentials: the JSON holds none

README and files

README

Health plan quote chatbot with Postgres memory and tools

An n8n chat in Portuguese for comparing health insurance plans for companies. An AI agent remembers each visitor in a
Postgres table. It can search a MySQL table of plans for the three cheapest matches by city, number of lives and the holder's
age, and it can call two web APIs. It is a starter: the tables and the two APIs are yours to supply, and the two system
messages are short drafts to rewrite.

What is inside

  • workflow.json: the workflow as n8n exports it, thirteen nodes and one sticky note. It holds no credential.
  • README.md: these notes.

What we changed from the original copy

  • The two steps that called an OpenAI Assistant used n8n's Assistant node. OpenAI's deprecations page, read on 12 November 2026,
    gives 26 August 2026 as the shutdown of the Assistants API, with the Responses API and Conversations API as the replacement.
    Both are now AI Agents, Save Lead Profile and Quote Assistant, each with a model node on gpt-5.6-terra:
    Profile Chat Model and Assistant Chat Model.
  • The author's assistants held their own instructions, which are not in the file. The two system messages are ours. A short one
    saves the visitor's profile and confirms in one line. The other tells the quote agent to answer in Portuguese, use its three
    tools and quote only what a tool returns. Read both and rewrite them for your business.
  • The tool Products in Daatabase is now Products in Database, and its description was written for it.
  • The description of Knowledge Base was filler text. It now says what the tool looks up. Its address pointed at the
    author's company, and it is now https://<YOUR_QUOTE_API_HOST>/widget/info.
  • External API called a private host. It is now https://<YOUR_LOOKUP_API_HOST>/findByNameAndBirthDate. Its body wrote
    {{json.name}}, which n8n reads as an expression and cannot resolve. It now uses {name} and {birthdate}, the single-brace
    placeholders an HTTP Request tool fills.
  • The chat's greeting named the author's company and a bot. It is now a neutral Portuguese greeting.
  • The OpenAI, MySQL and Postgres nodes lost their links to credentials in the author's n8n. Select your own.
  • Nothing else. The file has no Code node.

Before you start

  • An n8n instance, on n8n Cloud or your own server.
  • An OpenAI API key that can use gpt-5.6-terra.
  • A Postgres database for the chat memory. The table aimessages is created on first use when it does not exist.
  • A MySQL database with a table Products, and a user that can only read it. The query uses these columns: cityQuery,
    state, modality, removed, minLifeAmount, maxLifeAmount, createdAt and ten price columns from priceAtAge0To18 to
    priceAtAge59To199.
  • An address for each of the two web tools, or a decision to delete them.
  • Your own web page or app, if you want the visitor's profile saved. See the notes below.

Set it up

  1. In n8n, create a workflow, open its menu and choose Import from File. Pick workflow.json.
  2. Add an OpenAI credential and select it in Profile Chat Model and Assistant Chat Model.
  3. Add a Postgres credential and select it in Postgres Chat Memory and Postgres Chat Memory1.
  4. Add a MySQL credential for a read-only user and select it in Products in Database.
  5. In Knowledge Base, replace <YOUR_QUOTE_API_HOST> with your quote service. In External API, replace
    <YOUR_LOOKUP_API_HOST> with your lookup service. If you have neither, delete the tool and its line in the system message of
    Quote Assistant.
  6. Read the system messages of Save Lead Profile and Quote Assistant and rewrite them.
  7. Save the workflow, open the chat with the Chat button on the canvas and ask for a plan for a company, with a city, a number
    of lives and the holder's age.

How a run goes

  1. Chat Trigger takes a visitor's message. It is public, and it opens with a Portuguese greeting.
  2. If checks whether the message carries a leadData object. Without one, the message goes straight to Quote Assistant.
  3. With one, Edit Fields1 turns the profile into a sentence: name, age, city, state, profession, education, entity, device,
    channel and plan type. Save Lead Profile stores it in memory and confirms in one line.
  4. Edit Fields2 puts the visitor's own message and session_id back, and passes them to Quote Assistant.
  5. Quote Assistant answers with Postgres Chat Memory, which keeps the last thirty interactions. It can call
    Products in Database, Knowledge Base and External API.
  6. Products in Database returns the three cheapest plans in the modality PME for the city, state, number of lives and the
    holder's age, newest first among equal prices.
  7. The reply goes back to the chat.

Change the look

  • How the agent talks and what it must do: the system message in Quote Assistant.
  • The profile sentence: the text in Edit Fields1.
  • The query: Products in Database, including the modality and the number of results.
  • The greeting: the initial message in Chat Trigger.
  • The tools' addresses and descriptions: Knowledge Base and External API.
  • The models: Profile Chat Model and Assistant Chat Model.

Good to know

  • The profile branch needs a front end of your own. The built-in chat page sends no leadData and no session_id, so the
    workflow skips the profile step and goes straight to Quote Assistant. A front end can post both fields at the top level of its
    request to the chat's webhook.
  • The memory key joins session_id and the chat's own sessionId. Edit Fields2 leaves sessionId out, so a front end that
    sends both would start a new memory on the next message. Send one of the two ids.
  • Products in Database writes values the model fills in straight into its SQL text. Give it a user that can only read the
    one table, and think about moving the values into the node's query parameters before real use.
  • The chat is public. Anyone who knows its address can talk to the agent and spend your OpenAI key.
  • The profile holds a person's name, age, city, profession and education, and it is stored in Postgres and sent to OpenAI.
    External API sends a name and a birth date to your lookup service. Check what your privacy duties allow, for example
    under Brazil's LGPD.
  • The query and the tools are tuned to one business: the modality is fixed to PME, and the state in Knowledge Base is fixed
    to SP. Change them for yours.
  • The quote agent is told never to invent a plan or a price. Still, test it against your own table before a visitor sees it.
  • Each reply can mean several model calls, one for each tool the agent uses.
Files
NOTICE.md  642 B
README.md  7 KB
workflow.json  13 KB

3 files, 21 KB, downloaded as a zip.

What’s new

  • Version 1 · 2026-11-12

Reviews

No ratings yet

Write a review

No reviews yet.

More from Mindket

See all from Mindket

anaksor-ocr

Sokheng · Kit

Reads Khmer and English text from documents, receipts and photos of signs, using a detector for text lines and a recogniser for each line. Suits developers who…

New

Qwen2.5-7B-Instruct as GGUF files in eight quantization sizes, to chat with locally through llama.cpp. For people who want a capable 7.6B model on their own co…

New

ACE-Step 1.5 XL SFT

ACE-Step · Kit

Generates music from text with a 4B diffusion decoder, 50 steps and guidance control, aiming for higher audio quality than the base. For creators with a GPU of…

New

Similar in Business

See all in Business

pplx-decider-v1.1-27b

perplexity-ai · Kit

Picks the best option for a decision from text and images, such as which team should handle a request, with a probability for each choice, for developers who b…

New

NuExtract3

numind · Kit

Reads documents as text or images and fills a JSON template with the fields you ask for, or converts the pages to Markdown. A 4B model for teams that process s…

New

Drex DLM

nace-ai · Kit

Scores yes or no, multiple choice and rating questions about a document in one pass, with a probability for every option. An 8B decision model from Nace.AI tha…

New