Auto-Post to a Facebook Page with n8n: The Full Workflow (AI + Google Sheets)

Build an n8n workflow that auto-posts to your Facebook Page every day: topic from Google Sheets, post written by AI, image from Google Drive. Every node explained.

This n8n workflow runs every morning at 5:00. It takes a topic from a Google Sheet, has AI write a Facebook post about it, downloads the image from Google Drive and posts both to your Facebook Page. Finally it marks the row as “posted” in the Sheet, so the same post never goes out twice.

In short

  • Schedule Trigger runs the workflow every day at 5:00.
  • Google Sheets gives the first row whose status is empty (topic + image link).
  • An AI Agent (DeepSeek + Structured Output Parser) writes the post; Google Drive downloads the image.
  • An HTTP Request to /PAGE_ID/photos publishes it, then the row is marked posted.

Before you start: posting to a Page needs a Page token, saved in n8n as a credential named FB Page. The step-by-step guide is here: How to create a never-expiring Facebook Page token with a system user.

What you need

  • n8n (self-hosted or n8n Cloud)
  • A Google account, with Google Sheets and Google Drive credentials in n8n
  • An API key for an AI chat model (we used DeepSeek; OpenAI or Gemini work too)
  • The FB Page credential made from your Page token (guide)

Step 1: Set up the Google Sheet

Create a Google Sheet called Facebook Posts with four columns in the first row:

  • id: a unique number for each post (1, 2, 3…)
  • topic: what the post is about, in one line. The AI writes the full post from this.
  • image: the Google Drive link to the post’s image
  • status: leave it empty. The workflow writes posted once the post is published.
The Google Sheet: id, topic, image, status. An empty status means not posted yet.
The Google Sheet: id, topic, image, status. An empty status means not posted yet.

The images must be in the Drive of the same Google account that n8n’s Google Drive credential uses.

Step 2: Schedule Trigger

  1. New workflow → Add first step → On a schedule.
  2. Trigger Interval: Days, Days Between Triggers: 1, Trigger at Hour: 5am.
  3. Set the workflow’s Settings → Timezone to yours (e.g. Asia/Dhaka), otherwise it runs on the server’s time.

Step 3: Get row(s) in sheet

Next node: Google Sheets → Get row(s) in sheet.

  1. Credential: your Google Sheets account
  2. Document: Facebook Posts, Sheet: Sheet1
  3. Filters → Add Filter: Column status, leave Value empty. Only rows that haven’t been posted yet come through.
  4. Options → Return only First Matching Row: on. One post per run.

Step 4: AI Agent (DeepSeek + Structured Output Parser)

Add an AI Agent node:

  1. Source for Prompt: Define below, Prompt (User Message): {{ $json.topic }}
  2. Require Specific Output Format: on
  3. Options → System Message: tell the AI what to write. We used write a facebook post based on this topic. For better results, set the language and style, e.g. Write an engaging Facebook post in English about this topic. Short paragraphs, a few emojis, 3–5 hashtags. Return only the post text.

Attach two sub-nodes under the AI Agent:

  • Chat Model → DeepSeek Chat Model: create a credential with your DeepSeek API key and pick a model.
  • Output Parser → Structured Output Parser: Schema Type Generate From JSON Example, JSON Example: { "topic": "" }

The AI’s post text then always arrives in $json.output.topic, which the later nodes read.

Step 5: Download file (Google Drive)

  1. Add a Google Drive → Download file node.
  2. File: By URL, value: {{ $('Get row(s) in sheet').item.json.image }}

The image arrives as binary data in a field called data, which the next node sends to Facebook.

Step 6: HTTP Request — post to the Facebook Page

  1. Method: POST
  2. URL: https://graph.facebook.com/v23.0/<PAGE_ID>/photos (replace <PAGE_ID> with your Page ID from step 3 of the token guide)
  3. Authentication: Generic Credential Type → Query Auth → FB Page
  4. Send Body: on, Body Content Type: Form-Data
    • source: Type n8n Binary File, Input Data Field Name data
    • message: Type Form Data, Value {{ $('AI Agent').item.json.output.topic }}

On success the output contains id and post_id, and the post is live on your Page.

If the source Type is left as “Form Data” you’ll get (#324) Requires upload file. It must be n8n Binary File.

Wrong setup: source set to Form Data gives error #324. Change it to n8n Binary File.
Wrong setup: source set to Form Data gives error #324. Change it to n8n Binary File.

Step 7: Update row in sheet

Last node: Google Sheets → Update row in sheet, so this topic is never posted again.

  1. Same Document and Sheet as before
  2. Mapping Column Mode: Map Each Column Manually
  3. Column to match on: id
  4. id: {{ $('Get row(s) in sheet').item.json.id }}, status: posted

Step 8: Test and publish

  1. Click Execute workflow. The first row with an empty status is posted to the Page and its status becomes posted.
  2. If everything looks right, click Publish (or Active) at the top right. It now runs on its own every morning at 5:00.
  3. To queue more posts, just add rows to the Sheet. With no empty-status rows left, the workflow stops without posting.

Common problems

  • (#324) Requires upload file: set the source Type to n8n Binary File.
  • (#190) or (#200) token/permission errors: the Page token is wrong or missing permissions. Re-check the token guide, especially pages_manage_posts.
  • The same post goes out again: check that step 7 runs and matches on the id column.
  • The image doesn’t download: make sure the file opens with the Google account behind n8n’s Drive credential.

Frequently asked questions

Can I use OpenAI or Gemini instead of DeepSeek?

Yes. Replace the Chat Model sub-node under the AI Agent with OpenAI, Gemini or any other chat model and keep the Structured Output Parser as it is.

How do I post more than once a day?

Add more trigger times in the Schedule Trigger (or use an hourly interval). Each run posts one row from the Sheet.

Can I post text without an image?

Yes. Remove the Download file node and send the HTTP Request to /PAGE_ID/feed with only a message field instead of /photos.

Why does n8n show “(#324) Requires upload file”?

The source field is set to Form Data. Change its Type to n8n Binary File with Input Data Field Name data.

Is n8n free?

The self-hosted Community Edition is free; n8n Cloud is a paid hosted plan. This workflow works on both.

Need a Website or System for Your Business?

Tell us what you need — we'll build, host and support it for you.

Book Free Consultation