Guides

Guide · n8n automation · 7 min read

How to auto-post to Facebook and Instagram with n8n

At the end you will have a Telegram bot that turns "Spring AC tune-up, 20% off" into an approved image post on your Facebook Page and Instagram account. Setup takes about 30 to 45 minutes the first time.

The workflow: Generate and publish AI image posts to Facebook and Instagram from Telegram (n8n template).

By MD Faizan Uzzaman · Verified n8n Creator · Published 10 Oct 2026

Before you start

NeedDetail
Facebook PageYou must be an admin of the Page
Instagram accountMust be a Business or Creator account, linked to that Page
n8nCloud or self-hosted, with HTTPS (Telegram needs an HTTPS webhook)
Google accountFor Drive (image hosting) and Sheets (log)

Step 1: Switch Instagram to a professional account and link it to your Page

  1. Instagram app > Settings > Account type and tools > Switch to professional account (Business).
  2. Facebook Page > Settings > Linked accounts > Instagram > Connect.
  3. Check: the Page shows your Instagram account under linked accounts.

Step 2: Create a Meta app

  1. Go to developers.facebook.com > My Apps > Create app.
  2. Choose the use case for managing Pages and Instagram content (labels change often, pick the one that lists pages and instagram permissions).
  3. Add the Instagram product and the Facebook Login product if prompted.
  4. Keep the app in Development mode. You do not need app review to post to your own Page and your own Instagram account when you are an admin or tester of the app.

Step 3: Generate a Page access token

  1. Open the Graph API Explorer.
  2. Select your app. Request these permissions: pages_show_list, pages_read_engagement, pages_manage_posts, instagram_basic, instagram_content_publish, business_management.
  3. Generate a User token, then call me/accounts to get your Page access token.
  4. Exchange it for a long-lived token (Access Token Debugger > Extend). Page tokens made from a long-lived user token do not expire.
  5. Paste the Page token into the n8n Facebook Graph API credential.

Step 4: Find your two IDs

IDHow to get itGoes in
Facebook Page IDPage > About > Page transparency, or call me/accountsfb_page_id in Set Brand Context
Instagram Business account IDCall {page-id}?fields=instagram_business_accountig_user_id in Set Brand Context

Step 5: API keys for the AI steps

  1. Gemini: aistudio.google.com > Get API key. In n8n create a Header Auth credential, name x-goog-api-key, value your key.
  2. Cloudflare Workers AI: Cloudflare dashboard > Workers AI > create an API token. Create a Header Auth credential, name Authorization, value Bearer YOUR_TOKEN.
  3. Copy your Cloudflare account ID (dashboard sidebar) and paste it into the Generate Image URL, replacing YOUR_CLOUDFLARE_ACCOUNT_ID.

Step 6: Telegram, Drive and Sheets

  1. Telegram: message @BotFather, send /newbot, copy the token into the n8n Telegram credential.
  2. Google Drive and Google Sheets: connect OAuth in n8n.
  3. Create a sheet with a tab named Log and columns timestamp, prompt, image_url, status. Select it in the Log to Sheet node.

Step 7: Test

  1. Open the workflow and click Execute workflow on the Telegram Trigger, then message your bot.
  2. Approve the caption, then the image.
  3. Confirm the post on Facebook and Instagram and a new row in the Log tab.
  4. Activate the workflow.

Want this built around your business?

Your tone, your approval flow, your channels. Book a free 30 minute call.

Book a free 30 minute call

Troubleshooting

SymptomLikely causeFix
Instagram error about media typeImage is not JPEGKeep the Convert to JPEG node in place
Instagram cannot fetch imageDrive file not public or link is a preview linkKeep Make File Public and the direct-download URL node
(#10) permission errorMissing instagram_content_publish or wrong tokenRegenerate token with all permissions in Step 3
Container never reaches FINISHEDImage too large or wrong ratioKeep 1:1 and the 1440 px resize
Telegram trigger does not firen8n not on HTTPSUse an HTTPS domain or a tunnel
Token stopped workingShort-lived token usedExtend to long-lived and regenerate the Page token

Safety notes

  • Drive images are shared with "anyone with the link" so Meta can fetch them. Use a dedicated folder and delete old images.
  • Never paste tokens into a shared workflow or template.

About the author

I'm Faizan, a Verified n8n Creator. I build n8n automations and AI voice agents for small businesses. Meta renames menus often, so if a label in Steps 1 to 3 looks different, look for the closest match.