Category: Automations › Start a New Business · Best for: Agencies and consultants qualifying new clients · Platform: n8n · Steps: 11
What it does
Your form uses AI to ask the right next question, so you learn what each client needs.
Avoid Asking Redundant Questions with Dynamically Generated Forms using OpenAI
Works with: OpenAI, Output Parser Structured, Chain Llm
What you get
- The n8n workflow file (
workflow.json), ready to import - This setup guide
- The list of fields to change for your own accounts (see Install below)
- Email support if you get stuck
Before you start
-
An n8n account. Easiest: n8n Cloud (free trial). Self-host for free with Docker:
docker run -it --rm -p 5678:5678 -v n8n_data:/home/node/.n8n docker.n8n.io/n8nio/n8n, then open http://localhost:5678. -
Accounts and API keys for these services:
- OpenAI API key: how to connect (used by OpenAI Chat Model)
Install
- In n8n, click Create workflow (top right).
- Click the ⋯ menu → Import from file and choose
workflow.json. Or open the file, copy everything and paste it onto the empty canvas with Ctrl/Cmd + V. - Open each node with a red warning triangle and pick or create the matching credential from the list above.
- Click Save.
Test it
- Click Test workflow (or Execute workflow). Get Basic Information starts it. Trigger it once with real sample data.
- Click each node to check its output. A green tick means the step worked.
- Fix any red node: it's almost always a credential or a field that still points at a sheet or chat that isn't yours.
Go live
Toggle Active (top right). From now on it runs on its own. Check Executions in the left sidebar to see every run.
How it works, step by step
- Get Basic Information starts the workflow (Form).
- OpenAI Chat Model uses AI (OpenAI).
- Structured Output Parser uses AI (Output Parser Structured).
- Get Business Overview uses Form.
- Analyse Response uses AI (Chain Llm).
- Split Out Analysis uses Split Out.
- Remove Already Answered Questions checks a condition and routes items accordingly.
- Prepare For Form Generation reshapes the data for the next step.
- Aggregate For Form Generation uses Aggregate.
- Clarification Questions uses Form.
- End Form uses Form to completion.
Extra setup notes
These notes are also on the canvas as yellow sticky notes:
Avoid Asking Redundant Questions with Dynamically Generated Forms using OpenAI
Target Audience
This workflow has been built for those who require a form to capture as much data as possible as well as the answers to predefined questions, whilst optimising the user experience by avoiding asking redundant questions.
Use Case
When creating a form to capture information, it can be useful to give the user an opportunity to input a long answer to a large, open-ended question. We then want to drill down to answer specific questions that we require the answer to. When doing this, we don't want to ask duplicate questions. This particular scenario imagines an AI consultancy capturing leads.
What it Does
This workflow requires users to input basic information and then answer an open ended question. The specific questions on the next page will only be those that weren't answered in the open-ended question.
How it Works
- The open-ended question (and relevant basic information) is analysed by an LLM to determine which specific questions have not been answered. Chain-of-thought reasoning is utilised and the output structure is specified with the Structured Output Parser.
- Those questions that have already been answered are filtered out nodes. The remaining items are then used to generate the last page of the form.
- Once the user has filled in the final page of the form, they are shown a form completion page.
Next Steps
- Add additional nodes to send an email to the form owner
- Add a subsequent LLM call to analyse the form response - those that are qualified should be given the opportunity to book an appointment
Setup
- Add your OpenAI credentials
- Go to the Get Basic Information node and click Test Step
- Complete the form to test the generic use case
- Modify the prompt in Analyse Response to fit your use case
1. Initial Form Pages
2. Analyse Response
Modification
Replace this sub-node to use a different language model
Modification
Modify the prompt to suit your use case
3. Clean Up Analysis
4. Generate Final Form Page & End Form
Troubleshooting
- "Credentials not found": open the node and select your credential again.
- Google "access blocked": in Google Cloud, add your email as a test user on the OAuth consent screen.
- Webhook not firing: copy the node's Production URL (not Test URL) into the other app, and make sure the workflow is Active.
- AI node errors: check your API key has billing enabled and the model name exists on your plan.
- Nothing happens on schedule: the workflow must be Active, and self-hosted n8n must stay running.
Need help?
Reply to your Morning Method order email and we'll help you get it running.
© Morning Method