Instagram visual analysis with Apify scraping, OpenAI GPT-5 & Google Sheets
Pull recent Instagram post media for any username, fetch the image binaries, and run automated visual analysis with OpenAI β all orchestrated inside n8n. This workflow uses a Google Sheet to supply target usernames, calls Apifyβs Instagram Profile Scraper to fetch recent posts, downloads the images, and passes them to an OpenAI vision-capable model for structured analysis. Results can then be logged, stored, or routed onward depending on your use case.
π§βπ» Whoβs it for
- Social media managers analyzing competitor or brand posts
- Marketing teams tracking visual trends and campaign content
- Researchers collecting structured insights from Instagram images
βοΈ How it works
- Google Sheets β Supplies Instagram usernames (one per row).
- Apify Scraper β Fetches latest posts (images and metadata).
- HTTP Request β Downloads each image binary.
- OpenAI Vision Model β Analyzes visuals and outputs structured summaries.
- Filter & Split Nodes β Ensure only the right rows and posts are processed.
π Setup Instructions
1) Connect Google Sheets (OAuth2)
- Go to n8n β Credentials β New β Google Sheets (OAuth2)
- Sign in with your Google account and grant access
- In the Get Google Sheet node, select your spreadsheet + worksheet (must contain a
Usercolumn with Instagram usernames)
2) Connect Apify (HTTP Query Auth)
- Get your Apify API token at Apify Console β Integrations/API
- In n8n β Credentials β New β HTTP Query Auth, add a query param
token=<YOUR_APIFY_TOKEN> - In the Scrape Details node, select that credential and use the provided URL:
3) Connect OpenAI (API Key)
- Create an API key at OpenAI Platform
- In n8n β Credentials β New β OpenAI API, paste your key
- In the OpenAI Chat Model node, select your credential and choose a vision-capable model (
gpt-4o-mini,gpt-4o, orgpt-5if available)
π οΈ How to customize
- Change the Google Sheet schema (e.g., add campaign tags or notes).
- Adjust the OpenAI system prompt to refine what details are extracted (e.g., brand logos, colors, objects).
- Route results to Slack, Notion, or Airtable instead of storing only in Sheets.
- Apply filters (hashtags, captions, or timeframe) directly in the Apify scraper config.
π Requirements
- n8n (Cloud or self-hosted)
- Google Sheets account
- Apify account + API token
- OpenAI API key with a funded account
π¬ Contact
Need help customizing this (e.g., filtering by campaign, sending reports by email, or formatting your PDF)?
- π§ rbreen@ynteractive.com
- π Robert Breen
- π ynteractive.com
n8n Workflow: Instagram Visual Analysis with Apify Scraping, OpenAI GPT, and Google Sheets
This n8n workflow automates the process of extracting visual content data from Instagram, analyzing it using OpenAI's GPT model, and then storing the results in a Google Sheet. It's designed to help users gain insights from Instagram posts by leveraging a combination of scraping, AI analysis, and data storage.
What it does
This workflow performs the following key steps:
- Manual Trigger: The workflow is initiated manually by the user, allowing for on-demand execution.
- HTTP Request (Apify Scraping): It sends an HTTP request, likely to an Apify Instagram scraper, to fetch data from Instagram. This step is responsible for obtaining the raw visual content information.
- Filter: The workflow includes a filter node, suggesting that it processes the scraped data and potentially filters items based on specific conditions before further analysis.
- Split Out: The filtered data is then split out, which is useful for processing individual items (e.g., individual Instagram posts) in subsequent steps.
- AI Agent (OpenAI GPT): Each item (Instagram post data) is passed to an AI Agent node, which uses an OpenAI Chat Model to perform visual analysis. This could involve generating descriptions, sentiment analysis, or extracting specific features from the visual content based on the scraped data.
- Google Sheets: Finally, the analyzed data from the AI Agent is written to a Google Sheet, providing a structured and accessible record of the Instagram visual analysis.
Prerequisites/Requirements
To use this workflow, you will need:
- n8n Instance: A running instance of n8n.
- Apify Account: An Apify account and potentially an Instagram Scraper actor configured for data extraction.
- OpenAI API Key: An OpenAI API key with access to their chat models (e.g., GPT-3.5, GPT-4).
- Google Account: A Google account with access to Google Sheets, and a specific spreadsheet prepared to receive the data.
Setup/Usage
- Import the workflow: Download the provided JSON and import it into your n8n instance.
- Configure Credentials:
- HTTP Request: Set up the HTTP Request node with your Apify API endpoint and any necessary authentication (e.g., API token, payload for the Instagram scraper).
- OpenAI Chat Model: Configure the OpenAI Chat Model node with your OpenAI API Key credential.
- Google Sheets: Set up the Google Sheets node with your Google account credential, specifying the Spreadsheet ID and Sheet Name where the analyzed data should be written.
- Customize Filter (Optional): Adjust the "Filter" node to match your specific criteria for processing Instagram posts.
- Customize AI Agent (Optional): Modify the prompt or parameters within the "AI Agent" node to refine the visual analysis performed by the OpenAI model.
- Execute the workflow: Click the "Execute workflow" button on the "Manual Trigger" node to run the workflow.
Related Templates
Auto-create TikTok videos with VEED.io AI avatars, ElevenLabs & GPT-4
π₯ Viral TikTok Video Machine: Auto-Create Videos with Your AI Avatar --- π― Who is this for? This workflow is for content creators, marketers, and agencies who want to use Veed.ioβs AI avatar technology to produce short, engaging TikTok videos automatically. Itβs ideal for creators who want to appear on camera without recording themselves, and for teams managing multiple brands who need to generate videos at scale. --- βοΈ What problem this workflow solves Manually creating videos for TikTok can take hours β finding trends, writing scripts, recording, and editing. By combining Veed.io, ElevenLabs, and GPT-4, this workflow transforms a simple Telegram input into a ready-to-post TikTok video featuring your AI avatar powered by Veed.io β speaking naturally with your cloned voice. --- π What this workflow does This automation links Veed.ioβs video-generation API with multiple AI tools: Analyzes TikTok trends via Perplexity AI Writes a 10-second viral script using GPT-4 Generates your voiceover via ElevenLabs Uses Veed.io (Fabric 1.0 via FAL.ai) to animate your avatar and sync the lips to the voice Creates an engaging caption + hashtags for TikTok virality Publishes the video automatically via Blotato TikTok API Logs all results to Google Sheets for tracking --- π§© Setup Telegram Bot Create your bot via @BotFather Configure it as the trigger for sending your photo and theme Connect Veed.io Create an account on Veed.io Get your FAL.ai API key (Veed Fabric 1.0 model) Use HTTPS image/audio URLs compatible with Veed Fabric Other APIs Add Perplexity, ElevenLabs, and Blotato TikTok keys Connect your Google Sheet for logging results --- π οΈ How to customize this workflow Change your Avatar: Upload a new image through Telegram, and Veed.io will generate a new talking version automatically. Modify the Script Style: Adjust the GPT prompt for tone (educational, funny, storytelling). Adjust Voice Tone: Tweak ElevenLabs stability and similarity settings. Expand Platforms: Add Instagram, YouTube Shorts, or X (Twitter) posting nodes. Track Performance: Customize your Google Sheet to measure your most successful Veed.io-based videos. --- π§ Expected Outcome In just a few seconds after sending your photo and theme, this workflow β powered by Veed.io β creates a fully automated TikTok video featuring your AI avatar with natural lip-sync and voice. The result is a continuous stream of viral short videos, made without cameras, editing, or effort. --- β Import the JSON file in n8n, add your API keys (including Veed.io via FAL.ai), and start generating viral TikTok videos starring your AI avatar today! π₯ Watch This Tutorial --- π Documentation: Notion Guide Need help customizing? Contact me for consulting and support : Linkedin / Youtube
Automate invoice processing with OCR, GPT-4 & Salesforce opportunity creation
PDF Invoice Extractor (AI) End-to-end pipeline: Watch Drive β Download PDF β OCR text β AI normalize to JSON β Upsert Buyer (Account) β Create Opportunity β Map Products β Create OLI via Composite API β Archive to OneDrive. --- Node by node (what it does & key setup) 1) Google Drive Trigger Purpose: Fire when a new file appears in a specific Google Drive folder. Key settings: Event: fileCreated Folder ID: google drive folder id Polling: everyMinute Creds: googleDriveOAuth2Api Output: Metadata { id, name, ... } for the new file. --- 2) Download File From Google Purpose: Get the file binary for processing and archiving. Key settings: Operation: download File ID: ={{ $json.id }} Creds: googleDriveOAuth2Api Output: Binary (default key: data) and original metadata. --- 3) Extract from File Purpose: Extract text from PDF (OCR as needed) for AI parsing. Key settings: Operation: pdf OCR: enable for scanned PDFs (in options) Output: JSON with OCR text at {{ $json.text }}. --- 4) Message a model (AI JSON Extractor) Purpose: Convert OCR text into strict normalized JSON array (invoice schema). Key settings: Node: @n8n/n8n-nodes-langchain.openAi Model: gpt-4.1 (or gpt-4.1-mini) Message role: system (the strict prompt; references {{ $json.text }}) jsonOutput: true Creds: openAiApi Output (per item): $.message.content β the parsed JSON (ensure itβs an array). --- 5) Create or update an account (Salesforce) Purpose: Upsert Buyer as Account using an external ID. Key settings: Resource: account Operation: upsert External Id Field: taxid_c External Id Value: ={{ $json.message.content.buyer.tax_id }} Name: ={{ $json.message.content.buyer.name }} Creds: salesforceOAuth2Api Output: Account record (captures Id) for downstream Opportunity. --- 6) Create an opportunity (Salesforce) Purpose: Create Opportunity linked to the Buyer (Account). Key settings: Resource: opportunity Name: ={{ $('Message a model').item.json.message.content.invoice.code }} Close Date: ={{ $('Message a model').item.json.message.content.invoice.issue_date }} Stage: Closed Won Amount: ={{ $('Message a model').item.json.message.content.summary.grand_total }} AccountId: ={{ $json.id }} (from Upsert Account output) Creds: salesforceOAuth2Api Output: Opportunity Id for OLI creation. --- 7) Build SOQL (Code / JS) Purpose: Collect unique product codes from AI JSON and build a SOQL query for PricebookEntry by Pricebook2Id. Key settings: pricebook2Id (hardcoded in script): e.g., 01sxxxxxxxxxxxxxxx Source lines: $('Message a model').first().json.message.content.products Output: { soql, codes } --- 8) Query PricebookEntries (Salesforce) Purpose: Fetch PricebookEntry.Id for each Product2.ProductCode. Key settings: Resource: search Query: ={{ $json.soql }} Creds: salesforceOAuth2Api Output: Items with Id, Product2.ProductCode (used for mapping). --- 9) Code in JavaScript (Build OLI payloads) Purpose: Join lines with PBE results and Opportunity Id β build OpportunityLineItem payloads. Inputs: OpportunityId: ={{ $('Create an opportunity').first().json.id }} Lines: ={{ $('Message a model').first().json.message.content.products }} PBE rows: from previous node items Output: { body: { allOrNone:false, records:[{ OpportunityLineItem... }] } } Notes: Converts discount_total β per-unit if needed (currently commented for standard pricing). Throws on missing PBE mapping or empty lines. --- 10) Create Opportunity Line Items (HTTP Request) Purpose: Bulk create OLIs via Salesforce Composite API. Key settings: Method: POST URL: https://<your-instance>.my.salesforce.com/services/data/v65.0/composite/sobjects Auth: salesforceOAuth2Api (predefined credential) Body (JSON): ={{ $json.body }} Output: Composite API results (per-record statuses). --- 11) Update File to One Drive Purpose: Archive the original PDF in OneDrive. Key settings: Operation: upload File Name: ={{ $json.name }} Parent Folder ID: onedrive folder id Binary Data: true (from the Download node) Creds: microsoftOneDriveOAuth2Api Output: Uploaded file metadata. --- Data flow (wiring) Google Drive Trigger β Download File From Google Download File From Google β Extract from File β Update File to One Drive Extract from File β Message a model Message a model β Create or update an account Create or update an account β Create an opportunity Create an opportunity β Build SOQL Build SOQL β Query PricebookEntries Query PricebookEntries β Code in JavaScript Code in JavaScript β Create Opportunity Line Items --- Quick setup checklist π Credentials: Connect Google Drive, OneDrive, Salesforce, OpenAI. π IDs: Drive Folder ID (watch) OneDrive Parent Folder ID (archive) Salesforce Pricebook2Id (in the JS SOQL builder) π§ AI Prompt: Use the strict system prompt; jsonOutput = true. π§Ύ Field mappings: Buyer tax id/name β Account upsert fields Invoice code/date/amount β Opportunity fields Product name must equal your Product2.ProductCode in SF. β Test: Drop a sample PDF β verify: AI returns array JSON only Account/Opportunity created OLI records created PDF archived to OneDrive --- Notes & best practices If PDFs are scans, enable OCR in Extract from File. If AI returns non-JSON, keep βReturn only a JSON arrayβ as the last line of the prompt and keep jsonOutput enabled. Consider adding validation on parsing.warnings to gate Salesforce writes. For discounts/taxes in OLI: Standard OLI fields donβt support per-line discount amounts directly; model them in UnitPrice or custom fields. Replace the Composite API URL with your orgβs domain or use the Salesforce nodeβs Bulk Upsert for simplicity.
AI-powered code review with linting, red-marked corrections in Google Sheets & Slack
Advanced Code Review Automation (AI + Lint + Slack) Whoβs it for For software engineers, QA teams, and tech leads who want to automate intelligent code reviews with both AI-driven suggestions and rule-based linting β all managed in Google Sheets with instant Slack summaries. How it works This workflow performs a two-layer review system: Lint Check: Runs a lightweight static analysis to find common issues (e.g., use of var, console.log, unbalanced braces). AI Review: Sends valid code to Gemini AI, which provides human-like review feedback with severity classification (Critical, Major, Minor) and visual highlights (red/orange tags). Formatter: Combines lint and AI results, calculating an overall score (0β10). Aggregator: Summarizes results for quick comparison. Google Sheets Writer: Appends results to your review log. Slack Notification: Posts a concise summary (e.g., number of issues and average score) to your teamβs channel. How to set up Connect Google Sheets and Slack credentials in n8n. Replace placeholders (<YOURSPREADSHEETID>, <YOURSHEETGIDORNAME>, <YOURSLACKCHANNEL_ID>). Adjust the AI review prompt or lint rules as needed. Activate the workflow β reviews will start automatically whenever new code is added to the sheet. Requirements Google Sheets and Slack integrations enabled A configured AI node (Gemini, OpenAI, or compatible) Proper permissions to write to your target Google Sheet How to customize Add more linting rules (naming conventions, spacing, forbidden APIs) Extend the AI prompt for project-specific guidelines Customize the Slack message formatting Export analytics to a dashboard (e.g., Notion or Data Studio) Why itβs valuable This workflow brings realistic, team-oriented AI-assisted code review to n8n β combining the speed of automated linting with the nuance of human-style feedback. It saves time, improves code quality, and keeps your teamβs review history transparent and centralized.