Turn top Instagram reels into 7 new scripts using Apify, OpenAI, Claude and Google Sheets
Automatically turn top performing Instagram reels into 7 new ready to use content scripts. This workflow scrapes high performing posts from a chosen Instagram profile, downloads and transcribes the reel audio, analyzes the transcript patterns with AI, and generates 7 fresh script ideas based on what is already working. The final scripts are written into a Google Doc with clean formatting and clear headings, so you can easily review, refine, and publish them. Ideal for creators, social media managers, and marketing teams looking to scale short form content production.
Workflow JSON
{"id":"f4sSBUuQsPG5DG8W","meta":{"instanceId":"656d5a564ac0143eef675b71f9d631f994053de0b60a2f0ff7ba95aafe2a4e5f","templateCredsSetupCompleted":true},"name":"Top IG Reelstto 7 new Scripts (For N8N)","tags":[],"nodes":[{"id":"625a0f93-4e79-4be2-8957-2db633a445d2","name":"When clicking ‘Execute workflow’","type":"n8n-nodes-base.manualTrigger","position":[-2048,80],"parameters":{},"typeVersion":1},{"id":"9fc3b616-a80d-4690-9e5e-e7183be7a8ec","name":"Filter","type":"n8n-nodes-base.code","position":[-848,80],"parameters":{"jsCode":"return items.filter(item => {\n const audioUrl = item.json.audioUrl;\n return audioUrl && audioUrl.trim() !== \"\";\n});"},"typeVersion":2},{"id":"5212cf65-4201-4ac3-8180-ccc28df63f09","name":"Transcribe a recording","type":"@n8n/n8n-nodes-langchain.openAi","position":[-368,80],"parameters":{"options":{},"resource":"audio","operation":"transcribe"},"credentials":{"openAiApi":{"id":"qp3T2Sl9kUlticdh","name":"OpenAi account"}},"typeVersion":2.1},{"id":"7661f8fd-a5d2-4fd4-aaa9-7238f8ec1dcf","name":"HTTP Request","type":"n8n-nodes-base.httpRequest","position":[-592,80],"parameters":{"url":"={{ $json.audioUrl }}","options":{"response":{"response":{"responseFormat":"file"}}}},"typeVersion":4.4},{"id":"51c84944-876a-4e15-b550-edf4860536cc","name":"Run an Actor1","type":"@apify/n8n-nodes-apify.apify","position":[-1808,80],"parameters":{"actorId":{"__rl":true,"mode":"list","value":"shu8hvrXbJbY3Eb9W","cachedResultUrl":"https://console.apify.com/actors/shu8hvrXbJbY3Eb9W/input","cachedResultName":"Instagram Scraper (apify/instagram-scraper)"},"customBody":"{\n \"directUrls\": [\n \"https://www.instagram.com/REPLACE_PROFILE_URL/\"\n ],\n \"resultsLimit\": 30,\n \"resultsType\": \"posts\"\n}"},"credentials":{"apifyApi":{"id":"QPrzUyfKCJyY816r","name":"Apify account"}},"typeVersion":1},{"id":"41d37b1b-29b8-4e45-a71a-265ccfdd2e3f","name":"Get dataset items1","type":"@apify/n8n-nodes-apify.apify","position":[-1584,80],"parameters":{"options":{},"resource":"Datasets","datasetId":"={{ $json.defaultDatasetId }}"},"credentials":{"apifyApi":{"id":"QPrzUyfKCJyY816r","name":"Apify account"}},"typeVersion":1},{"id":"ead00bb9-074e-4681-8414-8f04367ca8f2","name":"Sort1","type":"n8n-nodes-base.sort","position":[-1344,80],"parameters":{"options":{},"sortFieldsUi":{"sortField":[{"order":"descending","fieldName":"videoPlayCount"}]}},"typeVersion":1},{"id":"c5da02f7-d913-4dcb-83ca-daf430330b93","name":"Limit1","type":"n8n-nodes-base.limit","position":[-1104,80],"parameters":{"maxItems":10},"typeVersion":1},{"id":"d29c97c3-ed46-4c85-84b8-6bd41f2e1df3","name":"Combine Transcripts","type":"n8n-nodes-base.code","position":[-160,80],"parameters":{"jsCode":"const transcripts = items\n .map(item => item.json.text)\n .filter(Boolean)\n .join('\\n\\n');\n\nreturn [\n {\n json: {\n transcripts\n }\n }\n];"},"typeVersion":2},{"id":"15e65d25-23af-4afd-aaff-cad9df5a24ce","name":"Message a model1","type":"@n8n/n8n-nodes-langchain.anthropic","position":[32,80],"parameters":{"modelId":{"__rl":true,"mode":"list","value":"claude-sonnet-4-5-20250929","cachedResultName":"claude-sonnet-4-5-20250929"},"options":{"maxTokens":3000},"messages":{"values":[{"content":"=You are an expert TikTok content strategist and copywriter.\n\nAnalyze the following high-performing video transcripts:\n\n{{ $json.transcripts }}\n\nBased on these, create 7 new viral video scripts.\n\nRequirements:\n- Use strong, slightly controversial hooks\n- Focus on real problems, solutions, and results\n- Keep it engaging and natural (not robotic)\n- Make it feel like spoken content (not written captions)\n- Do NOT say SEO is dead\n\nEach script should follow:\nHook → Problem → Solution → How to implement\n\nReturn clean output with 7 separate scripts.\n\nReturn the scripts as clean JSON like this:\n\n[\n {\n \"hook\": \"...\",\n \"problem\": \"...\",\n \"solution\": \"...\",\n \"how_to_implement\": \"...\"\n }\n]\n\nReturn ONLY a valid JSON array.\nDo not include any explanation, text, or formatting outside the JSON.\nNo intro text like \"Here are 7 scripts\".\nOnly return the JSON."}]}},"credentials":{"anthropicApi":{"id":"ViTtIuTAItfl9lE1","name":"Anthropic account"}},"typeVersion":1},{"id":"fd2abed5-871c-4396-b3ba-c34f598787b0","name":"Append row in sheet1","type":"n8n-nodes-base.googleSheets","position":[656,80],"parameters":{"columns":{"value":{"Hook":"={{ $json.hook }}","Source":"Instagram","Problem":"={{ $json.problem }}","Solution":"={{ $json.solution }}","CreatedAt":"={{ new Date().toISOString() }}","Script Number":"={{ $json.script_number }}","How To Implement":"={{ $json.how_to_implement }}"},"schema":[{"id":"Script Number","type":"string","display":true,"required":false,"displayName":"Script Number","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Hook","type":"string","display":true,"required":false,"displayName":"Hook","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Problem","type":"string","display":true,"required":false,"displayName":"Problem","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Solution","type":"string","display":true,"required":false,"displayName":"Solution","defaultMatch":false,"canBeUsedToMatch":true},{"id":"How To Implement","type":"string","display":true,"required":false,"displayName":"How To Implement","defaultMatch":false,"canBeUsedToMatch":true},{"id":"CreatedAt","type":"string","display":true,"removed":false,"required":false,"displayName":"CreatedAt","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Source","type":"string","display":true,"removed":false,"required":false,"displayName":"Source","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Status","type":"string","display":true,"removed":true,"required":false,"displayName":"Status","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":[],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"append","sheetName":{"__rl":true,"mode":"list","value":1090801365,"cachedResultUrl":"https://docs.google.com/spreadsheets/d/1hFJ6_0eDaT_42g8UaxhwvKf0cIEmEkhJf69-P0bjkuk/edit#gid=1090801365","cachedResultName":"Reel Transcript "},"documentId":{"__rl":true,"mode":"list","value":"1hFJ6_0eDaT_42g8UaxhwvKf0cIEmEkhJf69-P0bjkuk","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1hFJ6_0eDaT_42g8UaxhwvKf0cIEmEkhJf69-P0bjkuk/edit?usp=drivesdk","cachedResultName":"Reel Scripts"}},"credentials":{"googleSheetsOAuth2Api":{"id":"CE0Qp23sM8Ti5apg","name":"Google Sheets account"}},"typeVersion":4.7},{"id":"30f17383-75b8-4320-b942-6fb92e32acf5","name":"Format AI Output1","type":"n8n-nodes-base.code","position":[400,80],"parameters":{"jsCode":"// Get raw text from Claude\nconst raw = $json.content[0].text;\n\n// Remove ```json and ``` wrappers\nconst cleaned = raw\n .replace(/```json/g, '')\n .replace(/```/g, '')\n .trim();\n\n// Parse JSON safely\nconst parsed = JSON.parse(cleaned);\n\n// Format for Google Sheets\nreturn parsed.map((item, index) => ({\n json: {\n script_number: index + 1,\n hook: item.hook || \"\",\n problem: item.problem || \"\",\n solution: item.solution || \"\",\n how_to_implement: item.how_to_implement || \"\"\n }\n}));"},"typeVersion":2},{"id":"8cb29217-d423-457a-8ca8-113372eda9e3","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-2560,-96],"parameters":{"width":368,"height":1136,"content":"# Instagram Top Reels to Google Sheets Script Engine\n\n## HOW IT WORKS:\n\nThis workflow helps you study what is already working on Instagram and turn those patterns into new reel scripts.\n\nIt pulls posts from an Instagram profile through Apify, ranks them by video play count, filters for reels with audio, downloads the audio, and transcribes it with OpenAI.\n\nIt then sends the strongest transcript examples to Claude to generate 7 new short form scripts based on the winning patterns.\n\nFinally, it formats the scripts into an existing Google Sheets with clear sections for Hook, Problem, Solution, and How to Implement, so the output is easy to review and reuse.\n\n## HOW TO SET UP:\n\nAdd your Apify token, OpenAI API key, Anthropic API key, and Google Docs credential in the relevant nodes.\n\nReplace the example Instagram profile URL in the Apify node with the profile you want to analyze.\n\nCreate these columns in your Google Sheet before running the workflow:\n\nScript Number\nHook\nProblem\nSolution\nHow To Implement\nCreatedAt\nSource\n\nIn the Google Sheets node, choose the spreadsheet and worksheet where you want the output to go.\n\nRun the workflow, and it will append 7 newly generated scripts to your sheet each time."},"typeVersion":1},{"id":"8acddc4f-4d1f-424d-a7c0-6616a6925090","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-2112,-16],"parameters":{"color":7,"width":704,"height":352,"content":"## Input and retrieval"},"typeVersion":1},{"id":"3294007b-a75d-4a9b-bf1d-1dcf76f0ea1e","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[-1376,-16],"parameters":{"color":7,"width":688,"height":352,"content":"## Sort and filter input"},"typeVersion":1},{"id":"aeb6da95-458f-485e-9ff6-9e0ec2bf9c24","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[-656,-16],"parameters":{"color":7,"width":624,"height":352,"content":"## Transcribe best performing scripts"},"typeVersion":1},{"id":"d2392095-145e-4802-b75d-138449b2549a","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[0,-16],"parameters":{"color":7,"width":832,"height":352,"content":"## Generate new scripts and save them in Google Sheets"},"typeVersion":1}],"active":false,"pinData":{},"settings":{"binaryMode":"separate","availableInMCP":false,"executionOrder":"v1"},"versionId":"547821a1-2739-4dc1-b0c9-b121ffc55e3c","connections":{"Sort1":{"main":[[{"node":"Limit1","type":"main","index":0}]]},"Filter":{"main":[[{"node":"HTTP Request","type":"main","index":0}]]},"Limit1":{"main":[[{"node":"Filter","type":"main","index":0}]]},"HTTP Request":{"main":[[{"node":"Transcribe a recording","type":"main","index":0}]]},"Run an Actor1":{"main":[[{"node":"Get dataset items1","type":"main","index":0}]]},"Message a model1":{"main":[[{"node":"Format AI Output1","type":"main","index":0}]]},"Format AI Output1":{"main":[[{"node":"Append row in sheet1","type":"main","index":0}]]},"Get dataset items1":{"main":[[{"node":"Sort1","type":"main","index":0}]]},"Combine Transcripts":{"main":[[{"node":"Message a model1","type":"main","index":0}]]},"Transcribe a recording":{"main":[[{"node":"Combine Transcripts","type":"main","index":0}]]},"When clicking ‘Execute workflow’":{"main":[[{"node":"Run an Actor1","type":"main","index":0}]]}}}How to Import This Workflow
- 1Copy the workflow JSON above using the Copy Workflow JSON button.
- 2Open your n8n instance and go to Workflows.
- 3Click Import from JSON and paste the copied workflow.
Don't have an n8n instance? Start your free trial at n8nautomation.cloud
Related Templates
AI Agent for project management and meetings with Airtable and Fireflies
Ready-to-use n8n workflow template for productivity. This automation connects Airtable, Gmail, Google Calendar, OpenAI with 18 nodes. Import directly into your n8n instance and customize for your needs.
Handling Job Application Submissions with AI and n8n Forms
Ready-to-use n8n workflow template for productivity. This automation connects Airtable, OpenAI with 23 nodes. Import directly into your n8n instance and customize for your needs.
AI Agent to chat with Airtable and analyze data
Ready-to-use n8n workflow template for productivity. This automation connects Airtable, OpenAI with 41 nodes. Import directly into your n8n instance and customize for your needs.