AutomationMart
Home/Browse/Run a multi-session chat agent with OpenAI and data table memory
n8n

Run a multi-session chat agent with OpenAI and data table memory

n8nn8n11 modulesv1.0
WhatsAppOpenAITelegramGemini

Quick overview This workflow powers an OpenAI-based chat agent in n8n that persists long-term conversation memory in an n8n Data Table by session ID, optionally recalling past context via name/email lookups while enforcing an identity-verification flow. How it works 1. Receives a chat message via the n8n Chat Trigger and uses the provided sessionId to identify the conversation. 2. Searches the n8n Data Table for an existing row with the same sessionid and either loads the saved fields or

At a glance

Run a multi-session chat agent with OpenAI and data table memory is a ready-made n8n workflow you import as a workflow JSON file — no build required. It connects WhatsApp, OpenAI, Telegram, Gemini. It's free to download. Follow the 5-step import below to go live in minutes.

Platform
n8n
Connects
WhatsApp, OpenAI, Telegram, Gemini
Modules
11
Price
Free
Version
v1.0
Run a multi-session chat agent with OpenAI and data table memory workflow diagram

About this workflow

Quick overview This workflow powers an OpenAI-based chat agent in n8n that persists long-term conversation memory in an n8n Data Table by session ID, optionally recalling past context via name/email lookups while enforcing an identity-verification flow. How it works 1. Receives a chat message via the n8n Chat Trigger and uses the provided sessionId to identify the conversation. 2. Searches the n8n Data Table for an existing row with the same sessionid and either loads the saved fields or creates a new session record. 3. Uses an OpenAI chat model with a sliding window memory (last 10 turns) to generate the assistant response based on the user message and any loaded session context. 4. Updates the current session’s Data Table row with newly captured details (for example name, email, company, interests, topics, and chat history) according to the agent’s rules. 5. When the user provides a name or email, queries the Data Table for past sessions via the lookup-by-name and lookup-by-email tools to support a privacy-preserving “welcome back” flow. Setup 1. Create or select an n8n Data Table (for example, chatsessiondata) with columns that match the workflow fields you want to store (such as sessionid, firstname, lastname, userid/email, company, interestedin, lasttopic, and chathistory). 2. Add an OpenAI API credential and select the model in the OpenAI Chat Model node. 3. Update the Data Table ID references in the Data Table and Data Table Tool nodes to point to your table. 4. Activate the Chat Trigger and use the generated chat/webhook endpoint in your chat entry point (or test from n8n’s chat UI). 5. Set the workflow timezone in n8n settings to ensure timestamps and session timing align with your locale. Requirements - OpenAI GPT-5.2 Customization - Change the agent name, company name, and role description in the system prompt to match your own use case - Add or remove data table fields to capture different information relevant to your business domain - Swap OpenAI for any other LLM that supports tool calling (Anthropic Claude, Google Gemini, etc.) - Replace email as the identity verification key with phone number or membership ID by updating the lookup tool filters - Extend to additional chat channels such as WhatsApp or Telegram by adding a channel-specific trigger and reusing the same data table - Write a schedule triggered workflow to clean-up old session records based on updateAt date, or just manually delete Additional info Works on self-hosted and cloud

n8n

How to import this n8n workflow

  1. 1

    Download the workflow JSON file after purchase.

  2. 2

    Open n8n → click the menu → Import from File.

  3. 3

    Select the downloaded JSON and import.

  4. 4

    Set up credentials for each node that requires them.

  5. 5

    Click Execute Workflow to test, then activate.

Setup guide

Setup guide included

Purchase to unlock the full step-by-step guide

Related N8n workflows

Generate sentiment analysis from ‘product satisfaction’ surveys using ChatGPT

Leverage ChatGPT to provide insightful sentiment analysis from product surveys, increase customer satisfaction and drive effective business strategies with our innovative AI solution. The scenario uses this [Airtable](https://airtable.com/shrxKFqtPOpiQCSgB/tblWsaDQ3xDuXupCf/viwtrdBjK1te1Lc5l?blocks=hide) template.

Free

Personal life manager with Telegram, Google services & voice-enabled AI

How it works: This project teaches you to create a personal AI assistant named Jackie that operates through Telegram. Jackie can summarize unread emails, check calendar events, manage Google Tasks, and handle both voice and text interactions. The assistant provides a comprehensive digital life management solution accessible via Telegram messaging. Key Features: - Supports hands-free voice interaction - Maintains conversation memory - Integrates with major Google services - Provides per

Free

Track top meme coin prices with Telegram Bot and CoinGecko API

Platform: n8n (Telegram Bot Integration) Purpose: Let users fetch top meme coin prices in real-time using a simple /memecoin Telegram command How It Works (Logic Breakdown) This flow listens for a Telegram command and fetches data from the CoinGecko API to respond with live memecoin prices. 🔹 1. Telegram Trigger Node Listens for incoming Telegram messages from users. Activated when a message is sent in a Telegram chat connected to the bot. Passes the raw message (e.g., /memecoin) to the next n

Free

Send personalized SaaS welcome emails with Stripe, Pinecone, GPT-4o, and Gmail

Who it's for SaaS founders and developers who want to automate their customer onboarding experience from payment to welcome email, without any manual work. How it works - A Stripe Trigger listens for successful payment events. - The payment amount is converted and used to identify the subscription tier. - Customer details are extracted from the Stripe payload. - The AI Agent queries Pinecone to retrieve the correct plan details and generates a personalised HTML welcome email with the renewal dat

Free

DNB company search & extract with Bright Data and OpenAI 4o mini

Notice Community nodes can only be installed on self-hosted instances of n8n. Who this is for The DNB Company Search & Extract workflow is designed for professionals who need to gather structured business intelligence from Dun & Bradstreet (DNB). It is ideal for: - Market Researchers - B2B Sales & Lead Generation Experts - Business Analysts - Investment Analysts - AI Developers Building Financial Knowledge Graphs What problem is this workflow solving? Gathering business information from the DNB

Free

Expense organizer with Google Drive routing and Gemini AI entity detection

Who's it for This workflow is perfect for individuals, small businesses, or households who need to: - Automatically process and categorize expense receipts - Extract structured data from invoices and receipts using AI - Store receipts in multiple locations (Google Drive and S3) - Send automated email notifications with expense details - Send documents to accounting systems via email hooks How it works This comprehensive expense processing workflow combines AI-powered document analysis with autom

Free

Generate course certificates from Google Sheets with Stencil PDF and Outlook

Automatically generate and send course certificates when new participants are added to Google Sheets This workflow creates PDF certificates using Stencil, stores them in Google Drive, and emails them to participants. How it works 1. A new row is added to the Google Sheets document (via form, webhook, or manual entry) 2. The workflow generates a PDF certificate using the Stencil API 3. The PDF is uploaded to a Google Drive folder for archiving 4. The certificate is sent to the participant

Free

Detect, Analyze and Humanize 🕵️‍♂️🔎 AI-generated text using Rephrasy

This workflow is designed to analyze and humanize AI-generated text automatically using Rephrasy AI. The workflow then sends this text to an AI detection service to evaluate how “AI-like” it is. The text is broken down into individual sentences, and each sentence is scored based on its likelihood of being AI-generated. Using a conditional logic step, the workflow identifies sentences with a high AI probability (score > 50). Only those sentences are sent to a humanization API, which rewr

Free

Reviews

No reviews yet

Be the first to buy and share your experience.

Leave a review

Sign in to share your experience with this workflow.

Log in to review
Free
No ratings yet

Create a free account to purchase workflows.

  • JSON blueprint — instant download
  • Setup guide PDF included
  • 5 downloads · valid 30 days
  • Works with n8n

Need help setting this up?

Book a 3-hour live setup session with an Agility consultant.

₹2,499/ session
3 hrs · video call
  • Configure live on Google Meet / Zoom
  • Free follow-up if workflow has defects
  • Platform expert assigned to you
Book installation session
Free