{ "id": "TApiWf43Pinecone01", "name": "Channel → Pinecone RAG Ingestion (TranscriptAPI)", "nodes": [ { "parameters": {}, "id": "43434343-4343-4343-8343-434343434301", "name": "Start", "type": "n8n-nodes-base.manualTrigger", "typeVersion": 1, "position": [ -320, 0 ] }, { "parameters": { "assignments": { "assignments": [ { "id": "43434343-4343-4343-8343-4343434343a1", "name": "channel", "value": "REPLACE_WITH_CHANNEL_HANDLE_OR_ID", "type": "string" } ] }, "options": {} }, "id": "43434343-4343-4343-8343-434343434302", "name": "Set Channel", "type": "n8n-nodes-base.set", "typeVersion": 3.4, "position": [ -100, 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": "43434343-4343-4343-8343-434343434303", "name": "Resolve Channel", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 120, 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": "43434343-4343-4343-8343-434343434304", "name": "List Channel Videos", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 340, 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": "43434343-4343-4343-8343-434343434305", "name": "Extract Video List", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 560, 0 ] }, { "parameters": { "maxItems": 3 }, "id": "43434343-4343-4343-8343-434343434306", "name": "Keep First 3", "type": "n8n-nodes-base.limit", "typeVersion": 1, "position": [ 780, 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": "43434343-4343-4343-8343-434343434307", "name": "Get Transcript (TranscriptAPI)", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 1000, 0 ], "credentials": { "httpHeaderAuth": { "id": "REPLACE_TRANSCRIPTAPI_CRED_ID", "name": "TranscriptAPI - Authorization Bearer" } }, "onError": "continueRegularOutput" }, { "parameters": { "jsCode": "// Chunk each transcript into ~200-word overlapping passages with metadata.\nconst CHUNK_WORDS = 200, OVERLAP = 30; const out = [];\nfor (const item of $input.all()) {\n const d = item.json; const seg = Array.isArray(d.transcript) ? d.transcript : [];\n if (seg.length === 0) continue;\n const meta = d.metadata || {}; const vid = d.video_id;\n const words = seg.map((s) => s.text).join(' ').split(' ').filter((w) => w.length > 0);\n const step = Math.max(1, CHUNK_WORDS - OVERLAP); const chunks = [];\n for (let i = 0; i < words.length; i += step) {\n chunks.push(words.slice(i, i + CHUNK_WORDS).join(' '));\n if (i + CHUNK_WORDS >= words.length) break;\n }\n chunks.forEach((text, idx) => out.push({ json: {\n id: vid + '-' + idx, text,\n metadata: { video_id: vid, video_title: meta.title || null, video_url: 'https://www.youtube.com/watch?v=' + vid, chunk_index: idx },\n } }));\n}\nreturn out;" }, "id": "43434343-4343-4343-8343-434343434308", "name": "Chunk for RAG", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 1220, 0 ] }, { "parameters": { "method": "POST", "url": "https://api.openai.com/v1/embeddings", "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "sendBody": true, "specifyBody": "json", "jsonBody": "={{ JSON.stringify({ model: 'text-embedding-3-small', input: $json.text }) }}", "options": {} }, "id": "43434343-4343-4343-8343-434343434309", "name": "Generate Embedding (OpenAI)", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 1440, 0 ], "credentials": { "httpHeaderAuth": { "id": "REPLACE_OPENAI_CRED_ID", "name": "OpenAI - Authorization Bearer" } } }, { "parameters": { "method": "POST", "url": "https://REPLACE_WITH_PINECONE_INDEX_HOST/vectors/upsert", "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "sendBody": true, "specifyBody": "json", "jsonBody": "={{ JSON.stringify({ vectors: [ { id: $('Chunk for RAG').item.json.id, values: ($json.data && $json.data[0] && $json.data[0].embedding) || [], metadata: Object.assign({}, $('Chunk for RAG').item.json.metadata, { text: $('Chunk for RAG').item.json.text }) } ] }) }}", "options": {} }, "id": "43434343-4343-4343-8343-434343434310", "name": "Upsert to Pinecone", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 1660, 0 ], "credentials": { "httpHeaderAuth": { "id": "REPLACE_PINECONE_CRED_ID", "name": "Pinecone - Api-Key" } } } ], "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": "Chunk for RAG", "type": "main", "index": 0 } ] ] }, "Chunk for RAG": { "main": [ [ { "node": "Generate Embedding (OpenAI)", "type": "main", "index": 0 } ] ] }, "Generate Embedding (OpenAI)": { "main": [ [ { "node": "Upsert to Pinecone", "type": "main", "index": 0 } ] ] } }, "active": false, "settings": { "executionOrder": "v1" }, "pinData": {} }