Customer Insights with Qdrant, Python and Information Extractor n8n Workflow Template

n8n workflow template · 24 nodes · OpenAI

Customer Insights with Qdrant, Python and Information Extractor is a free n8n workflow template that runs when another workflow calls it and works with OpenAI, Google Sheets and Qdrant. It has 24 nodes, 6 of them AI nodes (Default Data Loader, Recursive Character Text Splitter, OpenAI Embeddings and OpenAI Chat Model). The notes inside the workflow say: “Join the Discord or ask in the Forum!” To run it, you add your own credentials for Google Sheets OAuth2, OpenAI API and Qdrant API.

At a glance

Trigger
Execute Workflow Trigger (Execute Workflow Trigger)
Nodes
24
Apps
OpenAI, Google Sheets and Qdrant
AI nodes
6
Credentials
3 types
Category
RAG, documents and vector search

Apps and integrations

  • OpenAI
  • Google Sheets
  • Qdrant

Node types used

  • Manual Trigger
  • Edit Fields (Set)
  • HTML
  • Split Out
  • Default Data Loader
  • Recursive Character Text Splitter
  • OpenAI Embeddings
  • HTTP Request
  • OpenAI Chat Model
  • Filter
  • Google Sheets
  • Execute Workflow
  • Execute Workflow Trigger
  • Qdrant Vector Store
  • Code
  • Information Extractor

How it works

The text below comes from the sticky notes inside the workflow. We removed links, code samples and anything that looks like a key or token.

Try It Out!

This workflow generates highly-detailed customer insights from Trustpilot reviews. Works best when dealing with a large number of reviews.

  • Import Trustpilot reviews and vectorise in Qdrant vectorstore.
  • Identify clusters of popular topics in reviews using K-means clustering algorithm.
  • Each valid cluster is analysed and summarised by LLM.
  • Export LLM response and cluster results back into sheet.

Check out the reference google sheet here

Need Help?

Join the Discord or ask in the Forum!

Run this once!

If for any reason you need to run more than once, be sure to clear the existing data first.

Step 1. Starting Fresh

For this demo, we'll clear any existing records in our Qdrant vector store for the selected company. We do this using the Qdrant's delete points API.

Step 5. The Insight Subworkflow

Learn more about Workflow Triggers

This subworkflow takes the companyId to find the relevant records in our Qdrant vector store. It also takes a "from" and "to" date to scope the insights to a particular range - doing this we can say something like "we only want insights for the past month of reviews".

Set company here!

Trustpilot must recognise it as part of the url.

Step 6. Apply Clustering Algorithm to Reviews

Read more about using Python in n8n

We'll retrieve our vectors embeddings for the desired company reviews and perform an advanced clustering algorithm on them. This powerful echnique allows us to quickly group similar embeddings into clusters which we can then use to discover popular feedback, opinions and pain-points!

First Time Running?

There is a slight delay on first run because the code node has to download the required packages.

Step 2. Scraping TrustPilot For Company Reviews

Read more about HTTP Request Node

We'll scrape at the most recent 3 pages of reviews for illustrative purposes but we could easily scrape them all if required. The HTML node offers a convenient way to extract data from the returned html pages and using it, we'll retrieve all the reviews data.

Step 7. Fetch Reviews By Cluster

Learn more about using the Code Node

With the Qdrant point IDs grouped and returned by our code node, all that's left is to fetch the payload of each. Note that the clustering algorithm isn't perfect and may require some tweaking depending on your data.

Step 3. Store Reviews in Qdrant

Learn more about the Qdrant Vector Store

Vector databases are a great way to store data if you're interested in perform similiarity searches which applies here as we want to group similar reviews to find patterns. Qdrant is a powerful vector database and tool of choice because of its robust API implementation and advanced filtering capabilities.

Step 8. Getting Insights from Grouped Reviews

Read more about using Information Extractor Node

Next, we'll use our state-of-the-art LLM to generate insights on our reviews. Doing it this way, we'll able to pull more granular results addressing many key topics within the reviews.

Step 4. Trigger Insights SubWorkflow

Learn more about Workflow Triggers

A subworkflow is used to trigger the analysis for the survey. This separation is optional but used here to better demonstrate the two part process.

Step 9. Write To Insights Sheet

Finally, our completed insights to appended to the Insights Sheet we created earlier in the workflow.

You can find a sample sheet here

Nodes in this workflow

The 24 nodes in file order (sticky notes excluded). Branches and connections determine execution order in n8n:

  1. When clicking ‘Test workflow’ (Manual Trigger)
  2. Zip Entries (Edit Fields (Set))
  3. Extract Reviews (HTML)
  4. Reviews to List (Split Out)
  5. Default Data Loader (Default Data Loader)
  6. Recursive Character Text Splitter (Recursive Character Text Splitter)
  7. Embeddings OpenAI (OpenAI Embeddings)
  8. Set Variables (Edit Fields (Set))
  9. Get Payload of Points (HTTP Request)
  10. Clusters To List (Split Out)
  11. OpenAI Chat Model (OpenAI Chat Model)
  12. Only Clusters With 3+ points (Filter)
  13. Set Variables1 (Edit Fields (Set))
  14. Find Reviews (HTTP Request)
  15. Prep Output For Export (Edit Fields (Set))
  16. Export To Sheets (Google Sheets)
  17. Clear Existing Reviews (HTTP Request)
  18. Trigger Insights (Execute Workflow)
  19. Prep Values For Trigger (Edit Fields (Set))
  20. Execute Workflow Trigger (Execute Workflow Trigger)
  21. Get TrustPilot Page (HTTP Request)
  22. Qdrant Vector Store (Qdrant Vector Store)
  23. Apply K-means Clustering Algorithm (Code)
  24. Customer Insights Agent (Information Extractor)

Credentials you need

  • Google Sheets OAuth2 – used by Export To Sheets
  • OpenAI API – used by Embeddings OpenAI and OpenAI Chat Model
  • Qdrant API – used by Clear Existing Reviews, Find Reviews, Get Payload of Points and Qdrant Vector Store

Configure your own credentials after importing. Create each credential in n8n, then select it in the node.

How to import into n8n

  1. Download the JSON file with the button above.
  2. In n8n, open a new workflow, select the ... menu and choose Import from File. You can also paste the JSON straight into the editor canvas.
  3. Open each node that shows a warning and select or create its credential.
  4. Read the notes on the canvas, test the workflow with sample data, then activate it.

Do you need somewhere to run it? Read our guide to self-hosted n8n.

Need this customised?

We can adapt this workflow to your apps, data and process, then deploy and support it.

Contact Us