Generate Summaries from Uploaded Files using OpenAI Assistants API
Generate Summaries from Uploaded Files using OpenAI Assistants API
π Overview
Upload a document (PDF, DOCX, PPTX, TXT, CSV, JSON, or Markdown) and receive an AI-generated summary containing:
title** β 5-10 words
summary** β 1-2 sentences
bullets** β 3-5 key points
tags** β 3-6 short keywords
The workflow:
Stores the file in OpenAI.
Runs an Assistant with File Search and Code Interpreter enabled.
Polls until the run finishes.
Retrieves the summary JSON.
β Prerequisites
OpenAI Assistant Create one at <https://platform.openai.com/assistants> Enable File Search and Code Interpreter Note: The assistant ID starts with asst_
OpenAI API credential setup in n8n Go to Credentials β New β HTTP Header Auth Header name: Authorization Value: Bearer YOUR-OPENAI-API-KEY (replace YOUR-OPENAI-API-KEY with your OpenAI API secret key for your assistant, starts with sk-) Name it: openAIApiHeader
π§ Setup
Import the workflow JSON.
When n8n prompts for a credential, choose openAIApiHeader for every HTTP Request node.
Open Run Assistant β Body and replace
"assistant_id": "REPLACE_WITH_YOUR_ASSISTANT_ID"
with your real ID (starts with asst_β¦). Save.
π How it works
| # | Node | Purpose | |---|------|---------| | 1 | On form submission | User uploads a file (File). | | 2 | Upload File | POST /v1/files (multipart) β returns file_id. | | 3 | Create Thread | Creates a thread and attaches the uploaded file. | | 4 | Run Assistant | Starts the run using your assistant_id. | | 5 | Poll Run Status β Wait 2 s β IF | Loops until status = completed. | | 6 | Fetch Summary | GET /v1/threads/{thread_id}/messages β summary JSON. |
ποΈ Customisation ideas
Edit the user prompt in Create Thread to change summary length, tone, or language.
Add an HTTP Response node after Fetch Summary to return plaintext to the uploader.
Replace the polling loop with OpenAIβs forthcoming wait-for-run endpoint when available.
No community nodes required. Works on any n8n Cloud plan (Starter, Pro, Enterprise) or self-hosted Community Edition.
Related Templates
Extract Title tag and Meta description from url for SEO analysis with Airtable
Extract Title tag and meta description from url for SEO analysis. How it works The workflows takes records from Airtabl...
Restore your workflows from GitHub
This workflow restores all n8n instance workflows from GitHub backups using the n8n API node. It complements the Backup ...
Build a Restaurant Voice Assistant with VAPI and PostgreSQL for Bookings & Orders
This n8n template demonstrates how to create a comprehensive voice-powered restaurant assistant that handles table reser...
π Please log in to import templates to n8n and favorite templates
Workflow Visualization
Loading...
Preparing workflow renderer
Comments (0)
Login to post comments