Marketing & Social Media

Automate Facebook & Instagram Posting with n8n and AI

Posting every day on Facebook and Instagram takes time: finding an idea, creating a visual, writing the caption, choosing hashtags, then publishing on two platforms. After a few weeks, consistency almost always drops.

In this article, I'll show you the n8n workflow I built to fully automate this task: every day at a set time, it prepares a complete post with AI, publishes it on both networks, then sends a WhatsApp notification.

The workflow running in n8n.

The problem: a simple but time-consuming task

For a business, an agency or a creator, social media publishing repeats every day with the same steps:

  • finding a topic that fits the audience;
  • creating an image;
  • writing a caption and choosing relevant hashtags;
  • publishing on Facebook, then on Instagram;
  • checking that everything went live.

Each of these steps can be handed over to a workflow.

The solution at a glance

Schedule→Audience→Hashtags→AI image→AI caption→Facebook + Instagram→WhatsApp

The workflow step by step

1. A scheduled trigger

A Schedule Trigger node starts the workflow every day at the same time. That is what guarantees consistency.

2. Choosing the audience

A Code node selects the audience segment of the day (for example families, couples, business travelers). Rotating segments avoids repetitive posts.

3. Hashtag research

The workflow uses Apify to analyze Instagram hashtags related to the topic, then a Code node extracts the most relevant ones.

4. Generating the image

An image model from Cloudflare Workers AI creates an original visual from a description. The image is then decoded and uploaded to Cloudinary.

Why Cloudinary? Because the Instagram API requires a public URL for the image: it cannot receive a file directly.

5. Writing the post

A language model (through OpenRouter) writes the caption based on the audience and hashtags. The answer is requested in a structured format and parsed by a Code node, which avoids surprises at publishing time.

6. Publishing on Facebook

The workflow retrieves the page token, then publishes the image and text through Meta's Graph API.

7. Publishing on Instagram

On Instagram, publishing happens in three steps: creating a media "container", waiting for the image to be processed, then publishing. Finally, the workflow retrieves the link to the published post.

8. WhatsApp notification

A Merge node waits for both posts to be done, then a WhatsApp notification is sent with the result.

Tools used

  • n8n
  • Apify
  • Cloudflare Workers AI
  • Cloudinary
  • OpenRouter
  • Meta Graph API
  • WhatsApp

Things to watch out for

  • Professional Instagram account: the publishing API works with a Business or Creator account linked to a Facebook Page.
  • Access tokens: use long-lived tokens and plan for their renewal.
  • Meta limits: Instagram limits the number of API-published posts per 24 hours. One post a day stays well within those limits.
  • Quality control: depending on the brand, you can add a human approval step (for example a WhatsApp or email message with "approve / reject") before publishing.

What this workflow brings

  • Consistent posting, even on busy days.
  • Visuals and captions aligned with the target audience.
  • No more manual publishing: you simply receive the confirmation on WhatsApp.

This type of workflow suits local businesses, agencies managing several pages, and any company that wants to stay visible without spending time on it every day.