{ "id": "TApiWf45Testimonial01", "name": "Customer Testimonial Mining (TranscriptAPI)", "nodes": [ { "parameters": {}, "id": "45454545-4545-4545-8545-454545454501", "name": "Start", "type": "n8n-nodes-base.manualTrigger", "typeVersion": 1, "position": [ -340, 0 ] }, { "parameters": { "assignments": { "assignments": [ { "id": "45454545-4545-4545-8545-4545454545a1", "name": "channel", "value": "REPLACE_WITH_CHANNEL_HANDLE_OR_ID", "type": "string" } ] }, "options": {} }, "id": "45454545-4545-4545-8545-454545454502", "name": "Set Channel", "type": "n8n-nodes-base.set", "typeVersion": 3.4, "position": [ -120, 0 ] }, { "parameters": { "url": "https://transcriptapi.com/api/v2/youtube/channel/resolve", "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "sendQuery": true, "queryParameters": { "parameters": [ { "name": "input", "value": "={{ $json.channel }}" } ] }, "options": {} }, "id": "45454545-4545-4545-8545-454545454503", "name": "Resolve Channel", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 100, 0 ], "credentials": { "httpHeaderAuth": { "id": "REPLACE_TRANSCRIPTAPI_CRED_ID", "name": "TranscriptAPI - Authorization Bearer" } } }, { "parameters": { "url": "https://transcriptapi.com/api/v2/youtube/channel/videos", "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "sendQuery": true, "queryParameters": { "parameters": [ { "name": "channel", "value": "={{ $json.channel_id }}" } ] }, "options": {} }, "id": "45454545-4545-4545-8545-454545454504", "name": "List Channel Videos", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 320, 0 ], "credentials": { "httpHeaderAuth": { "id": "REPLACE_TRANSCRIPTAPI_CRED_ID", "name": "TranscriptAPI - Authorization Bearer" } } }, { "parameters": { "jsCode": "const data = $input.first().json;\nreturn (data.results || []).map((v) => ({ json: { videoId: v.videoId, videoTitle: v.title || null, videoUrl: 'https://www.youtube.com/watch?v=' + v.videoId } }));" }, "id": "45454545-4545-4545-8545-454545454505", "name": "Extract Video List", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 540, 0 ] }, { "parameters": { "maxItems": 3 }, "id": "45454545-4545-4545-8545-454545454506", "name": "Keep First 3", "type": "n8n-nodes-base.limit", "typeVersion": 1, "position": [ 760, 0 ] }, { "parameters": { "url": "https://transcriptapi.com/api/v2/youtube/transcript", "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "sendQuery": true, "queryParameters": { "parameters": [ { "name": "video_url", "value": "={{ $json.videoUrl }}" }, { "name": "format", "value": "json" }, { "name": "send_metadata", "value": "true" } ] }, "options": {} }, "id": "45454545-4545-4545-8545-454545454507", "name": "Get Transcript (TranscriptAPI)", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 980, 0 ], "credentials": { "httpHeaderAuth": { "id": "REPLACE_TRANSCRIPTAPI_CRED_ID", "name": "TranscriptAPI - Authorization Bearer" } }, "onError": "continueRegularOutput" }, { "parameters": { "mode": "runOnceForEachItem", "jsCode": "function ts(sec) {\n const s = Math.floor(sec || 0);\n const h = Math.floor(s / 3600), m = Math.floor((s % 3600) / 60), r = s % 60;\n const mm = (r < 10 ? '0' : '') + r;\n return h > 0 ? (h + ':' + (m < 10 ? '0' : '') + m + ':' + mm) : (m + ':' + mm);\n}\nconst d = $json; const seg = Array.isArray(d.transcript) ? d.transcript : []; const meta = d.metadata || {};\nconst vid = d.video_id;\nconst transcriptText = seg.map((s) => '[' + ts(s.start) + '] ' + s.text).join('\\n');\nreturn { json: { title: meta.title || vid, videoUrl: 'https://www.youtube.com/watch?v=' + vid, transcriptText, hasTranscript: seg.length > 0 } };" }, "id": "45454545-4545-4545-8545-454545454508", "name": "Build Timestamped Text", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 1200, 0 ] }, { "parameters": { "conditions": { "options": { "caseSensitive": true, "leftValue": "", "typeValidation": "strict" }, "conditions": [ { "id": "c4545454-4545-4545-8545-454545454ccc", "leftValue": "={{ $json.hasTranscript }}", "rightValue": true, "operator": { "type": "boolean", "operation": "true", "singleValue": true } } ], "combinator": "and" }, "options": {} }, "id": "45454545-4545-4545-8545-454545454509", "name": "Has Transcript?", "type": "n8n-nodes-base.filter", "typeVersion": 2, "position": [ 1420, 0 ] }, { "parameters": { "method": "POST", "url": "https://api.openai.com/v1/chat/completions", "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "sendBody": true, "specifyBody": "json", "jsonBody": "={{ JSON.stringify({ model: 'gpt-4o-mini', response_format: { type: 'json_object' }, messages: [ { role: 'system', content: 'You mine positive customer testimonials from a timestamped video transcript. Respond with a JSON object with one key: testimonials (array of objects with quote (short, near-verbatim, positive), timestamp (the nearest [m:ss] marker), product_or_theme (what it praises), confidence (high/medium/low), suggested_use (e.g. website, case study, social). Only include genuinely positive customer statements; return an empty array if there are none. Use only what is in the transcript.' }, { role: 'user', content: 'Video: ' + ($json.title || '') + '\\n\\nTimestamped transcript:\\n' + $json.transcriptText } ] }) }}", "options": {} }, "id": "45454545-4545-4545-8545-454545454510", "name": "Mine Testimonials (LLM)", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 1640, 0 ], "credentials": { "httpHeaderAuth": { "id": "REPLACE_OPENAI_CRED_ID", "name": "OpenAI - Authorization Bearer" } } }, { "parameters": { "jsCode": "// Fan out: one row per mined testimonial, paired to its source video by index.\nconst builds = $('Has Transcript?').all();\nconst out = [];\n$input.all().forEach((item, i) => {\n const raw = (item.json.choices && item.json.choices[0] && item.json.choices[0].message.content) || '';\n let r; try { r = JSON.parse(raw); } catch (e) { r = {}; }\n const src = (builds[i] && builds[i].json) || {};\n (r.testimonials || []).forEach((t) => out.push({ json: {\n quote: t.quote || '', timestamp: t.timestamp || '', productOrTheme: t.product_or_theme || '',\n confidence: (t.confidence == null ? null : t.confidence), suggestedUse: t.suggested_use || null,\n sourceTitle: src.title, sourceVideoUrl: src.videoUrl,\n } }));\n});\nreturn out;" }, "id": "45454545-4545-4545-8545-454545454511", "name": "Format Testimonials", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 1860, 0 ] } ], "connections": { "Start": { "main": [ [ { "node": "Set Channel", "type": "main", "index": 0 } ] ] }, "Set Channel": { "main": [ [ { "node": "Resolve Channel", "type": "main", "index": 0 } ] ] }, "Resolve Channel": { "main": [ [ { "node": "List Channel Videos", "type": "main", "index": 0 } ] ] }, "List Channel Videos": { "main": [ [ { "node": "Extract Video List", "type": "main", "index": 0 } ] ] }, "Extract Video List": { "main": [ [ { "node": "Keep First 3", "type": "main", "index": 0 } ] ] }, "Keep First 3": { "main": [ [ { "node": "Get Transcript (TranscriptAPI)", "type": "main", "index": 0 } ] ] }, "Get Transcript (TranscriptAPI)": { "main": [ [ { "node": "Build Timestamped Text", "type": "main", "index": 0 } ] ] }, "Build Timestamped Text": { "main": [ [ { "node": "Has Transcript?", "type": "main", "index": 0 } ] ] }, "Has Transcript?": { "main": [ [ { "node": "Mine Testimonials (LLM)", "type": "main", "index": 0 } ] ] }, "Mine Testimonials (LLM)": { "main": [ [ { "node": "Format Testimonials", "type": "main", "index": 0 } ] ] } }, "active": false, "settings": { "executionOrder": "v1" }, "pinData": {} }