Optimize Instagram hashtags with GPT-4o & real engagement data via Graph API
Instagram Hashtag Generator Workflow
This workflow automatically generates optimal hashtags for your Instagram posts by analyzing captions and fetching real-time engagement data.
Key Features
- 100% Official API & Free: Uses ONLY the official Instagram Graph API. No expensive third-party tools or risky scraping methods are required.
- Safe & Reliable: Relying on the official API ensures compliance and long-term stability.
- Smart Caching: Includes a Google Sheets caching mechanism to maximize the value of the official API's rate limits (30 searches/7 days).
Workflow Overview
- Caption Input: Set your caption manually or via a workflow trigger.
- AI Suggestions: GPT-4o-mini analyzes the caption and suggests 10 relevant hashtags, balancing popular (big words) and niche keywords.
- Official API Search (Instagram Graph API):
- Fetches Hashtag IDs using the
ig_hashtag_searchendpoint. - Retrieves engagement metrics (Average Likes, Average Comments) using the ID.
- Fetches Hashtag IDs using the
- Selection & Sorting:
- Sorts candidates by engagement metrics.
- Selects the top 5 most effective hashtags that balance relevance and engagement.
- Output: Returns the final list of hashtags as text.
Setup Steps
-
Import to n8n:
- Copy the content of
workflow_hashtag_generator.jsonand paste it into your n8n canvas, or import the file directly.
- Copy the content of
-
Credentials:
- OpenAI account: Connect your OpenAI credentials.
- Facebook Graph account: Connect your Facebook Graph API credentials.
-
Configuration:
- Instagram Business ID: Update the
YOUR_INSTAGRAM_BUSINESS_ACCOUNT_IDplaceholder in the Get Hashtag Info and Get Hashtag Metrics nodes with your actual Business Account ID. - Google Spreadsheet ID: Update the
YOUR_SPREADSHEET_IDplaceholder in the Fetch Cached Hashtags and Save to Cache nodes.
- Instagram Business ID: Update the
-
Adjustments:
- Filter Logic: You can adjust the sorting or filtering logic in the
Aggregate & Rank Candidatesnode's JavaScript code (e.g., exclude tags with fewer than 1000 posts) if needed.
- Filter Logic: You can adjust the sorting or filtering logic in the
Important Notes on API Limits
The official Instagram Hashtag Search API (ig_hashtag_search) allows for 30 unique hashtag queries per rolling 7-day period.
- Why this is fine: This workflow caches results in Google Sheets. Once a tag is fetched, it doesn't need to be queried again for a while, allowing you to build up a large database of tags over time without hitting the limit.
- Recommendation: Use mock data during initial testing to save your API quota.
Optimize Instagram Hashtags with GPT-4o & Real Engagement Data
This n8n workflow automates the process of optimizing Instagram hashtags by leveraging real engagement data from the Facebook Graph API and generating new hashtag suggestions using GPT-4o. It helps content creators and marketers improve their Instagram reach and engagement by providing data-driven hashtag recommendations.
What it does
- Triggers Manually: The workflow is initiated manually.
- Fetches Instagram Posts: It retrieves a list of your recent Instagram posts using the Facebook Graph API.
- Filters Posts for Analysis: It filters these posts, typically focusing on those with specific criteria (e.g., recent posts, posts with certain engagement levels).
- Extracts Relevant Data: For each filtered post, it extracts engagement metrics (likes, comments, shares, saves) and the hashtags used.
- Calculates Engagement Score: A custom JavaScript code node calculates an "engagement score" for each post based on its metrics. This score helps quantify the performance of the used hashtags.
- Prepares Data for GPT-4o: The workflow structures the post data, including original hashtags and their engagement scores, into a format suitable for an LLM prompt.
- Generates Hashtag Suggestions with GPT-4o: It sends the prepared data to the OpenAI Chat Model (GPT-4o via a Basic LLM Chain) to generate new, optimized hashtag suggestions based on the performance of the existing ones.
- Merges Data: The original post data is merged with the newly generated hashtag suggestions.
- Updates Google Sheet (Optional/Placeholder): The workflow includes a Google Sheets node, which could be used to log the analyzed data, engagement scores, and new hashtag suggestions for further analysis or record-keeping.
- Loops for Batch Processing: The workflow is designed to process items in batches, allowing for efficient handling of multiple Instagram posts.
- Introduces a Delay: A
Waitnode is included, likely to prevent API rate limiting issues when interacting with external services.
Prerequisites/Requirements
- n8n Instance: A running n8n instance.
- Facebook Graph API Credentials: Access to the Facebook Graph API with permissions to read Instagram business account insights and posts. This requires a Facebook Developer account and an Instagram Business Account linked to a Facebook Page.
- OpenAI API Key: An API key for OpenAI (specifically for GPT-4o).
- Google Sheets Account (Optional): A Google account with access to Google Sheets if you intend to use the data logging functionality.
Setup/Usage
- Import the Workflow: Download the provided JSON and import it into your n8n instance.
- Configure Credentials:
- Facebook Graph API: Set up a new "Facebook Graph" credential. You will need to authenticate with your Facebook account and grant the necessary permissions for your Instagram Business Account.
- OpenAI Chat Model: Set up a new "OpenAI Chat Model" credential with your OpenAI API Key.
- Google Sheets (Optional): Set up a "Google Sheets" credential if you plan to use this node.
- Review Node Configurations:
- Facebook Graph API: Ensure the "Resource" and "Operation" are correctly set to fetch Instagram posts and their insights. You might need to specify the Instagram Business Account ID.
- Code Node: Review the JavaScript code to understand how the engagement score is calculated. Adjust the weights for likes, comments, shares, and saves if needed to reflect your engagement priorities.
- Basic LLM Chain (OpenAI Chat Model): Examine the prompt used to instruct GPT-4o. Customize it to guide the AI in generating the most relevant hashtag suggestions for your content and audience.
- Google Sheets (Optional): Configure the spreadsheet ID and sheet name where you want to log the data.
- Execute the Workflow: Click the "Execute Workflow" button in the n8n editor to run the workflow manually.
This workflow provides a powerful foundation for data-driven Instagram hashtag optimization, combining real performance metrics with advanced AI suggestions.
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
Track competitor SEO keywords with Decodo + GPT-4.1-mini + Google Sheets
This workflow automates competitor keyword research using OpenAI LLM and Decodo for intelligent web scraping. Who this is for SEO specialists, content strategists, and growth marketers who want to automate keyword research and competitive intelligence. Marketing analysts managing multiple clients or websites who need consistent SEO tracking without manual data pulls. Agencies or automation engineers using Google Sheets as an SEO data dashboard for keyword monitoring and reporting. What problem this workflow solves Tracking competitor keywords manually is slow and inconsistent. Most SEO tools provide limited API access or lack contextual keyword analysis. This workflow solves that by: Automatically scraping any competitor’s webpage with Decodo. Using OpenAI GPT-4.1-mini to interpret keyword intent, density, and semantic focus. Storing structured keyword insights directly in Google Sheets for ongoing tracking and trend analysis. What this workflow does Trigger — Manually start the workflow or schedule it to run periodically. Input Setup — Define the website URL and target country (e.g., https://dev.to, france). Data Scraping (Decodo) — Fetch competitor web content and metadata. Keyword Analysis (OpenAI GPT-4.1-mini) Extract primary and secondary keywords. Identify focus topics and semantic entities. Generate a keyword density summary and SEO strength score. Recommend optimization and internal linking opportunities. Data Structuring — Clean and convert GPT output into JSON format. Data Storage (Google Sheets) — Append structured keyword data to a Google Sheet for long-term tracking. Setup Prerequisites If you are new to Decode, please signup on this link visit.decodo.com n8n account with workflow editor access Decodo API credentials OpenAI API key Google Sheets account connected via OAuth2 Make sure to install the Decodo Community node. Create a Google Sheet Add columns for: primarykeywords, seostrengthscore, keyworddensity_summary, etc. Share with your n8n Google account. Connect Credentials Add credentials for: Decodo API credentials - You need to register, login and obtain the Basic Authentication Token via Decodo Dashboard OpenAI API (for GPT-4o-mini) Google Sheets OAuth2 Configure Input Fields Edit the “Set Input Fields” node to set your target site and region. Run the Workflow Click Execute Workflow in n8n. View structured results in your connected Google Sheet. How to customize this workflow Track Multiple Competitors → Use a Google Sheet or CSV list of URLs; loop through them using the Split In Batches node. Add Language Detection → Add a Gemini or GPT node before keyword analysis to detect content language and adjust prompts. Enhance the SEO Report → Expand the GPT prompt to include backlink insights, metadata optimization, or readability checks. Integrate Visualization → Connect your Google Sheet to Looker Studio for SEO performance dashboards. Schedule Auto-Runs → Use the Cron Node to run weekly or monthly for competitor keyword refreshes. Summary This workflow automates competitor keyword research using: Decodo for intelligent web scraping OpenAI GPT-4.1-mini for keyword and SEO analysis Google Sheets for live tracking and reporting It’s a complete AI-powered SEO intelligence pipeline ideal for teams that want actionable insights on keyword gaps, optimization opportunities, and content focus trends, without relying on expensive SEO SaaS tools.
Two-way property repair management system with Google Sheets & Drive
This workflow automates the repair request process between tenants and building managers, keeping all updates organized in a single spreadsheet. It is composed of two coordinated workflows, as two separate triggers are required — one for new repair submissions and another for repair updates. A Unique Unit ID that corresponds to individual units is attributed to each request, and timestamps are used to coordinate repair updates with specific requests. General use cases include: Property managers who manage multiple buildings or units. Building owners looking to centralize tenant repair communication. Automation builders who want to learn multi-trigger workflow design in n8n. --- ⚙️ How It Works Workflow 1 – New Repair Requests Behind the Scenes: A tenant fills out a Google Form (“Repair Request Form”), which automatically adds a new row to a linked Google Sheet. Steps: Trigger: Google Sheets rowAdded – runs when a new form entry appears. Extract & Format: Collects all relevant form data (address, unit, urgency, contacts). Generate Unit ID: Creates a standardized identifier (e.g., BUILDING-UNIT) for tracking. Email Notification: Sends the building manager a formatted email summarizing the repair details and including a link to a Repair Update Form (which activates Workflow 2). --- Workflow 2 – Repair Updates Behind the Scenes:\ Triggered when the building manager submits a follow-up form (“Repair Update Form”). Steps: Lookup by UUID: Uses the Unit ID from Workflow 1 to find the existing row in the Google Sheet. Conditional Logic: If photos are uploaded: Saves each image to a Google Drive folder, renames files consistently, and adds URLs to the sheet. If no photos: Skips the upload step and processes textual updates only. Merge & Update: Combines new data with existing repair info in the same spreadsheet row — enabling a full repair history in one place. --- 🧩 Requirements Google Account (for Forms, Sheets, and Drive) Gmail/email node connected for sending notifications n8n credentials configured for Google API access --- ⚡ Setup Instructions (see more detail in workflow) Import both workflows into n8n, then copy one into a second workflow. Change manual trigger in workflow 2 to a n8n Form node. Connect Google credentials to all nodes. Update spreadsheet and folder IDs in the corresponding nodes. Customize email text, sender name, and form links for your organization. Test each workflow with a sample repair request and a repair update submission. --- 🛠️ Customization Ideas Add Slack or Telegram notifications for urgent repairs. Auto-create folders per building or unit for photo uploads. Generate monthly repair summaries using Google Sheets triggers. Add an AI node to create summaries/extract relevant repair data from repair request that include long submissions.