π Analyze Instagram profiles with Apify, Google Gemini, and Supabase
β‘ 58 views Β· π Market Research & Insights
π‘ Pro Tip β Heads up β if this workflowβs Instagram scraping breaks (it happens whenever Meta updates their frontend), ScraperNode is a community node that handles profiles, posts, reels, and comments without any HTML parsing.
Description
Quick overview
This workflow receives an Instagram username via webhook, checks Supabase for a recent cached analysis, and if needed scrapes recent posts with Apify and generates niche, content, and engagement insights using Google Gemini before storing and returning the report.
How it works
- Receives a POST webhook request containing an Instagram username.
- Queries the Supabase
reportstable for matching records updated within the last 24 hours and returns the cachedanalysis_reportif found. - If no fresh cache exists, runs the Apify Instagram Scraper actor to fetch the latest 5 posts for the requested profile.
- Cleans and bundles the scraped post data into a compact JSON payload for analysis.
- Sends the payload to Google Gemini to generate three sub-reports: niche/frequency, content strategy, and engagement/actions.
- Combines the three Gemini outputs into a single
analysis_reportobject along with the scraped data. - Upserts the report into Supabase (update if the username exists, otherwise insert) and returns the fresh
analysis_reportin the webhook response.
Setup
- Create or select a Supabase project, add Supabase credentials in n8n, and ensure a
reportstable exists with at leastusername,analysis_report,scraped_data, andupdated_atcolumns. - Add an Apify API token in n8n and ensure the workflow can run the
apify/instagram-scraperactor with access to the target profiles. - Add Google Gemini (PaLM) API credentials in n8n for the Gemini model used in the three analysis steps.
- Copy the production webhook URL from the webhook trigger and configure your source app (e.g. Lovable) to POST a JSON body containing
usernameto/analyze-profile.
π Nodes Used
Webhook, Supabase, Google Gemini
π₯ Import
Download workflow.json and import into n8n:
Workflow menu β Import from File