← All projects
n8n

Post to Instagram and Facebook without touching your phone

Automatic publishing via Meta's official API, with all three token types covered — including the 30-day auto-refresh — so the automation never expires.

Stack
n8nMeta Graph APIInstagramFacebookOAuth

What it solves

Posting manually to social media, even when the content is ready, is a task that gets forgotten or postponed. This workflow automates posting to Instagram and Facebook through their official API (Graph API), and solves the less obvious but more annoying problem of this integration: access token expiration.

How it’s built

Meta’s API offers three ways to authenticate, and the workflow covers all three:

  1. Short-lived token — valid for only 1-2 hours, useful for quick testing but not viable for production.
  2. Long-lived token with auto-refresh — lasts around 60 days, but the workflow renews it on its own every 30 days and stores it internally, so it never expires unnoticed.
  3. Permanent system-user token — never expires. It requires verifying the business in Meta Business, but it’s the recommended option for an automation meant to run indefinitely.

Once authentication is sorted, posting is straightforward: the image and caption are uploaded to Instagram, the system waits a few seconds for Meta to process the content, and the publication is confirmed. For Facebook, the workflow first resolves the page-specific token — required because one account can manage several pages — and then publishes the photo with its caption.

Why it’s interesting

Most social-media automations built on Meta’s API die after two months because the token expired and nobody noticed. Here the workflow itself handles the refresh and stores the active token, so the automation keeps running indefinitely. The result is a post that fires on its own, without relying on remembering to pick up the phone — and, crucially, without the chronic problem that kills this kind of project.

The workflow, in the open

The full workflow is published on GitHub: you can download it, import it into your own n8n and see exactly how it’s built, node by node → instagram-facebook-poster.json