n8n

How to Automate OpenAI Customer Support Chat?

Create a smart chat help desk that remembers what each person said earlier in the conversation. It is great for customer support, onboarding, and simple product questions where context matters.

Messages start at a public chat endpoint. The system reads past messages from memory, bundles them together, and sends them to an OpenAI Assistant along with the new question. A window buffer keeps the most recent 20 messages for each session so replies stay on topic. A calculator tool is available inside the assistant for accurate math. After the model replies, the new user and AI messages are saved back to memory. A limit step then passes only the final result, and the output is cleaned for display or handoff to other systems.

Bring an OpenAI API key and an Assistant set up in your account. Expect faster replies and fewer repeat questions for your team. Good fits include website chat pilots, internal help desks, and FAQ style support. Setup is simple: add your OpenAI credential, select your assistant, confirm memory settings, and run a short conversation test to verify name recall and math accuracy.

What are the key features?

  • Public Chat Trigger captures messages and assigns a session ID
  • Window Buffer Memory stores the last 20 messages for each session
  • Chat Memory Manager reads previous messages and writes new ones back
  • Aggregate node compiles all past messages into a single messages field
  • OpenAI Assistant processes the history and current input to craft replies
  • Calculator tool is available to the assistant for precise math
  • Limit node forwards only the final message for clean results
  • Edit Fields maps the assistant output into a standard output field

What are the benefits?

  • Reduce first response time from minutes to under 30 seconds
  • Automate up to 60 percent of repeat questions with remembered context
  • Keep 20 message history per session to improve answer quality
  • Eliminate calculation errors by using a built in calculator tool
  • Publish a public chat endpoint that can support many concurrent users

How do you set it up?

  1. Import the template into n8n: Create a new workflow in n8n, click the three dots menu, select 'Import from File', then choose the downloaded JSON file
  2. You'll need accounts with OpenAI. See the Tools Required section above for links to create accounts with these services.
  3. In your OpenAI account, create an API key from the API keys page and keep it ready.
  4. In n8n, open Credentials and create a new OpenAI credential. Paste your API key, give the credential a clear name, and save.
  5. Open the OpenAI Assistant node and select your OpenAI credential from the dropdown.
  6. In your OpenAI dashboard, create or select an Assistant. Copy the Assistant ID and paste it into the assistantId field in the OpenAI Assistant node.
  7. Confirm the prompt template in the OpenAI Assistant node includes previous messages and the current chat input as shown in the template text field.
  8. Open the Chat Trigger node and ensure Public is set to true. Keep Load previous session set to memory so sessions resume correctly.
  9. Open the Window Buffer Memory node and verify the session key uses the sessionId and that the context window length is set to 20.
  10. Check the Chat Memory Manager nodes: one should read existing messages, and the other should insert the latest user and AI messages after the assistant responds.
  11. Make sure the Aggregate node outputs a messages array and that the Limit and Edit Fields nodes are connected to pass only the final output.
  12. Save the workflow and click Chat in the n8n UI. Send two messages as in the note: share your name, then ask the assistant to recall it. Confirm accurate recall.

Tools Required

$24 / mo or $20 / mo billed annually to use n8n in the cloud. However, the local or self-hosted n8n Community Edition is free.

OpenAI

Sign up

Pay-as-you-go: GPT-5 at $1.25 per 1M input tokens and $10 per 1M output tokens

Similar Templates

Join Futurise to access 1,200+ automation templates

Get instant access to ready-made automation workflows for n8n, Make.com, AI agents, and more. Download, customise, and deploy in minutes.