{ "nodes": [ { "id": "d73e5113-119f-4e62-9872-48e6a971d760", "name": "Stop Interview?", "type": "n8n-nodes-base.if", "position": [ 3380, 920 ], "parameters": { "options": {}, "conditions": { "options": { "version": 2, "leftValue": "", "caseSensitive": true, "typeValidation": "strict" }, "combinator": "and", "conditions": [ { "id": "3cf788a6-94d0-4223-9caa-30b8e4df8e01", "operator": { "type": "boolean", "operation": "true", "singleValue": true }, "leftValue": "={{ $json.output.stop_interview }}", "rightValue": "" } ] } }, "typeVersion": 2.2, "notes": "This if node performs automated tasks as part of the workflow." }, { "id": "cda3c487-97fa-4037-b9a0-0802f4a02727", "name": "Generate Row", "type": "n8n-nodes-base.set", "position": [ 3740, 1200 ], "parameters": { "options": {}, "assignments": { "assignments": [ { "id": "06146a75-b67a-42cf-aa6f-241f23c47b9a", "name": "timestamp", "type": "string", "value": "={{ $now.toISO() }}" }, { "id": "b0278c64-58a7-487d-b7ba-d102fb5d4a0c", "name": "type", "type": "string", "value": "next_question" }, { "id": "ba034ca1-408e-422f-b071-dab0ef12fb48", "name": "question", "type": "string", "value": "={{ $('Parse Response').item.json.output.question }}" }, { "id": "a2231f6e-f507-408e-b598-53888cf8d4b5", "name": "answer", "type": "string", "value": "={{ $('Get Answer').item.json.answer }}" } ] } }, "typeVersion": 3.4, "notes": "This set node performs automated tasks as part of the workflow." }, { "id": "3486f9ae-6a19-4f1f-be46-15376053e71f", "name": "Generate Row1", "type": "n8n-nodes-base.set", "position": [ 3580, 760 ], "parameters": { "options": {}, "assignments": { "assignments": [ { "id": "06146a75-b67a-42cf-aa6f-241f23c47b9a", "name": "timestamp", "type": "string", "value": "={{ $now.toISO() }}" }, { "id": "b0278c64-58a7-487d-b7ba-d102fb5d4a0c", "name": "type", "type": "string", "value": "stop_interview" }, { "id": "ba034ca1-408e-422f-b071-dab0ef12fb48", "name": "question", "type": "string", "value": "=None" }, { "id": "a2231f6e-f507-408e-b598-53888cf8d4b5", "name": "answer", "type": "string", "value": "=None" } ] } }, "typeVersion": 3.4, "notes": "This set node performs automated tasks as part of the workflow." }, { "id": "a0e5d40d-e956-4ded-891f-ce5d0f55935f", "name": "Clear For Next Interview", "type": "n8n-nodes-base.noOp", "position": [ 3900, 760 ], "parameters": { "mode": "delete", "deleteMode": "all" }, "typeVersion": 1.1, "notes": "This memoryManager node performs automated tasks as part of the workflow." }, { "id": "66a33fcb-a902-4159-a025-2dff426c1fce", "name": "Sticky Note", "type": "n8n-nodes-base.stickyNote", "position": [ 2580, 860 ], "parameters": { "width": 180, "height": 260, "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n### 🚨 Set Interview Topic Here!" }, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow." }, { "id": "5cfb7114-a773-4c76-bb3b-7c004be5f799", "name": "Send Reply To Agent", "type": "n8n-nodes-base.set", "position": [ 4060, 1200 ], "parameters": { "options": {}, "assignments": { "assignments": [ { "id": "06a9c730-4756-4bc8-a394-6ff249cf7117", "name": "answer", "type": "string", "value": "={{ $('Get Answer').item.json.answer }}" } ] } }, "typeVersion": 3.4, "notes": "This set node performs automated tasks as part of the workflow." }, { "id": "aa30c462-7dfa-40a7-8e63-bed29b30213c", "name": "Sticky Note1", "type": "n8n-nodes-base.stickyNote", "position": [ 1880, 1060 ], "parameters": { "color": 7, "width": 490, "height": 220, "content": "## 1. Setup Interview\n[Learn more about the form trigger node]({{ $env.WEBHOOK_URL }}\n\nThe form trigger node will be our entry point into this workflow and to start, we'll just ask for the user's name to start the interview.\nOur session storage will be using Redis via Upstash.com (you can use regular redis btw!) - whichever way, this ensures a highly scalable system able to handle many users." }, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow." }, { "id": "5353a7c8-d0e4-429a-ab68-c54d9b845a43", "name": "Start Interview", "type": "n8n-nodes-base.formTrigger", "position": [ 1880, 880 ], "webhookId": "8d849295-ed30-41ab-a17c-464227cec8fb", "parameters": { "options": { "path": "driving-lessons-survey", "ignoreBots": true, "buttonLabel": "Begin Interview!", "appendAttribution": true, "useWorkflowTimezone": true }, "formTitle": "=UK Practical Driving Test Satisfaction Interview", "formFields": { "values": [ { "fieldLabel": "What is your name?", "placeholder": "ie. Sam Smith", "requiredField": true } ] }, "responseMode": "lastNode", "formDescription": "=Thanks for taking part in our Interview. You will be presented with an unending series of questions to help us with your experiences in preparing for and taking the UK Practical Driving Test.\n\nThe interviewer is an AI agent and the questions are dynamically generated. When you're done with answer, simple say STOP to exit the interview. Sessions are deleted after 24 hours." }, "typeVersion": 2.2, "notes": "This formTrigger node performs automated tasks as part of the workflow." }, { "id": "c88a829f-c4b4-4ad4-b121-32b15fae9980", "name": "Sticky Note2", "type": "n8n-nodes-base.stickyNote", "position": [ 2840, 600 ], "parameters": { "color": 7, "width": 614, "height": 280, "content": "## 2. AI Researcher for Endless Interview Questions\n[Learn more about the AI Agent node]({{ $env.WEBHOOK_URL }}\n\nAn AI interviewer is an interesting take on a role traditionally understood as expensive and time-consuming - both in preparation and execution. What if this could be handed off to an AI/LLM, which could perform when it suits the interviewee and ask a never-ending list of open and follow-on questions for deeper insights?\n\nThis is what this AI researcher agent is designed to do! Upon activation, a loop is created where the agent generates the question and the user answers via the form node. This continues until the user asks to stop the interview." }, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow." }, { "id": "10e5dbe0-0163-4c21-8811-9ce9a2a5063b", "name": "Sticky Note3", "type": "n8n-nodes-base.stickyNote", "position": [ 3580, 1380 ], "parameters": { "color": 7, "width": 580, "height": 202, "content": "## 3. Record Answers and Prep for Next Question\n[Learn more about the n8n Form node]({{ $env.WEBHOOK_URL }}\n\nThe interview is no good if we can't record the answers somewhere for later analysis! Using n8n form node to capture the answer, we can simple push our new question and answer pair to our Redis session to build our transcript before continuing the loop with the agent." }, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow." }, { "id": "0a0cc961-d364-40d2-9ece-cef7d17c4b45", "name": "Sticky Note4", "type": "n8n-nodes-base.stickyNote", "position": [ 3820, 460 ], "parameters": { "color": 7, "width": 528, "height": 253, "content": "## 4. Graciously End the Interview\n[Read more about the Chat Manager node]({{ $env.WEBHOOK_URL }}\n\nOnce the AI/LLM detects the user wishes to end the interview (which is done by the user explicitly saying in the form), then the loop breaks and we conclude the interview session and displaying the confirmation screen.\n\nFor this demo, I've created a special confirmation screen which also displays the transcript. This is done by redirecting to a webhook URL. If you don't need this, feel free to change this to \"show completion screen\" instead.\n" }, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow." }, { "id": "279d9a67-1d3b-4ffe-a152-33164ef9e2c8", "name": "Get Answer", "type": "n8n-nodes-base.form", "position": [ 3580, 1200 ], "webhookId": "d96bb88d-db84-4a68-8f02-bcff9cb8429e", "parameters": { "options": { "formTitle": "={{ $json.output.question }}", "buttonLabel": "Next Question", "formDescription": "Please answer the question or type \"stop interview\" to end the interview." }, "formFields": { "values": [ { "fieldType": "textarea", "fieldLabel": "answer", "requiredField": true } ] } }, "typeVersion": 1, "notes": "This form node performs automated tasks as part of the workflow." }, { "id": "4e284505-afc3-4e3e-88c8-38021efbf3c1", "name": "Sticky Note5", "type": "n8n-nodes-base.stickyNote", "position": [ 1280, 500 ], "parameters": { "width": 522.6976744186048, "height": 787.6241860465118, "content": "## Try it out! \n\n### Conducting user interviews have been traditionally difficult due to preparation, timing and execution costs. What if we let an AI/LLM do it instead?\n\nThis template enables automated AI/LLM powered user interviews using n8n forms and an AI agent where the question and answers are recorded in a google sheet for later analysis. A powerful tool for any researcher.\n\n### Check out the full showcase post here: {{ $env.WEBHOOK_URL }}\n\n### How it works\n* A form trigger is used to start the interview and a new session is created in redis to capture the transcript.\n* An AI agent is then tasked to ask questions to the user regarding the topic of the interview. This is setup as a loop so the questions never stop unless the user wishes to end the interview.\n* Each answer is recorded in our session set up earlier between questions.\n* Finally, when the user requests to end the interview we break the loop and show the interview completion screen.\n\n### Why Redis?\nRedis is a fast key-value datastore which makes it ideal for sessions. This ensures the interview flow stays snappy between questions. For my live demo, I used Upstash.com which has a generous free tier.\n\n\n### Need Help?\nJoin the [Discord]({{ $env.WEBHOOK_URL }} or ask in the [Forum]({{ $env.WEBHOOK_URL }}\n\nHappy Hacking!\n" }, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow." }, { "id": "ff37e943-851f-4ea7-bcab-b33150881b72", "name": "Set Interview Topic", "type": "n8n-nodes-base.set", "position": [ 2620, 880 ], "parameters": { "options": {}, "assignments": { "assignments": [ { "id": "386f91e1-cc3e-4912-84e3-5ecdbf5412c8", "name": "answer", "type": "string", "value": "=Hello, my name is {{ $('Start Interview').first().json['What is your name?'] }}" }, { "id": "492d5ecc-4e76-4297-b8a7-9ca4f801c855", "name": "interview_topic", "type": "string", "value": "Your experience preparing for and taking the UK practical driving test" } ] } }, "typeVersion": 3.4, "notes": "This set node performs automated tasks as part of the workflow." }, { "id": "446937bc-a599-4184-b52e-be0607d62d94", "name": "UUID", "type": "n8n-nodes-base.crypto", "position": [ 2020, 880 ], "parameters": { "action": "generate" }, "typeVersion": 1, "notes": "This crypto node performs automated tasks as part of the workflow." }, { "id": "da94c22a-4b26-4898-bde8-b57b5bf01f15", "name": "Generate Row2", "type": "n8n-nodes-base.set", "position": [ 2300, 880 ], "parameters": { "options": {}, "assignments": { "assignments": [ { "id": "06146a75-b67a-42cf-aa6f-241f23c47b9a", "name": "timestamp", "type": "string", "value": "={{ $now.toISO() }}" }, { "id": "b0278c64-58a7-487d-b7ba-d102fb5d4a0c", "name": "type", "type": "string", "value": "start_interview" }, { "id": "ba034ca1-408e-422f-b071-dab0ef12fb48", "name": "question", "type": "string", "value": "=What is your name?" }, { "id": "a2231f6e-f507-408e-b598-53888cf8d4b5", "name": "answer", "type": "string", "value": "={{ $('Start Interview').first().json['What is your name?'] }}" } ] } }, "typeVersion": 3.4, "notes": "This set node performs automated tasks as part of the workflow." }, { "id": "9aba23d7-04af-4478-b39b-417f0917597d", "name": "Create Session", "type": "n8n-nodes-base.redis", "position": [ 2160, 880 ], "parameters": { "key": "YOUR_CREDENTIAL_HERE", "ttl": "={{ 60 * 60 * 24 }}", "value": "={{ [] }}", "expire": true, "keyType": "YOUR_CREDENTIAL_HERE", "operation": "set" }, "credentials": { "redis": { "id": "AbPH1yYQ924bVUqm", "name": "Upstash (ai interviewer)" } }, "typeVersion": 1, "notes": "This redis node performs automated tasks as part of the workflow." }, { "id": "217c9866-a162-41c6-b123-189869a6cb58", "name": "Update Session", "type": "n8n-nodes-base.redis", "position": [ 2440, 880 ], "parameters": { "list": "=session_{{ $('UUID').first().json.data }}", "tail": true, "operation": "push", "messageData": "={{ $json.toJsonString() }}" }, "credentials": { "redis": { "id": "AbPH1yYQ924bVUqm", "name": "Upstash (ai interviewer)" } }, "typeVersion": 1, "notes": "This redis node performs automated tasks as part of the workflow." }, { "id": "95e8b7c4-4f27-49f3-b509-5238c0f7bd5d", "name": "Update Session1", "type": "n8n-nodes-base.redis", "position": [ 3900, 1200 ], "parameters": { "list": "=session_{{ $('UUID').first().json.data }}", "tail": true, "operation": "push", "messageData": "={{ $json.toJsonString() }}" }, "credentials": { "redis": { "id": "AbPH1yYQ924bVUqm", "name": "Upstash (ai interviewer)" } }, "typeVersion": 1, "notes": "This redis node performs automated tasks as part of the workflow." }, { "id": "afaa55dd-844e-4bf3-8a31-3a0953caaf69", "name": "Update Session2", "type": "n8n-nodes-base.redis", "position": [ 3740, 760 ], "parameters": { "list": "=session_{{ $('UUID').first().json.data }}", "tail": true, "operation": "push", "messageData": "={{ $json.toJsonString() }}" }, "credentials": { "redis": { "id": "AbPH1yYQ924bVUqm", "name": "Upstash (ai interviewer)" } }, "typeVersion": 1, "notes": "This redis node performs automated tasks as part of the workflow." }, { "id": "c381d598-1902-4789-ac15-65ac2124fbdd", "name": "Valid Session?", "type": "n8n-nodes-base.if", "position": [ 5080, 1240 ], "parameters": { "options": {}, "conditions": { "options": { "version": 2, "leftValue": "", "caseSensitive": true, "typeValidation": "strict" }, "combinator": "and", "conditions": [ { "id": "500d6ca9-2a04-40f0-98e8-aa4290e6a30d", "operator": { "type": "array", "operation": "exists", "singleValue": true }, "leftValue": "={{ $json.data }}", "rightValue": "" } ] } }, "typeVersion": 2.2, "notes": "This if node performs automated tasks as part of the workflow." }, { "id": "f26ccdaa-4f94-4acb-894b-341648aee8b0", "name": "Respond to Webhook", "type": "n8n-nodes-base.respondToWebhook", "position": [ 5440, 1240 ], "parameters": { "options": { "responseCode": 200, "responseHeaders": { "entries": [ { "name": "Content-Type", "value": "text/html" } ] } }, "respondWith": "text", "responseBody": "={{ $json.html }}" }, "typeVersion": 1.1, "notes": "This respondToWebhook node performs automated tasks as part of the workflow." }, { "id": "09a05dc6-4a21-4df0-a83d-5e1b986090f8", "name": "Window Buffer Memory2", "type": "n8n-nodes-base.noOp", "position": [ 3000, 1120 ], "parameters": { "sessionKey": "YOUR_CREDENTIAL_HERE", "sessionIdType": "customKey" }, "typeVersion": 1.2, "notes": "This memoryBufferWindow node performs automated tasks as part of the workflow." }, { "id": "26f87c7d-9e2c-41e8-b7eb-3c249a69f905", "name": "Window Buffer Memory", "type": "n8n-nodes-base.noOp", "position": [ 3900, 920 ], "parameters": { "sessionKey": "YOUR_CREDENTIAL_HERE", "sessionIdType": "customKey" }, "typeVersion": 1.2, "notes": "This memoryBufferWindow node performs automated tasks as part of the workflow." }, { "id": "ab891c71-af03-49c9-b281-d0058374260b", "name": "Sticky Note6", "type": "n8n-nodes-base.stickyNote", "position": [ 4180, 740 ], "parameters": { "width": 276.4353488372094, "height": 320.31553488372094, "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n### 🚨 Set Your Webhook URL here!\nFor this demo, we want to show a customised completion screen with transcript so it's necessary to redirect to a webhook (see step 6)." }, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow." }, { "id": "7a063851-1bea-4e34-897c-4038d08b845e", "name": "Redirect to Completion Screen", "type": "n8n-nodes-base.form", "position": [ 4260, 760 ], "webhookId": "9fdedf1b-e413-4fc3-94a4-9cc24bffff8a", "parameters": { "operation": "completion", "redirectUrl": "{{ $env.BASE_URL }}", "respondWith": "redirect" }, "typeVersion": 1, "notes": "This form node performs automated tasks as part of the workflow." }, { "id": "b67b3fa5-faf6-402b-9b9e-c783869770ca", "name": "Sticky Note7", "type": "n8n-nodes-base.stickyNote", "position": [ 4640, 1220 ], "parameters": { "color": 5, "width": 236.3564651162793, "height": 345.82027906976737, "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n### 🚨 This is the webhook we want to redirect to!\nIf you're on n8n cloud, you may want to copy the webhook url generated here and use it as the form ending's redirect url." }, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow." }, { "id": "583d1572-2d6f-4ca4-9e31-33dc1481e87a", "name": "Sticky Note8", "type": "n8n-nodes-base.stickyNote", "position": [ 4580, 980 ], "parameters": { "color": 7, "width": 588, "height": 207, "content": "## 6. Display the Transcript\n[Read more about the Webhook Trigger]({{ $env.WEBHOOK_URL }}\n\nThis step is totally optional. For a nicer user experience, I use this webhook mini-flow to display the user's transcript for the completion screen. It works by capturing the session_id in the webhook's url and searching for it in our redis database. If a match is found the transcript is fetched and rendered into a webpage using the HTML node and returned to the user. If no match is found, a 404 message is displayed instead." }, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow." }, { "id": "5fcf86b9-3fa3-48f5-a4a4-a1e261a48b49", "name": "Webhook", "type": "n8n-nodes-base.webhook", "position": [ 4700, 1240 ], "webhookId": "78df12c4-ccd0-46dd-be0d-4445c2bd04f2", "parameters": { "path": "ai-interview-transcripts/:session_id", "options": { "ignoreBots": true }, "responseMode": "responseNode" }, "typeVersion": 2, "notes": "This webhook node performs automated tasks as part of the workflow." }, { "id": "6df57307-feef-4be5-861d-fdc0b92d1ef6", "name": "404 Not Found", "type": "n8n-nodes-base.html", "position": [ 5260, 1320 ], "parameters": { "html": "\n\n\n\t
\n\t\t\n\t\t\n\t\t\n\t\t\n\n\t\tThe requested session does not exist.
\nYour session may have expired.
\nIf you liked this demo,
please follow me on {{ $env.WEBHOOK_URL }} and\n {{ $env.WEBHOOK_URL }}\n
\n \n Support my work! Sign up to n8n using this link 🙏\n \n
\nThis session is deleted within 24 hours.
\n {{\n $json.data\n .map(item => JSON.parse(item))\n .filter(item => item.type === 'next_question')\n .map(item => `\n