Turn top Instagram reels into 7 new scripts using Apify, OpenAI, Claude and Google Sheets
Generate seven new scripts from top Instagram reels using Apify, OpenAI, Claude, and Google Sheets. Apify scrapes top reels, OpenAI transcribes audio, Claude generates scripts, and Google Sheets stores the output. Content creators and marketers can quickly generate fresh content ideas and streamline their scriptwriting process. This workflow dramatically reduces the manual effort of content creation.
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
Auto-create TikTok videos with VEED.io AI avatars, ElevenLabs & GPT-4
Automate the creation and distribution of trending TikTok videos using AI avatars. This workflow connects Telegram, Perplexity, OpenAI, ElevenLabs, VEED.io, and BLOTATO to generate scripts, synthesize voice, create video, and publish across multiple social platforms. Content creators and marketers can rapidly produce engaging short-form video content without manual editing.
Personal life manager with Telegram, Google services & voice-enabled AI
Manage your personal life using voice or text commands through Telegram. This workflow connects Telegram, Google Calendar, Gmail, Google Tasks, and an AI assistant powered by OpenRouter to process requests. It's ideal for busy individuals who want to quickly schedule events, send emails, or manage tasks on the go. This automation streamlines daily organization, saving significant time and mental effort.
Summarize Google Sheets form feedback via OpenAI's GPT-4
Efficiently summarize Google Sheets form feedback using OpenAI's GPT-4. This productivity workflow connects Google Sheets to retrieve form submissions, aggregates the responses into arrays, and then leverages OpenAI's advanced GPT-4 model to generate concise summaries. The generated summaries, initially in Markdown, are then converted to HTML for easy readability before being sent directly to your inbox via Gmail. This automation is ideal for product managers, marketing teams, or customer support departments who regularly collect feedback through Google Forms and need a quick, intelligent overview of responses without manually sifting through every entry. It dramatically reduces the time and effort spent analyzing feedback, allowing for faster insights and more informed decision-making.