n8n

How to Automate OpenAI Cited Support Responses?

Give your team a chat that returns clear answers with real sources. An OpenAI assistant looks up your files and shows citations, and n8n formats the reply for easy publishing. Great for help desks, internal wikis, and content teams that need trusted responses.

A chat button in n8n starts the session and sends the prompt to an OpenAI assistant that uses a vector store. After the reply, the workflow calls the OpenAI API to fetch the full thread so every citation is captured. Split steps break messages, content blocks, and annotations into parts. Another call grabs file names from each file id. A Set and Aggregate step shape a clean list of citations. A Code step replaces citation markers with Markdown links, and you can turn Markdown into HTML at the end. A memory buffer keeps recent chat context so answers stay on topic.

You only need an OpenAI API key and an assistant set up with file retrieval. Expect faster review and fewer manual edits because sources are linked for you. Use it for support answers, internal knowledge articles, and sales enablement notes where proof and clarity matter.

What are the key features?

  • Chat button trigger inside n8n to test and collect prompts
  • Conversation memory keeps recent context for better replies
  • OpenAI assistant with vector store returns answers with citations
  • HTTP call pulls the full thread to capture all citation details
  • Split steps break messages, content, and annotations into simple parts
  • HTTP call fetches file names from each file id
  • Set and Aggregate prepare a clean list of id, filename, and text
  • Code step replaces markers with Markdown links to sources
  • Optional Markdown to HTML output for websites or help centers

What are the benefits?

  • Reduce manual source checking from 30 minutes to 3 minutes per answer
  • Automate 90% of formatting work for cited replies
  • Improve trust by showing sources in every response
  • Handle more chat requests without adding staff
  • Connect OpenAI answers with your own files smoothly

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' > 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, go to the API keys page and create a new secret key. Copy it to a safe place.
  4. In the n8n credentials manager, create a new OpenAI credential using API Key. Name it clearly, for example OpenAI Prod, and paste your key.
  5. Open the OpenAI Assistant node and select your OpenAI credential. Enter the assistant ID from your OpenAI dashboard. Make sure the assistant has file retrieval and a vector store with your files.
  6. Open the Get ALL Thread Content node. Confirm the OpenAI credential is selected and the header OpenAI-Beta assistants=v2 is present.
  7. Open the Retrieve file name from a file ID node and choose the same OpenAI credential. Keep the default settings.
  8. Review the Code node. Adjust the link format or text replacements to match your site or knowledge base style.
  9. If you need HTML output, enable or keep the Markdown to HTML node active. If you prefer Markdown, disable that node.
  10. Activate the workflow. Click the chat button in n8n, ask a question that should use your files, and wait for the final message with linked citations.
  11. Check the output. If no sources appear, confirm your assistant uses retrieval, your files are processed, and the thread messages include annotations.
  12. If you see API errors, check your OpenAI key, rate limits, and that the assistants v2 header is set on the HTTP nodes.

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

Credits:
by Davi Saranszky Mesquita LinkedIn

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.