Back to Catalog

Automate Instagram & Facebook posting with Meta Graph API & System User Tokens

Brian Brian
6448 views
2/3/2026
Official Page

This template automates posting to Instagram Business and Facebook Pages using the Meta Graph API. It supports both short-lived and long-lived tokens, with a secure approach using System User tokens for reliable, ongoing automation. Includes detailed guidance for authentication, token refresh logic, and API use.

Features:

πŸ“Έ Publish to Instagram via /media + /media_publish

πŸ“˜ Post to Facebook Pages via /photos

πŸ” Long-lived token support via Meta Business System User

♻️ Token refresh support using staticData in n8n

🧠 In-line sticky note instructions

Use Cases:

Schedule and publish branded social media content

Automate marketing flows with CRM + social sync

Empower internal teams or clients to post without manual steps

Tags: Instagram, Facebook, Meta Graph API, Social Media, Token Refresh, Long-Lived Token, Marketing Automation, System User

Automate Instagram & Facebook Posting with Meta Graph API (System User Tokens)

This n8n workflow demonstrates a foundational structure for scheduling and executing posts to Instagram and Facebook using the Meta Graph API. It leverages system user tokens for secure and programmatic access, making it ideal for automating social media content delivery.

What it does

This workflow provides a template for:

  1. Triggering Post Creation: It can be manually initiated or scheduled to run at specific intervals.
  2. Preparing API Requests: It includes an HTTP Request node, pre-configured with helpful resources for understanding API interactions.
  3. Executing Custom Logic: A Code node is included for implementing custom JavaScript logic, such as dynamically generating post content, handling image/video URLs, or parsing responses.
  4. Introducing Delays: A Wait node allows for pausing the workflow, which can be useful for respecting API rate limits or staggering posts.
  5. Documenting Steps: Sticky Notes are used to provide inline documentation and explanations within the workflow.

Prerequisites/Requirements

  • Meta Developer Account: Access to the Meta for Developers platform to create an app and obtain necessary credentials.
  • Facebook Page & Instagram Business Account: Linked accounts to post content.
  • Meta Graph API System User Token: A long-lived access token for a system user associated with your Meta app, providing permissions to manage your Facebook Page and Instagram Business Account. This token would be used within the HTTP Request node for authentication.
  • n8n Instance: A running instance of n8n to import and execute the workflow.

Setup/Usage

  1. Import the Workflow: Download the provided JSON and import it into your n8n instance.
  2. Configure Trigger:
    • Manual Trigger: Use the "When clicking 'Execute workflow'" node for immediate testing.
    • Schedule Trigger: Configure the "Schedule Trigger" node to run at your desired frequency (e.g., daily, hourly).
  3. Configure HTTP Request Node:
    • This is where you will make your calls to the Meta Graph API.
    • You will need to set the URL to the appropriate Meta Graph API endpoint (e.g., https://graph.facebook.com/v18.0/{instagram-business-account-id}/media).
    • Set the Method (e.g., POST).
    • Add Headers for authentication, including your System User Token (e.g., Authorization: Bearer YOUR_SYSTEM_USER_TOKEN).
    • In the Body, define your post content (e.g., caption, image_url, media_type).
    • Refer to the Meta Graph API documentation for specific endpoints and parameters for creating Instagram and Facebook posts.
  4. Customize Code Node:
    • Utilize the "Code" node to implement any dynamic logic required for your posts. This could include:
      • Fetching content from a database or external API.
      • Generating captions or hashtags.
      • Processing image/video URLs.
      • Constructing the API request body dynamically.
      • Handling API responses.
  5. Adjust Wait Node:
    • If you're posting multiple items or need to space out your requests, configure the "Wait" node to introduce a delay.
  6. Activate the Workflow: Once configured, activate the workflow to start automating your social media posts.

Note: This workflow provides a foundational structure. You will need to populate the HTTP Request node with your specific Meta Graph API calls and integrate your system user token for authentication. The Code node offers flexibility for advanced logic and data manipulation.

Related Templates

Automate Reddit brand monitoring & responses with GPT-4o-mini, Sheets & Slack

How it Works This workflow automates intelligent Reddit marketing by monitoring brand mentions, analyzing sentiment with AI, and engaging authentically with communities. Every 24 hours, the system searches Reddit for posts containing your configured brand keywords across all subreddits, finding up to 50 of the newest mentions to analyze. Each discovered post is sent to OpenAI's GPT-4o-mini model for comprehensive analysis. The AI evaluates sentiment (positive/neutral/negative), assigns an engagement score (0-100), determines relevance to your brand, and generates contextual, helpful responses that add genuine value to the conversation. It also classifies the response type (educational/supportive/promotional) and provides reasoning for whether engagement is appropriate. The workflow intelligently filters posts using a multi-criteria system: only posts that are relevant to your brand, score above 60 in engagement quality, and warrant a response type other than "pass" proceed to engagement. This prevents spam and ensures every interaction is meaningful. Selected posts are processed one at a time through a loop to respect Reddit's rate limits. For each worthy post, the AI-generated comment is posted, and complete interaction data is logged to Google Sheets including timestamp, post details, sentiment, engagement scores, and success status. This creates a permanent audit trail and analytics database. At the end of each run, the workflow aggregates all data into a comprehensive daily summary report with total posts analyzed, comments posted, engagement rate, sentiment breakdown, and the top 5 engagement opportunities ranked by score. This report is automatically sent to Slack with formatted metrics, giving your team instant visibility into your Reddit marketing performance. --- Who is this for? Brand managers and marketing teams needing automated social listening and engagement on Reddit Community managers responsible for authentic brand presence across multiple subreddits Startup founders and growth marketers who want to scale Reddit marketing without hiring a team PR and reputation teams monitoring brand sentiment and responding to discussions in real-time Product marketers seeking organic engagement opportunities in product-related communities Any business that wants to build authentic Reddit presence while avoiding spammy marketing tactics --- Setup Steps Setup time: Approx. 30-40 minutes (credential configuration, keyword setup, Google Sheets creation, Slack integration) Requirements: Reddit account with OAuth2 application credentials (create at reddit.com/prefs/apps) OpenAI API key with GPT-4o-mini access Google account with a new Google Sheet for tracking interactions Slack workspace with posting permissions to a marketing/monitoring channel Brand keywords and subreddit strategy prepared Create Reddit OAuth Application: Visit reddit.com/prefs/apps, create a "script" type app, and obtain your client ID and secret Configure Reddit Credentials in n8n: Add Reddit OAuth2 credentials with your app credentials and authorize access Set up OpenAI API: Obtain API key from platform.openai.com and configure in n8n OpenAI credentials Create Google Sheet: Set up a new sheet with columns: timestamp, postId, postTitle, subreddit, postUrl, sentiment, engagementScore, responseType, commentPosted, reasoning Configure these nodes: Brand Keywords Config: Edit the JavaScript code to include your brand name, product names, and relevant industry keywords Search Brand Mentions: Adjust the limit (default 50) and sort preference based on your needs AI Post Analysis: Customize the prompt to match your brand voice and engagement guidelines Filter Engagement-Worthy: Adjust the engagementScore threshold (default 60) based on your quality standards Loop Through Posts: Configure max iterations and batch size for rate limit compliance Log to Google Sheets: Replace YOURSHEETID with your actual Google Sheets document ID Send Slack Report: Replace YOURCHANNELID with your Slack channel ID Test the workflow: Run manually first to verify all connections work and adjust AI prompts Activate for daily runs: Once tested, activate the Schedule Trigger to run automatically every 24 hours --- Node Descriptions (10 words each) Daily Marketing Check - Schedule trigger runs workflow every 24 hours automatically daily Brand Keywords Config - JavaScript code node defining brand keywords to monitor Reddit Search Brand Mentions - Reddit node searches all subreddits for brand keyword mentions AI Post Analysis - OpenAI analyzes sentiment, relevance, generates contextual helpful comment responses Filter Engagement-Worthy - Conditional node filters only high-quality relevant posts worth engaging Loop Through Posts - Split in batches processes each post individually respecting limits Post Helpful Comment - Reddit node posts AI-generated comment to worthy Reddit discussions Log to Google Sheets - Appends all interaction data to spreadsheet for permanent tracking Generate Daily Summary - JavaScript aggregates metrics, sentiment breakdown, generates comprehensive daily report Send Slack Report - Posts formatted daily summary with metrics to team Slack channel

Daniel ShashkoBy Daniel Shashko
679

Generate Funny AI Videos with Sora 2 and Auto-Publish to TikTok

This automation creates a fully integrated pipeline to generate AI-powered videos, store them, and publish them on TikTok β€” all automatically. It connects OpenAI Sora 2, and Postiz (for TikTok publishing) to streamline content creation. --- Key Benefits βœ… Full Automation – From text prompt to TikTok upload, everything happens automatically with no manual intervention once set up. βœ… Centralized Control – Google Sheets acts as a simple dashboard to manage prompts, durations, and generated results. βœ… AI-Powered Creativity – Uses OpenAI Sora 2 for realistic video generation and GPT-5 for optimized titles. βœ… Social Media Integration – Seamlessly posts videos to TikTok via Postiz, ready for your audience. βœ… Scalable & Customizable – Can easily be extended to other platforms like YouTube, Instagram, or LinkedIn. βœ… Time-Saving – Eliminates repetitive steps like manual video uploads or caption writing. --- How it works This workflow automates the end-to-end process of generating AI videos and publishing them to TikTok. It is triggered either manually or on a recurring schedule. Trigger & Data Fetch: The workflow starts by checking a specified Form for new entries. It looks for rows where a video has been requested (a "PROMPT" is filled) but not yet generated (the "VIDEO" column is empty). AI Video Generation: For each new prompt found, the workflow sends a request to the Fal.ai Sora 2 model to generate a video. It then enters a polling loop, repeatedly checking the status of the generation request every 60 seconds until the video is "COMPLETED". Post-Processing & Upload: Once the video is ready, the workflow performs several actions in parallel: Fetch Video & Store: It retrieves the final video URL, downloads the video file Generate Title: It uses the OpenAI GPT-4o-mini model to analyze the original prompt and generate an optimized, engaging title for the video. Publish to TikTok: The video file is uploaded to Postiz, a social media scheduling tool, which then automatically publishes it to a connected TikTok channel, using the AI-generated title as the post's caption. --- Set up steps To make this workflow functional, you need to complete the following configuration steps: Prepare the Google Sheet: Create a Form with at least "PROMPT", "DURATION", and "VIDEO" fields. Configure Fal.ai for Video Generation: Create an account at Fal.ai and obtain your API key. In both the "Create Video" and "Get status" HTTP Request nodes, set up the "Header Auth" credential. Set the Name to Authorization and the Value to Key YOURAPIKEY. Set up TikTok Publishing via Postiz: Create an account on Postiz and connect your TikTok account to get a Channel ID. Obtain your Postiz API key. In the "Upload Video to Postiz" and "TikTok" (Postiz) nodes, configure the API credentials. In the "TikTok" node, replace the placeholder "XXX" in the integrationId field with your actual TikTok Channel ID from Postiz. (Optional) Configure AI Title Generation: The "Generate title" node uses OpenAI. Ensure you have valid OpenAI API credentials configured in n8n for this node to work. --- Need help customizing? Contact me for consulting and support or add me on Linkedin. Header 2

DavideBy Davide
24772

Automate financial transaction tracking with Gmail, GPT, Notion & Telegram alerts

πŸ“© Automatically Log Transactions from Gmail into Notion and Get Telegram Alerts Who’s it for This workflow is for individuals or entrepreneurs who receive bank alerts, invoices, and payment emails in Gmail and want them to be automatically organized in Notion β€” while also receiving quick Telegram notifications for each transaction. If you manage personal or business finances and find it tedious to manually record every debit, credit, or invoice β€” this automation does it all for you. --- How it works The workflow acts as an AI-powered Accountant Agent that reads incoming Gmail messages and decides whether each email represents a Debit Transaction, Credit Transaction, Debit Invoice, or Credit Invoice. The Gmail Trigger watches your selected inboxes (like forwarding@bayesian-labs.com, support@bayesian-labs, anoop.karnik@bayesian-labs). The Classifier (GPT-5-nano) determines the correct transaction type. The appropriate Agent (GPT-5) then extracts amount, currency, and description details. The Agent uses Notion API tools to log structured data into your Personal Finance System Notion template (Financial Transactions & Income databases). Finally, a Telegram notification is sent summarizing the entry (From, To, Subject, Snippet). In short: every time your bank emails you β€” Notion gets updated, and you get notified. --- How to set up Duplicate the Personal Finance System Notion template into your workspace. Create a Telegram Bot with BotFather β†’ copy the bot token and your chat ID. Generate an OpenRouter API key for GPT-5 / GPT-5-nano. Create a Notion Integration Token and connect it to your duplicated finance databases. Add your Gmail accounts (forwarding@, support@, and/or personal Gmail) under Gmail OAuth2 credentials in n8n. Import the workflow JSON into n8n β†’ fill in the credential names as listed below: n8ncloudregular_usage β†’ OpenRouter Notion account β†’ Notion API Accountant AI β†’ Telegram Bot Gmail OAuth2 for each inbox trigger Once active, n8n polls Gmail every minute, classifies emails, updates Notion, and sends Telegram updates. --- Requirements n8n instance (self-hosted or cloud) Gmail accounts connected via OAuth2 OpenRouter API key Telegram bot token & chat ID Notion integration token Your duplicated Personal Finance System Notion template --- How to customize the workflow You can extend this workflow to: Track credit card statements, subscriptions, or payroll notifications. Add Slack or WhatsApp alerts alongside Telegram. Include live FX rates for USDβ†’INR conversion using an API node. Connect Google Sheets as a backup ledger or export target. Add error-handling branches to mark Gmail messages as processed or label them β€œLogged to Notion”.

AnoopBy Anoop
92