Automate Survey Analysis with n8n, OpenAI & Pinecone
Survey responses are packed with insights, but reading and analyzing them manually does not scale. In this step-by-step guide you will learn how to build a reusable Survey Auto Analyze workflow in n8n that uses OpenAI embeddings, Pinecone vector search, and a RAG (Retrieval-Augmented Generation) agent to process survey data automatically.
By the end, you will have an automation that:
- Receives survey submissions through an n8n webhook
- Splits long answers into chunks and generates embeddings with OpenAI
- Stores vectors and metadata in Pinecone for later retrieval
- Uses a RAG agent to summarize sentiment, themes, and actions
- Logs results to Google Sheets and sends error alerts to Slack
Learning goals
This tutorial is designed as a teaching guide. As you follow along, you will learn how to:
- Understand the overall survey analysis architecture in n8n
- Configure each n8n node required for the workflow
- Use OpenAI embeddings and Pinecone for semantic search
- Set up a RAG agent to generate summaries and insights
- Log outputs to Google Sheets and handle errors with Slack alerts
- Apply best practices for chunking, metadata, cost control, and security
Key concepts and tools
Why this architecture works well for survey analysis
The workflow combines several tools, each responsible for one part of the process:
- n8n – Open-source workflow automation that connects all components, from receiving webhooks to sending alerts.
- OpenAI embeddings – Converts survey text into numerical vectors that capture semantic meaning, which makes similarity search and RAG possible.
- Pinecone – A managed vector database that stores embeddings and lets you quickly retrieve similar responses.
- RAG agent – A Retrieval-Augmented Generation agent that uses retrieved context from Pinecone plus an LLM to generate summaries, sentiment analysis, themes, and recommended actions.
- Google Sheets & Slack – Simple destinations for logging processed results and receiving alerts when something goes wrong.
Instead of manually reading every response, this architecture lets you:
- Index responses for future comparison and trend analysis
- Automatically summarize each new survey submission
- Surface key pain points and actions in near real time
How the n8n workflow is structured
Before building, it helps to picture the flow from left to right. The core nodes in the workflow are:
- Webhook Trigger – Receives incoming survey submissions as POST requests.
- Text Splitter – Breaks long answers into smaller chunks to prepare for embeddings.
- Embeddings (OpenAI) – Generates a vector for each text chunk.
- Pinecone Insert – Stores vectors and metadata in a Pinecone index.
- Pinecone Query + Vector Tool – Retrieves similar chunks when you want context for a new analysis.
- Window Memory – Maintains short-term context for the agent during a single request.
- RAG Agent – Uses the LLM and retrieved context to analyze and summarize the response.
- Append Sheet (Google Sheets) – Logs the agent’s output in a spreadsheet.
- Slack Alert – Sends a message when an error occurs, including details for troubleshooting.
Next, we will build each part of this pipeline in n8n step by step.
Step-by-step: Building the Survey Auto Analyze workflow in n8n
Step 1 – Create the Webhook Trigger
The webhook is the entry point for your survey data.
- In n8n, add a Webhook node.
- Set the HTTP Method to
POST. - Set the Path to something like
survey-auto-analyze. - Copy the generated webhook URL.
- In your survey provider (for example Typeform, a Google Forms webhook integration, or a custom app), configure it to send a POST request to this webhook URL whenever a response is submitted.
The payload you receive should include at least:
respondent_idtimestampanswers(for example a map of question IDs to free-text answers)- Any extra metadata you care about, such as
sourceor survey name
Step 2 – Split long text into chunks
Embedding models work best when text is not too long. Chunking also improves retrieval quality later.
- Add a Text Splitter node after the Webhook.
- Choose a character-based splitter.
- Set:
- chunkSize to a value like
400 - chunkOverlap to a value like
40
- chunkSize to a value like
This means each long answer will be broken into overlapping segments. The overlap helps preserve context between chunks so that semantic search in Pinecone works better.
Step 3 – Generate embeddings with OpenAI
Next, you will convert each text chunk into a vector representation using OpenAI.
- Add an Embeddings node.
- Select the model
text-embedding-3-smallor the latest recommended OpenAI embedding model. - Attach your OpenAI API credentials in n8n.
- Configure the node so that for each chunk from the Text Splitter, the embeddings endpoint is called and a vector is returned.
Each output item from this node will now contain the original text chunk plus its embedding vector.
Step 4 – Insert embeddings into Pinecone
Now you will store the vectors in Pinecone so they can be used for retrieval and RAG later.
- Add a Pinecone Insert node and connect it to the Embeddings node.
- Provide your Pinecone index name, for example
survey_auto_analyze. - Map the embedding vector to the appropriate field expected by Pinecone.
- Add metadata fields such as:
source(for exampletypeform)respondent_idquestion_idtimestamp
Rich metadata makes it much easier to filter and audit items later. For example, you can query only responses from a particular survey, time range, or question.
Step 5 – Configure retrieval for RAG using Pinecone
When a new response comes in, you may want to analyze it in the context of similar past responses. That is where retrieval comes in.
- Add a Pinecone Query node.
- Use the embedding of the current response (or its chunks) as the query vector.
- Set topK to the number of nearest neighbors you want to retrieve, for example
5to10. - Connect a Vector Tool node so that the retrieved documents can be passed as context into the agent.
The Pinecone Query node returns the most semantically similar chunks, which the Vector Tool then exposes to the RAG agent as a source of contextual information.
Step 6 – Set up Window Memory
For many survey analysis cases, you will want the agent to keep track of short-term context during processing of a single request.
- Add a Window Memory node.
- Configure it according to how much conversational or request-specific history you want to preserve.
This memory is typically short-lived and scoped to the current execution, which helps the agent handle multi-step reasoning without exceeding token limits.
Step 7 – Configure the RAG Agent in n8n
Now you will put everything together in a Retrieval-Augmented Generation agent.
- Add an Agent node.
- Set a clear system message, for example:
You are an assistant for Survey Auto Analyze. Process the following data to produce a short summary, sentiment, key themes, and recommended action. - Attach:
- Your chosen Chat Model (LLM)
- The Vector Tool output (retrieved documents from Pinecone)
- The Window Memory node
- Define the expected output format. You can use:
- Plain text, for example a readable summary
- Structured JSON, if you want to parse fields like
sentiment,themes, andactionsdownstream
The agent will read the current survey response, look up similar past chunks in Pinecone, and then generate an analysis that reflects both the new data and the historical context.
Step 8 – Log results to Google Sheets
To keep a simple log of all analyzed responses, you can append each result to a Google Sheet.
- Add a Google Sheets node and choose the Append Sheet operation.
- Connect it to the output of the RAG Agent node.
- Select or create a sheet, for example a tab named
Log. - Map the fields from the agent output, such as:
- Summary
- Sentiment
- Themes
- Recommended actions
- Respondent ID and timestamp
Over time, this sheet becomes a searchable record of all processed survey responses and their AI-generated insights.
Step 9 – Handle errors with Slack alerts
To make the workflow robust, you should know when something fails so that you can fix it quickly.
- On the nodes that are most likely to fail (for example external API calls), configure an onError branch.
- Add a Slack node to this error path.
- Set up the Slack node to send a message to a monitoring channel.
- Include:
- The error message or stack trace
- The original webhook payload (or a safe subset) so you can reproduce the issue
This gives you immediate visibility when OpenAI, Pinecone, or any other part of the workflow encounters a problem.
Example: Webhook payload and RAG output
Here is a sample survey payload that might be sent to the Webhook node:
{ "respondent_id": "abc123", "timestamp": "2025-09-05T12:34:56Z", "answers": { "q1": "I love the mobile app but the login flow is confusing sometimes.", "q2": "Customer service was helpful but slow to respond." }, "source": "typeform"
}
After passing through embeddings, Pinecone, and the RAG agent, the output written to Google Sheets could look like this (for example in a single cell or structured across columns):
Summary: Positive feedback on mobile app UX; pain point: login flow.
Sentiment: mixed-positive.
Themes: UX, Authentication, Support response time.
Actions: Simplify login steps; improve SLA for support.
You can adapt the format to your reporting needs, but the idea is always the same: turn raw text into a concise, actionable summary.
Best practices for this n8n survey analysis workflow
Chunking and retrieval quality
- Use chunking with overlap for better semantic retrieval.
- Good starting values:
- chunkSize: 300 to 500 characters
- chunkOverlap: 20 to 60 characters
- Experiment with these values if you notice poor matches from Pinecone.
Metadata in Pinecone
- Store useful metadata for each vector:
question_idrespondent_idtimestampsourceor survey name
- This enables filtered queries, audits, and more targeted analysis later.
Balancing cost and quality
- Use a smaller embedding model like
text-embedding-3-smallto keep indexing costs low. - If you need higher quality analysis, invest in a more capable LLM for the RAG agent while keeping embeddings lightweight.
- Monitor usage of:
- OpenAI embeddings
- Pinecone storage and queries
- LLM tokens
- Batch inserts into Pinecone where possible to reduce overhead.
Reliability and rate limits
- Implement rate limiting and retry logic for calls to OpenAI and Pinecone, either via n8n settings or at your webhook ingress.
- Use the Slack error alerts to quickly identify and resolve transient issues.
Privacy and PII handling
- Handle sensitive personal data in accordance with your privacy policy.
- Consider:
- Hashing identifiers like
respondent_id - Redacting names, emails, or other PII before generating embeddings
- Hashing identifiers like
Testing and troubleshooting your n8n workflow
Once your pipeline is configured, spend time testing it with different types of input:
- Short answers to confirm basic behavior.
- Very long responses to validate chunking and token limits.
- Non-English text to see how embeddings and the LLM handle multilingual input.
Use n8n’s execution log to inspect what each node receives and outputs. This is especially useful for:
- Confirming that chunking is working as expected.
- Checking that embeddings are being created and stored in Pinecone.
- Verifying that Pinecone Query returns relevant neighbors.
- Debugging the RAG agent’s prompt and output format.
If you see poor retrieval or strange answers from the agent:
- Adjust chunkSize and chunkOverlap.
- Tune topK in the Pinecone Query node.
