Automated Social Media Publishing with n8n and AI Agents

This workflow automates tailored social media content creation and publishing across multiple platforms using n8n’s Langchain AI nodes and integration with Google Docs, image generation, and platform APIs. It streamlines content creation, approval, and multi-channel distribution to save time and ensure consistency.
chatTrigger
agent
googleDrive
+16
Workflow Identifier: 1001
NODES in Use: chatTrigger, stickyNote, toolWorkflow, code, googleDocs, agent, httpRequest, googleDrive, gmail, facebookGraphApi, twitter, linkedIn, telegram, switch, set, extractFromFile, if, merge, noOp

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

Visit through Desktop for Best experience

What This Workflow Does

This workflow takes a simple message and makes a ready social media post for many platforms.

It solves the problem of making unique posts and images for each platform by itself.

The result is posts with matching images that are sent for review and then posted automatically.


Who Should Use This Workflow

This is for people working with content on Twitter (X), Instagram, Facebook, LinkedIn, Threads, and YouTube Shorts.

Users want to save time and keep messages and images clear and on-brand for each platform.

Teams needing approval steps and archives find it useful too.


Tools and Services Used

  • Langchain AI Agents: Generate social media text posts using OpenAI models.
  • Google Docs: Store system prompts and post schema as documents externally.
  • Pollinations.ai API: Generate matching post images from text prompts.
  • Google Drive: Save generated images and archives.
  • imgbb.com: Backup image hosting.
  • Social Media Platform APIs: Publish posts directly to Twitter, Instagram, Facebook, LinkedIn.
  • Gmail with OAuth2: Manage email-based approval workflows.
  • Telegram Bot API (optional): Notify team on workflow progress or errors.

Workflow Inputs, , and Outputs

Input

A user sends a short prompt message through a chat message trigger node in n8n.

Steps

  1. Fetch system prompt and social media JSON schema from Google Docs nodes.
  2. Parse the prompt and schema XML content into clear JSON objects using code nodes.
  3. Merge prompts and schema to build a structured input for AI generation nodes.
  4. Generate platform-specific content using Langchain AI nodes powered by OpenAI.
  5. Request a matching image from Pollinations.ai based on the AI-suggested concept.
  6. Save the image to Google Drive and imgbb.com for storage and backup.
  7. Combine post content and image data for final payload.
  8. Route the payload to respective social platform publishing nodes.
  9. Send an approval email via Gmail node to get user confirmation before posting.
  10. Check approval response and continue if allowed.
  11. Archive the final posts and images again in Google Drive.
  12. Optionally send notifications to Telegram channel.

Output

The published social media posts appear on each platform with matching images and are stored in cloud storage archives.

Teams get notified of status and any errors through email or Telegram.


Beginner Step-by-Step: How to Use This Workflow in n8n

1. Importing the Workflow

  1. Download the workflow file by clicking the Download button on this page.
  2. Inside the n8n editor, click the menu and choose Import from File.
  3. Select the downloaded workflow JSON file to load it.

2. Configuring Credentials and IDs

  1. Add or update API Keys and OAuth credentials for OpenAI, Pollinations.ai, Google Drive, Gmail, and social media platforms.
  2. Set the Google Docs document IDs for Social Media System Prompt and Social Media Schema nodes.
  3. Update email addresses in the approval process if needed.
  4. Check folders and channels in Google Drive and Telegram nodes.

3. Testing the Workflow

  1. Send a test message to the chat message trigger to start the workflow.
  2. Check logs and outputs in n8n to ensure AI content and images generate correctly.
  3. Verify that the approval email is received and that responding approves or rejects the posting.
  4. Check social media accounts for the published post.

4. Activating for Production

  1. Turn the workflow status to active in n8n.
  2. Ensure all credentials are valid and refreshing properly.
  3. Start using chat messages to produce posts automatically as needed.

Remember to consult self-host n8n if running a private workflow server.


Troubleshooting Common Issues

  • Trigger Not Starting: Check the webhook ID and link in the chat message trigger node.
  • Parsing Errors in Schema: Verify that Google Docs content is valid JSON; use JSON lint tools.
  • Image Generation Fails: Make sure Pollinations.ai API Key is correct and endpoint is stable.
  • Posts Not Publishing: Review OAuth permissions and renew tokens for social APIs.

Customization Ideas

  • Add more social platforms by copying router and publishing nodes and updating schema documents.
  • Change the image AI service by editing the HTTP Request node’s URL and parameters.
  • Adjust approval process timings or add multiple approvers in the Gmail approval node.
  • Edit external Google Docs prompts to change brand voice or update content style rules.
  • Update hashtags or trending topics in the social media schema document.

Summary of Results

✓ Saves many hours writing and scheduling posts for multiple platforms.

✓ Ensures each post matches platform rules and style for best impact.

✓ Uses AI to create both text and images that fit together.

✓ Adds an email approval step to avoid posting mistakes.

✓ Keeps archives in Google Drive for record and reuse.

→ Automates social media posting from a single prompt, making teamwork easier and faster.


Frequently Asked Questions

The Social Media Content Creator uses Langchain agents with OpenAI models. It takes merged prompts and schemas to generate JSON posts fitting the platform’s style and format.
Check the external Google Docs for valid JSON content. Use JSON lint tools to fix format issues before retrying the workflow.
Open each node needing credentials like OpenAI, Pollinations.ai, or Google API, and enter new API Key values or OAuth credentials. Save changes before running workflow again.
Yes. The workflow supports expandability. Users can add nodes and update prompt schemas to add platforms like TikTok or Pinterest.

Promoted by BULDRR AI

Related Workflows

Automate Viral UGC Video Creation Using n8n + Degaus (Beginner-Friendly Guide)

Learn how to automate viral UGC video creation using n8n, AI prompts, and Degaus. This beginner-friendly guide shows how to import, configure, and run the workflow without technical complexity.
Form Trigger
Google Sheets
Gmail
+37
Free

AI SEO Blog Writer Automation Workflows in n8n

A complete beginner guide to building an AI SEO blog writer automation using n8n.
AI Agent
Google Sheets
httpRequest
+5
Free

Automate CrowdStrike Alerts with VirusTotal, Jira & Slack

This workflow automates processing of CrowdStrike detections by enriching threat data via VirusTotal, creating Jira tickets for incident tracking, and notifying teams on Slack for quick response. Save hours daily by transforming complex threat data into actionable alerts effortlessly.
scheduleTrigger
httpRequest
jira
+5
Free

Automate Telegram Invoices to Notion with AI Summaries & Reports

Save hours on financial tracking by automating invoice extraction from Telegram photos to Notion using Google Gemini AI. This workflow extracts data, records transactions, and generates detailed spending reports with charts sent on schedule via Telegram.
lmChatGoogleGemini
telegramTrigger
notion
+9
Free

Automate Email Replies with n8n and AI-Powered Summarization

Save hours managing your inbox with this n8n workflow that uses IMAP email triggers, AI summarization, and vector search to draft concise replies requiring minimal review. Automate business email processing efficiently with AI guidance and Gmail integration.
emailReadImap
vectorStoreQdrant
emailSend
+12
Free

Automate Email Campaigns Using n8n with Gmail & Google Sheets

This n8n workflow automates personalized email outreach campaigns by integrating Gmail and Google Sheets, saving hours of manual follow-up work and reducing errors in email sequences. It ensures timely follow-ups based on previous email interactions, optimizing communication efficiency.
googleSheets
gmail
code
+5
Free