Skip to main content

Generate viral Instagram scripts by analyzing trending reels with Apify and GPT-4

Workflow preview

Workflow preview
100%
Generate viral Instagram scripts by analyzing trending reels with Apify and GPT-4 preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

This n8n template demonstrates how to leverage AI to analyze trending short form video content and automatically generate original, high engagement video scripts inspired by proven viral formats. U...

Best for

  • Content Creation automation workflows
  • Multimodal AI automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.formtrigger, n8n-nodes-base.httprequest, n8n-nodes-base.filter, n8n-nodes-base.googlesheets, n8n-nodes-base.splitinbatches, @n8n/n8n-nodes-langchain.agent, n8n-nodes-base.if, @n8n/n8n-nodes-langchain.lmchatopenai

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Nitin Dixit.

Original n8n.io source

1.1 Workflow description

Title
Generate viral Instagram scripts by analyzing trending reels with Apify and GPT-4
Workflow name
Generate viral Instagram scripts by analyzing trending reels with Apify and GPT-4

This n8n template demonstrates how to leverage AI to analyze trending short-form video content and automatically generate original, high-engagement video scripts inspired by proven viral formats.

Use cases are many: Create consistent content calendars for beauty salons and aestheticians, maintain a steady stream of reels without creative burnout, or study viral patterns to understand what drives engagement across Instagram's trending hashtags!

Good to know

  • The workflow scrapes real trending reels from Instagram based on your chosen hashtag, ensuring you're always learning from current viral patterns
  • Video transcription happens automatically, extracting the core messaging and pacing strategies from successful content
  • Generated scripts use proven engagement structures—hook, value delivery, and call-to-action timing—without copying original content
  • All data is organized in Google Sheets for easy review, editing, and tracking of script performance
  • The AI model intelligently mirrors the emotional tone and narrative structure while creating entirely new storylines

How it works

  • A form trigger collects your hashtag and desired number of reels to analyze
  • The Apify API scrapes trending Instagram reels matching your hashtag, filtering for high engagement (1000+ likes from the last 7 days)
  • Filtered reels are added to your Google Sheet with metadata: captions, engagement metrics, video links, and music information
  • Each reel is automatically transcribed using video-to-text technology, capturing the exact dialogue and timing
  • The AI Agent analyzes each transcript to understand its underlying structure—pacing, tone, curiosity hooks, and CTA placement
  • Using this analysis, Claude generates a completely original script that follows the same proven engagement formula but with a fresh topic or angle
  • Generated scripts are saved back to your Google Sheet alongside the source materials for comparison and refinement
  • A summary email is sent confirming the number of scripts created and ready for production

How to use

  • Start by entering a beauty or lifestyle hashtag (e.g., #aiautomation, #beautysalon, #haircare) and specify how many trending reels to analyze
  • Review the scraped content in your Google Sheet to understand what's currently resonating
  • Check the generated scripts and use them as jumping-off points for your own video production
  • Iterate on the process with different hashtags to discover emerging trends in your niche

Requirements

  • Apify account and API key for Instagram scraping (free tier available)
  • Google Sheets document set up to store reel data and generated scripts
  • OpenAI API key for the AI script generation
  • Gmail account for the completion notification (optional but recommended)

Customising this workflow

  • Adjust the engagement filter thresholds (currently 1000+ likes, 7 days old) to capture micro-trends or evergreen content
  • Modify the AI prompt in the "AI Agent" node to enforce specific brand voice, tone, or content guidelines
  • Add additional Google Sheet columns to track metrics like script-to-video conversion rates or audience response
  • Connect to additional distribution channels—automatically post scripts to team Slack, create video production briefs, or trigger video editing templates
  • Experiment with different video categories by creating multiple instances of this workflow for different hashtags or niches

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - On form submission

Type / Role
n8n-nodes-base.formTrigger - formTrigger
Config choices
Version 2.3

Block 2 - Scrape Hashtag

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 3 - Filter out from list

Type / Role
n8n-nodes-base.filter - filter
Config choices
Version 2.2

Block 4 - Add to the sheet

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.7

Block 5 - Transcribe Video

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 6 - Loop Over Items

Type / Role
n8n-nodes-base.splitInBatches - splitInBatches
Config choices
Version 3

Block 7 - AI Agent

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 2.2

Block 8 - If error

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 9 - OpenAI Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.2

Block 10 - Send a message

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 11 - Summarize

Type / Role
n8n-nodes-base.summarize - summarize
Config choices
Version 1.1

Block 12 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 13 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 14 - Add AI script

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.7

Block 15 - Update sheet

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.7

Block 16 - Sticky Note4

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 17 - Wait

Type / Role
n8n-nodes-base.wait - wait
Config choices
Version 1.1

Block 18 - Sticky Note5

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 19 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow Generate viral Instagram scripts by analyzing trending reels with Apify and GPT-4
Complexity advanced
Nodes 19
Categories Content Creation, Multimodal AI
Author Nitin Dixit
Published 30 Oct 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/10303/10303.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Generate viral Instagram scripts by analyzing trending reels with Apify and GPT-4 do?

This n8n template demonstrates how to leverage AI to analyze trending short form video content and automatically generate original, high engagement video scripts inspired by proven viral formats. U...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Content Creation, Multimodal AI use case.