Create Facebook posts and images with Google Gemini and Facebook Graph API

Go to Workflow
1 views
Built by Nguyễn Thiệu Toàn (Jay Nguyen) Nguyễn Thiệu Toàn (Jay Nguyen)
Created on June 05, 2026

Description



This n8n template automates the creation of professional Facebook posts and visually striking illustrations directly from simple raw text. If you want to maintain a consistent social media presence without spending hours writing copy and designing images, this workflow is perfect for you.

How it works

Trigger & Configuration:* The workflow begins with your raw text and brand guidelines, configured entirely within a single *Set Context** node.
AI Copywriting:* A *Google Gemini** Agent analyzes the input and crafts an engaging Facebook caption—complete with hooks, emojis, and hashtags—alongside a highly detailed image generation prompt.
Image Processing:** The workflow intelligently branches. If you provide an original image, Gemini edits and enhances it for social media. If no image is provided, Gemini generates a brand-new illustration from scratch.
Facebook Publishing:* The final text and image are automatically published to your *Facebook Fanpage** via the Graph API.

How to use

Connect your Google Gemini API key in the AI Agent and Language Model nodes.
Connect your Facebook Graph API credentials in the Post to Facebook node.
Edit the Set Context node to update the raw_content, fanpage_name, content_style, and your specific page_id.
Run the workflow to automatically generate and publish your content.

Requirements

n8n Version:* Built and tested on *n8n 2.9.4+*. *(Note: It is highly recommended to update to the latest n8n version to use this workflow effectively).
Google Gemini** API key (googlePalmApi credential).
Facebook Page Access Token** with pages_manage_posts permissions.

Customizing this workflow

Automate the input:* Swap the Manual Trigger for a *Webhook, **Google Sheets, or Telegram node to generate posts on the fly from external apps.
Expand to other platforms:* Replace the Facebook node with a *LinkedIn* or *X (Twitter)** node to distribute your AI-generated content across multiple channels.

About the Author

Created by: Nguyễn Thiệu Toàn (Jay Nguyen)
Email: [email protected]
Website: nguyenthieutoan.com
Company: GenStaff (genstaff.net) - AI Staff. Always On. Always Yours.
Socials (Facebook / X / LinkedIn): @nguyenthieutoan
More templates: n8n.io/creators/nguyenthieutoan

Nodes Used (6)

AI Agent
@n8n/n8n-nodes-langchain.agent
Facebook Graph API
n8n-nodes-base.facebookGraphApi
Google Gemini
@n8n/n8n-nodes-langchain.googleGemini
Google Gemini Chat Model
@n8n/n8n-nodes-langchain.lmChatGoogleGemini
HTTP Request
n8n-nodes-base.httpRequest
Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured