Stop Writing! Deploy the AI Agent That Auto-Posts to Your Blog & Social Media (N8n Tutorial)

 1. The "Why": Why You Need an AI Agent to Replace Your Content Team

N8n auto blog post workflow generates passive income and automates content creation.



In the digital age, content is king, but manual content creation is a slow, expensive, and exhausting process. If you are a content creator, affiliate marketer, or business owner, you know the relentless pressure of needing to publish daily, maintain SEO standards, and manage social media distribution. This is where AI content automation steps in, transforming your workflow from a bottleneck into a passive income stream.
The workflow we are about to share is not just a simple content spinner; it is your own AI Agent built inside N8n. Think of it as hiring a full-time content team that works for free, 24/7. This agent handles everything from finding the hottest topics to final publication, ensuring you can scale your content output without scaling your effort.

The Problem with Manual Content Creation

Manual ProcessAutomated Solution (N8n + AI)Time Saved (Per Article)
Market Research (Finding viral topics)Automatic RSS feed scraping and filtering1-2 hours
SEO Strategy (Keywords, Meta Tags)Dedicated AI SEO Agent generates all tags30 minutes
Content Writing (Drafting, editing, formatting)AI Blog Writer Agent generates 1000+ words of HTML3-5 hours
Image Sourcing (Finding copyright-free images)Google Custom Search API finds and links images15 minutes
Distribution (Posting to blog and social)Auto-publish to Blogger/WordPress and Facebook10 minutes
Total Time Saved ~5-7 Hours
By deploying this N8n workflow, you are not just saving time; you are creating a passive income asset that works 24/7, consistently driving traffic and building authority in your niche.

2. The "What": Understanding the N8n AI Agent's Superpowers

N8n is a free and open-source tool that lets you connect apps and build automated workflows—no coding required! This specific workflow, which we call the N8n AI Agent Auto Post, is a masterpiece of efficiency. It combines multiple steps into a seamless, hands-off operation that anyone can set up.

Key Components of the Workflow

Visual diagram of the N8n auto blog post process for automated content publishing.


The automation runs on a schedule (you can set it to run once a day, every hour, or every 15 minutes) and executes the following simple steps:
1.Source & Filter: Scrapes multiple RSS feeds for fresh news in a specific niche (e.g., Pakistani Showbiz). It then checks a Google Sheet database to ensure the article has not been posted before.
2.SEO Strategy Agent: A dedicated AI agent (using Gemini) analyzes the selected article and generates a full SEO package: Primary Keyword, Long-Tail Keywords, SEO Title, Meta Description, and Image Search Query.
3.Image Sourcing: Uses the Image Search Query to find copyright-free images via the Google Custom Search API.
4.Blog Writer Agent: A second, highly specialized AI agent uses the SEO strategy and the source content to write a unique, 800-1200 word, HTML-formatted blog post, complete with image links and alt-text.
5.Blogger/WordPress Post: The final HTML is posted directly to your blog (Blogger in this case).
6.Social Media Agent: A third AI agent generates a separate, highly engaging Facebook post (in Pure Urdu, as per the original workflow) and posts it, then adds the blog link in the comments for maximum reach.
7.Database Update: The article link and post ID are logged in the Google Sheet to prevent future duplicates.

3. The "How-To": Your A-to-Z Guide to Deploying the N8n AI Agent

The best part about this workflow is how easy it is to deploy. Even if you've never used N8n before, you can import the entire structure into your N8n instance in minutes. We'll walk you through it, step-by-step.

Step 3.1: Step 1: Gather Your Tools (The Prerequisites)

Before you import the code, you need to gather a few things. Don't worry, this is the hardest part, and it's mostly just signing up for free accounts and getting API keys. Think of these as the "keys" your AI Agent needs to start working.
N8n Instance: Self-hosted or cloud.
Google Sheets: For tracking posted articles (prevents duplicates).
Google OAuth2: For Blogger/WordPress API access.
Facebook Graph API: For social media posting.
Gemini/OpenAI API Key: For the AI agents (SEO and Blog Writer).
Google Custom Search API Key: For finding copyright-free images.

Step 3.2: Step 2: Import the Full N8n Workflow Code

To deploy your new AI Agent, follow these simple steps: 1. Copy the entire JSON code block below. 2. Go to your N8n dashboard. 3. Click "New" (or the plus icon). 4. Select "Import from JSON" and paste the code. Your entire workflow is now built!
json


{
  "name": "Ai Auto Blog Poster Blogger and FB",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "minutes",
              "minutesInterval": 15
            }
          ]
        }
      },
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        -4496,
        -224
      ],
      "id": "2d271eb0-6bb5-4088-aff0-b67683c2cad6",
      "name": "Schedule Trigger (Every 15 min)"
    },
    {
      "parameters": {
        "jsCode": "// Multiple Pakistani showbiz and entertainment RSS feeds\n// WORKING FEEDS (tested - no Cloudflare protection)\nconst feeds = [\n  { feedUrl: 'https://www.urdupoint.com/rss/entertainment.rss', source: 'Urdu Point Entertainment' },\n  { feedUrl: 'https://www.bolnews.com/category/entertainment/feed/', source: 'BOL News Entertainment' },\n  { feedUrl: 'https://www.showbizpk.com/feed/', source: 'ShowbizPK' },\n  { feedUrl: 'https://www.pakistan.tv/feed/', source: 'Pakistan.TV' },\n  { feedUrl: 'https://pakshowbiz.com/feed', source: 'PakShowbiz' },\n  { feedUrl: 'https://reviewit.pk/latest-happenings/feed', source: 'Reviewit.pk – Latest Happenings' },\n  { feedUrl: 'https://www.inp.net.pk/rss-feed', source: 'News International – Showbiz' }\n];\n\nreturn feeds.map(feed => ({ json: feed }));"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        -4144,
        -192
      ],
      "id": "06a817c4-6560-459e-8b6c-5c306e1434c2",
      "name": "Showbiz Feed Sources"
    },
    {
      "parameters": {
        "url": "={{ $json.feedUrl }}",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "User-Agent",
              "value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
            },
            {
              "name": "Accept",
              "value": "application/rss+xml, application/xml, text/xml, */*"
            },
            {
              "name": "Accept-Language",
              "value": "en-US,en;q=0.9"
            },
            {
              "name": "Cache-Control",
              "value": "no-cache"
            }
          ]
        },
        "options": {
          "redirect": {
            "redirect": {
              "maxRedirects": 5
            }
          },
          "response": {
            "response": {
              "responseFormat": "string"
            }
          },
          "timeout": 30000
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -3952,
        -192
      ],
      "id": "b4079bf6-a887-41ea-948a-6a01a3d6681e",
      "name": "Fetch RSS (HTTP)",
      "continueOnFail": true,
      "onError": "continueRegularOutput"
    },
    {
      "parameters": {
        "jsCode": "// 🧹 Clean and parse RSS XML manually with basic regex extraction\nconst items = $input.all();\nconst results = [];\nconst failedFeeds = [];\n\nfor (const item of items) {\n  try {\n    let xmlContent = item.json.data || item.json;\n\n    if (typeof xmlContent !== 'string') continue;\n\n    // 🧼 Sanitize bad XML (&, etc.)\n    xmlContent = xmlContent.replace(/&(?!amp;|lt;|gt;|quot;|apos;)/g, '&amp;');\n\n    // 🔍 Extract <item> blocks\n    const re = /<item>([\\s\\S]*?)<\/item>/gim;\n    let match;\n\n    while ((match = re.exec(xmlContent))) {\n      const block = match[1];\n      const feedItem = {};\n\n      const title = block.match(/<title><![CDATA[[\\s\\S]*?]]>|<title>([\\s\\S]*?)<\/title>/i);\n      const link = block.match(/<link>([\\s\\S]*?)<\/link>/i);\n      const desc = block.match(/<description><![CDATA[[\\s\\S]*?]]>|<description>([\\s\\S]*?)<\/description>/i);\n      const pubDate = block.match(/<pubDate>([\\s\\S]*?)<\/pubDate>/i) || block.match(/<dc:date>([\\s\\S]*?)<\/dc:date>/i);\n      const enclosure = block.match(/<enclosure[^>]*url="([^"]+)"[^>]*>/i);\n      const media = block.match(/<media:content[^>]*url="([^"]+)"[^>]*>/i) || block.match(/<media:thumbnail[^>]*url="([^"]+)"[^>]*>/i);\n\n      feedItem.title = (title && (title[1] || title[2]))?.trim() || 'Untitled';\n      feedItem.link = link?.[1]?.trim() || '';\n      feedItem.description = (desc && (desc[1] || desc[2]))?.trim() || '';\n      feedItem.pubDate = pubDate?.[1]?.trim() || '';\n      feedItem.imageUrl = enclosure?.[1] || media?.[1] || '';\n\n      // Filter empty / invalid\n      if (!feedItem.link || !feedItem.title) continue;\n\n      results.push({ json: feedItem });\n    }\n  } catch (error) {\n    console.log(`❌ Error parsing feed: ${error.message}`);\n    failedFeeds.push(item.json.feedUrl || 'unknown');\n    continue;\n  }\n}\n\n// 🧾 Validation\nif (results.length === 0) {\n  console.log(`❌ No valid RSS items parsed. Failed feeds: ${failedFeeds.join(', ')}`);\n  throw new Error('No valid RSS items could be parsed. Possibly blocked feeds.');\n}\n\nconsole.log(`✅ Parsed ${results.length} RSS items successfully`);\nif (failedFeeds.length > 0) {\n  console.log(`⚠️ Skipped feeds: ${failedFeeds.join(', ')}`);\n}\n\nreturn results;"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        -3728,
        -192
      ],
      "id": "f59715b5-3cbc-4f77-bb72-055bbce1e637",
      "name": "Parse & Sanitize RSS"
    },
    {
      "parameters": {
        "jsCode": "const items = $input.all();\nconst processedItems = [];\nconst now = new Date();\n\n// 🔧 Adjustable freshness window (in hours)\nconst freshnessHours = 48; // change to 12 if you only want last 12 hours\nconst cutoff = new Date(now.getTime() - freshnessHours * 60 * 60 * 1000);\n\nfor (const item of items) {\n  try {\n    const data = item.json;\n    if (!data || !data.link) continue;\n\n    // 🕒 Parse and validate publication date\n    let pubDate = data.pubDate || data.published || data.isoDate || data.date;\n    let articleDate = new Date(pubDate);\n    if (isNaN(articleDate.getTime())) articleDate = now;\n\n    // ⏱️ Skip if older than cutoff\n    if (articleDate < cutoff) continue;\n\n    // 🖼️ Extract RSS image URL (optional)\n    let imageUrl = '';\n    if (data.enclosure?.url) imageUrl = data.enclosure.url;\n    if (!imageUrl && data['media:thumbnail']) {\n      const thumb = data['media:thumbnail'];\n      imageUrl = Array.isArray(thumb)\n        ? (thumb[0]?.url || thumb[0]?.$?.url)\n        : (thumb.url || thumb.$?.url);\n    }\n    if (!imageUrl && data['media:content']) {\n      const media = data['media:content'];\n      imageUrl = Array.isArray(media)\n        ? (media[0]?.url || media[0]?.$?.url)\n        : (media.url || media.$?.url);\n    }\n\n    // 📰 Determine source\n    let newsSource = 'Pakistani Showbiz';\n    const link = data.link.toLowerCase();\n    if (link.includes('reviewit.pk')) newsSource = 'Reviewit.pk';\n    else if (link.includes('urdupoint.com')) newsSource = 'Urdu Point';\n    else if (link.includes('express.pk')) newsSource = 'Daily Express';\n    else if (link.includes('bolnews.com')) newsSource = 'BOL News';\n    else if (link.includes('pakistan.tv')) newsSource = 'Pakistan.TV';\n    else if (link.includes('showbizpk.com')) newsSource = 'ShowbizPK';\n    else if (link.includes('fuchsiamagazine.com')) newsSource = 'FUCHSIA Magazine';\n\n    // 🎭 Extract category\n    let category = 'Entertainment';\n    if (data.categories && data.categories.length > 0) {\n      category = Array.isArray(data.categories)\n        ? data.categories[0]\n        : data.categories;\n    }\n\n    // 🧹 Clean content text\n    let fullContent =\n      data.contentSnippet ||\n      data.content ||\n      data['content:encoded'] ||\n      data.description ||\n      '';\n    fullContent = fullContent\n      .replace(/<[^>]+>/g, '') // strip HTML\n      .replace(/&nbsp;/g, ' ')\n      .replace(/&amp;/g, '&')\n      .replace(/&lt;/g, '<')\n      .replace(/&gt;/g, '>')\n      .replace(/\\s+/g, ' ')\n      .replace(/\\[.*?\\]/g, '')\n      .trim()\n      .substring(0, 2500);\n\n    // Skip very short items\n    if (fullContent.length < 100) continue;\n\n    // 🔑 Create a stable unique hash from link\n    const articleHash = Buffer.from(data.link).toString('base64');\n\n    // Avoid duplicates\n    if (processedItems.some(i => i.json.articleHash === articleHash)) continue;\n\n    // ✅ Push processed item\n    processedItems.push({\n      json: {\n        title: data.title || '(Untitled)',\n        link: data.link,
        imageUrl,
        category,
        newsSource,
        fullContent,
        pubDate: articleDate.toISOString(),
        hasImage: !!imageUrl,
        articleHash,
        timestamp: articleDate.getTime(),
      },
    });

  } catch (error) {
    console.log('Error processing article:', error.message);
    continue;
  }
}

// 🧾 Final validation
if (processedItems.length === 0) {
  console.log(`No fresh articles found in last ${freshnessHours} hours`);
  throw new Error(`No fresh showbiz articles found in last ${freshnessHours} hours`);
}

// 🕐 Sort by newest first
processedItems.sort((a, b) => b.json.timestamp - a.json.timestamp);

console.log(`✅ Found ${processedItems.length} fresh showbiz articles (last ${freshnessHours} hours)`);

return processedItems;"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        -3600,
        -416
      ],
      "id": "59039c85-d78a-484f-9d40-112ff0e85a09",
      "name": "Extract All Data"
    },
    {
      "parameters": {
        "documentId": {
          "__rl": true,
          "value": "18PB5PEcPjtXsoAJYY913pX0csNNgXi6OqSluWa48EgI",
          "mode": "list",
          "cachedResultName": "Zara Facebook and Blog Automation",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/18PB5PEcPjtXsoAJYY913pX0csNNgXi6OqSluWa48EgI/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "Blog Automation",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/18PB5PEcPjtXsoAJYY913pX0csNNgXi6OqSluWa48EgI/edit#gid=0"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.4,
      "position": [
        -3504,
        -192
      ],
      "id": "f6b25636-0bb1-472d-8a29-3ee68230364c",
      "name": "Get Posted Articles",
      "alwaysOutputData": true,
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "eIkvL77YqrF0Hzcf",
          "name": "Google Sheets account"
        }
      },
      "onError": "continueRegularOutput"
    },
    {
      "parameters": {
        "jsCode": "const allArticles = $('Extract All Data').all();\nconst postedRows = $input.all();\nlet postedLinks = new Set();\nlet postedHashes = new Set();\n\n// Build set of already posted articles from Google Sheet\nif (postedRows && postedRows.length > 0) {\n  for (const row of postedRows) {\n    // PRIMARY: Use article link (most reliable)\n    const link = row.json.link || row.json.Link || row.json.sourceLink;\n    if (link) postedLinks.add(link);\n    \n    // SECONDARY: Use hash as backup\n    const hash = row.json.articleHash || row.json['Article Hash'] || row.json.articlehash;\n    if (hash && hash.length > 10) postedHashes.add(hash);\n  }\n}\n\nconsole.log(`Already posted: ${postedLinks.size} articles (by link), ${postedHashes.size} (by hash)`);\n\n// Filter out already posted articles - PRIMARY check is by link!\nconst newArticles = allArticles.filter(article => {\n  // If link was posted before, definitely skip it\n  if (postedLinks.has(article.json.link)) {\n    console.log(`SKIPPING (duplicate link): ${article.json.title}`);
    return false;
  }
  \n  // Double-check with hash as well\n  if (postedHashes.has(article.json.articleHash)) {
    console.log(`SKIPPING (duplicate hash): ${article.json.title}`);
    return false;
  }
  \n  return true;
});

console.log(`Found ${newArticles.length} new articles not yet posted`);

if (newArticles.length === 0) {
  throw new Error('No new showbiz articles to post! All fresh articles have already been posted.');
}

// Prioritize by:
// 1. Has image (for better engagement)
// 2. Most recent timestamp
const prioritized = newArticles.sort((a, b) => {
  // First: prefer articles with images
  if (a.json.hasImage && !b.json.hasImage) return -1;
  if (!a.json.hasImage && b.json.hasImage) return 1;
  \n  // Second: most recent
  return b.json.timestamp - a.json.timestamp;
});

const selected = prioritized[0];

console.log(`✅ SELECTED: \"${selected.json.title}\" from ${selected.json.newsSource}`);

return [selected];"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        -3280,
        -192
      ],
      "id": "4f4f488a-4196-487f-b4ec-520c4d20019c",
      "name": "Filter New Articles"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=You are an SEO expert for Pakistani entertainment content written in PURE URDU.\n\n**Article:** {{ $json.title }}\n**Category:** {{ $json.category }}\n**Content:** {{ $json.fullContent }}\n\n**Create SEO Strategy for PURE URDU Blog:**\n\n**CRITICAL REQUIREMENTS:**\n- Blog content will be 100% in URDU SCRIPT\n- SEO Title must be in PURE URDU (اردو میں)\n- Meta Description must be in PURE URDU\n- Keywords should be how Pakistanis search (mix of Urdu and Roman Urdu)\n- Optimize for Google Pakistan searches\n\n**Provide:**\n\nPrimary Keyword (3-5 words - Roman Urdu/English for SEO, high search volume)\n5 Long-Tail Keywords (specific 4-7 word phrases in Roman Urdu/Urdu mix)\n5 High-Volume Keywords (trending terms Pakistani audience searches)\nSEO Title (50-60 chars, **100% URDU SCRIPT**, compelling, includes topic)\nMeta Description (140-155 chars, **100% URDU SCRIPT**, emotional hook + CTA)\nURL Slug (short, Roman Urdu/English only, keyword-rich, lowercase-with-hyphens)\n3 FAQ Questions (**100% URDU SCRIPT** - People Also Ask format)\nCelebrity/Topic Names (extract main celebrity/drama name for image search)\n\n**CRITICAL:**\n- SEO Title: PURE URDU SCRIPT (e.g., \"عائزہ خان کی نئی ڈرامے کی تفصیلات\")\n- Meta Description: PURE URDU SCRIPT with emotional hook\n- Keywords: Mix Roman Urdu and English (what people actually type in Google)\n- URL Slug: Roman Urdu/English only (e.g., \"ayeza-khan-new-drama\")\n- FAQ: PURE URDU SCRIPT questions\n\n**Format:**\nPrimary Keyword: [Roman Urdu/English keyword]\nLong-Tail Keywords: [kw1, kw2, kw3, kw4, kw5]\nHigh-Volume Keywords: [kw1, kw2, kw3, kw4, kw5]\nSEO Title: [100% Urdu script title]\nMeta Description: [100% Urdu script description with hook]\nURL Slug: [roman-urdu-slug]\nFAQ Questions:\n1. [100% Urdu script question]\n2. [100% Urdu script question]\n3. [100% Urdu script question]\nCelebrity Name: [name in English]\nImage Search Query: [Pakistani celebrity/drama name in English]\n\n**Examples:**\n- SEO Title: \"ماہرہ خان کی نئی فلم کی شاندار تفصیلات\"\n- Meta Description: \"ماہرہ خان کی آنے والی فلم کے بارے میں حیران کن خبریں! مکمل تفصیلات یہاں پڑھیں\"\n- URL Slug: \"mahira-khan-new-film-details\"\n\nOptimize for Pakistani Urdu-speaking audience searches."
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.7,
      "position": [
        -3056,
        -192
      ],
      "id": "60468d0c-2f8d-49d7-bd90-63d50ad59258",
      "name": "SEO Strategy Agent"
    },
    {
      "parameters": {
        "modelName": "models/gemini-2.0-flash",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "typeVersion": 1,
      "position": [
        -2992,
        48
      ],
      "id": "148983a4-86ce-4536-b5c6-ecc50b983b37",
      "name": "Gemini (SEO)",
      "credentials": {
        "googlePalmApi": {
          "id": "dJ8qLpAcSmJKvYys",
          "name": "2nd Gemini"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "// Extract image search query from SEO output\nconst seoOutput = $input.first().json.output;\nconst articleData = $('Filter New Articles').first().json;\n\n// Try to extract Image Search Query from SEO output\nlet imageQuery = '';\nconst imageMatch = seoOutput.match(/Image Search Query:\\s*(.+?)(?:\\n|$)/i);\nif (imageMatch && imageMatch[1]) {
  imageQuery = imageMatch[1].trim();
} else {
  // Fallback: extract celebrity name
  const celebMatch = seoOutput.match(/Celebrity Name:\\s*(.+?)(?:\\n|$)/i);\n  if (celebMatch && celebMatch[1]) {
    imageQuery = celebMatch[1].trim() + ' Pakistani celebrity';
  } else {
    // Ultimate fallback: use article title
    imageQuery = articleData.title;
  }
}

console.log(`Image search query: ${imageQuery}`);

return [{
  json: {
    imageQuery: imageQuery,
    seoData: seoOutput,
    articleData: articleData
  }
}];"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        -2704,
        -192
      ],
      "id": "6b2c0fbe-f9d2-4eb1-9533-1ebb1dfa5e70",
      "name": "Prepare Image Search"
    },
    {
      "parameters": {
        "url": "=https://www.googleapis.com/customsearch/v1",
        "authentication": "genericCredentialType",
        "genericAuthType": "queryAuth",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "key",
              "value": "AIzaSyD9LvnwhdWyM2wY2501TjZSd6nX5q-cdpE"
            },
            {
              "name": "cx",
              "value": "d0a5f08145b614eea"
            },
            {
              "name": "q",
              "value": "={{ $json.imageQuery }}"
            },
            {
              "name": "searchType",
              "value": "image"
            },
            {
              "name": "num",
              "value": "5"
            },
            {
              "name": "imgSize",
              "value": "large"
            },
            {
              "name": "rights",
              "value": "cc_publicdomain|cc_attribute|cc_sharealike|cc_noncommercial"
            },
            {
              "name": "safe",
              "value": "active"
            },
            {
              "name": "fileType",
              "value": "jpg|png"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -2480,
        -192
      ],
      "id": "f8999095-8bbc-4b70-bfbf-c267eb562a99",
      "name": "Google Image Search",
      "notes": "Searches for reusable images"
    },
    {
      "parameters": {
        "jsCode": "// Extract image URLs from Google Image Search\nconst searchResult = $input.first().json;\nconst previousData = $('Prepare Image Search').first().json;\n\nlet images = [];\n\n// ONLY use copyright-free images from Google Custom Search\n// NEVER use RSS feed images to avoid copyright issues\nif (searchResult.items && searchResult.items.length > 0) {
  images = searchResult.items.slice(0, 3).map(item => ({
    url: item.link,
    thumbnail: item.image?.thumbnailLink || item.link,
    title: item.title,
    source: item.image?.contextLink || '',
    width: item.image?.width || 800,
    height: item.image?.height || 600
  }));
  console.log(`Found ${images.length} copyright-free images from Google`);
} else {
  console.log('WARNING: No copyright-free images found. Post will be text-only.');
  // Do NOT use RSS images - copyright risk!
  images = [];
}

return [{
  json: {
    images: images,
    mainImage: images[0] || null,
    seoData: previousData.seoData,
    articleData: previousData.articleData,
    hasImages: images.length > 0
  }
}];"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        -2256,
        -192
      ],
      "id": "3beb51a1-7c54-47e7-a304-617693c3657d",
      "name": "Extract Image URLs"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=You are a professional Pakistani entertainment blog writer who writes in PURE URDU.\n\n**Article Topic:** {{ $json.articleData.title }}\n**Category:** {{ $json.articleData.category }}\n**Reference Content:** {{ $json.articleData.fullContent }}\n\n**SEO Strategy:**\n{{ $json.seoData }}\n\n**Available Copyright-Free Images:**\nImage 1: {{ $json.images[0]?.url || 'No image' }}\nImage 2: {{ $json.images[1]?.url || 'No image' }}\nImage 3: {{ $json.images[2]?.url || 'No image' }}\n\n**Write a complete blog post (800-1200 words) in PURE URDU (صرف اردو میں) with HTML:**\n\n**CRITICAL REQUIREMENTS - READ CAREFULLY:**\n- Write **100% in URDU SCRIPT ONLY** (اردو رسم الخط میں)\n- **ABSOLUTELY NO ENGLISH WORDS** - not even celebrity names!\n- Translate EVERYTHING to Urdu: Drama, Film, Actor, Show, etc.\n- Celebrity names in Urdu: \"عمران عباس\" not \"Imran Abbas\"\n- Professional Pakistani entertainment journalism style\n- Engaging, emotional, and conversational tone\n- Write ORIGINAL content in your own words\n- **OUTPUT PURE HTML ONLY - NO MARKDOWN, NO CODE BLOCKS, NO BACKTICKS**\n\n**Examples of WHAT TO DO:**\n✅ \"ڈرامہ\" not \"Drama\"\n✅ \"اداکار\" not \"Actor\" \n✅ \"فلم\" not \"Film\"\n✅ \"شو\" not \"Show\"\n✅ \"عائزہ خان\" not \"Ayeza Khan\"\n✅ \"ماہرہ خان\" not \"Mahira Khan\"\n\n**Structure:**\n\n<h1>[SEO Title - 100% in Urdu script]</h1>\n\n<img src=\"{{ $json.images[0]?.url }}\" alt=\"[Primary keyword in pure Urdu]\" style=\"width:100%;max-width:800px;height:auto;\">\n\n<p>[Opening paragraph in PURE URDU - include primary keyword naturally in first 100 words]</p>\n\n<h2>[Engaging subheading in pure Urdu]</h2>\n<p>[2-3 paragraphs in pure Urdu explaining the main story]</p>\n<p>[Include key details, quotes if available, all in Urdu]</p>\n\n<img src=\"{{ $json.images[1]?.url || $json.images[0]?.url }}\" alt=\"[Long-tail keyword in pure Urdu]\" style=\"width:100%;max-width:800px;height:auto;\">\n\n<h2>[Second engaging subheading in pure Urdu]</h2>\n<p>[2-3 paragraphs in pure Urdu with background and context]</p>\n<p>[Explain why this matters to Pakistani audience]</p>\n\n<h2>[Third engaging subheading in pure Urdu]</h2>\n<p>[2-3 paragraphs in pure Urdu with analysis and reactions]</p>\n<p>[Include fan reactions, social media buzz - all in Urdu]</p>\n\n<img src=\"{{ $json.images[2]?.url || $json.images[0]?.url }}\" alt=\"[High-volume keyword in pure Urdu]\" style=\"width:100%;max-width:800px;height:auto;\">\n\n<h2>اکثر پوچھے جانے والے سوالات</h2>\n<h3>[FAQ Question 1 in pure Urdu]</h3>\n<p>[Clear answer in pure Urdu]</p>\n<h3>[FAQ Question 2 in pure Urdu]</h3>\n<p>[Clear answer in pure Urdu]</p>\n<h3>[FAQ Question 3 in pure Urdu]</h3>\n<p>[Clear answer in pure Urdu]</p>\n\n<h2>نتیجہ</h2>\n<p>[Conclusion in pure Urdu discussing future developments]</p>\n<p>[End with engaging CTA in Urdu]</p>\n\n**STRICT REQUIREMENTS:**\n- Write in PURE URDU SCRIPT (اردو) - NO English at all!\n- Use ALL 3 images with descriptive SEO alt text in Urdu (ONLY if images are available)\n- Translate celebrity names to Urdu: ماہرہ خان، فواد خان، عائزہ خان\n- Translate all terms: ڈرامہ (drama), فلم (film), اداکار (actor), اداکارہ (actress)\n- Short paragraphs (2-4 sentences each)\n- Conversational yet professional tone\n- Natural keyword placement throughout\n- Emotional and engaging storytelling\n- Create urgency and excitement\n- DO NOT copy-paste - rewrite everything in your own words\n\n**FORBIDDEN:**\n- ❌ NO English words anywhere (not even one!)\n- ❌ NO Roman Urdu (like \"drama\", \"film\")\n- ❌ NO English celebrity names\n- ❌ NO mixed language\n- ❌ NO markdown code blocks (```) \n- ❌ NO language labels like \"html\"\n- ❌ NO backticks at all\n\n**CRITICAL OUTPUT FORMAT:**\nReturn ONLY pure HTML code. Start directly with <h1> tag. NO markdown formatting. NO code blocks. NO explanations.\n\nExample of CORRECT output:\n<h1>عائزہ خان کی نئی ڈرامے کی شاندار تفصیلات</h1>\n<img src=\"...\" alt=\"عائزہ خان\" style=\"width:100%;max-width:800px;height:auto;\">\n<p>پاکستانی...</p>\n\nExample of WRONG output:\n```html\n<h1>Title</h1>\n```\n\nStart your output directly with HTML tags, nothing else."
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.7,
      "position": [
        -2096,
        -192
      ],
      "id": "5b383ca3-22bb-4f30-8adc-83d19ebebc7f",
      "name": "Blog Writer with Images"
    },
    {
      "parameters": {
        "modelName": "models/gemini-2.0-flash",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "typeVersion": 1,
      "position": [
        -1968,
        48
      ],
      "id": "c6faed64-2e56-4260-aec2-8bb8f882e897",
      "name": "Gemini (Blog)"
    },
    {
      "parameters": {
        "jsCode": "// Clean blog output - remove markdown code blocks if present\nlet blogHtml = $input.first().json.output;\n\n// Remove markdown code blocks (```html ... ``` or ``` ... ```)\nblogHtml = blogHtml.replace(/^```html\\s*/i, '');\nblogHtml = blogHtml.replace(/^```\\s*/m, '');\nblogHtml = blogHtml.replace(/\\s*```$/m, '');\n\n// Remove any remaining backticks at start/end\nblogHtml = blogHtml.replace(/^`+/g, '');\nblogHtml = blogHtml.replace(/`+$/g, '');\n\n// Trim whitespace\nblogHtml = blogHtml.trim();\n\nconsole.log('Blog HTML cleaned. Length: ' + blogHtml.length);\n\nreturn [{\n  json: {
    cleanedHtml: blogHtml
  }
}];"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        -1808,
        -192
      ],
      "id": "ac3e9172-3307-491b-9593-1aa4c37deb5c",
      "name": "Clean Blog HTML"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://www.googleapis.com/blogger/v3/blogs/7982630922003231296/posts/",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "googleOAuth2Api",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"title\": {{ $('SEO Strategy Agent').item.json.output.match(/SEO Title: (.+)/)?.[1] ? JSON.stringify($('SEO Strategy Agent').item.json.output.match(/SEO Title: (.+)/)[1].trim()) : JSON.stringify($('Filter New Articles').item.json.title) }},\n  \"content\": {{ JSON.stringify($json.cleanedHtml) }},\n  \"labels\": [{{ JSON.stringify($('Filter New Articles').item.json.category) }}, \"Pakistani Entertainment\", \"Showbiz\"],\n  \"customMetaData\": {{ JSON.stringify($('SEO Strategy Agent').item.json.output.match(/Meta Description: (.+)/)?.[1]?.trim() || $('Filter New Articles').item.json.title.substring(0, 155)) }}\n}"
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -1680,
        -192
      ],
      "id": "f93387ea-4503-48cf-b09d-5744887e5e4a",
      "name": "Post to Blogger"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=**Article Topic:** {{ $('Filter New Articles').item.json.title }}\n**Reference Content:** {{ $('Filter New Articles').item.json.fullContent }}\n\nCreate engaging Facebook post for Pakistani showbiz (150-200 words):\n\n**CRITICAL REQUIREMENTS:**\n- Write **100% in PURE URDU SCRIPT** (صرف اردو میں)\n- **ABSOLUTELY NO ENGLISH WORDS** - not even one!\n- Translate everything: Drama → ڈرامہ, Film → فلم, Actor → اداکار\n- Celebrity names in Urdu: عائزہ خان not \"Ayeza Khan\"\n- Write ORIGINAL content in your own words\n\n**Structure:**\n1. **Hook:** Attention-grabbing opening in Urdu\n2. **Story:** 3-5 key points in narrative style (all in Urdu)\n3. **Emojis:** 3-4 relevant emojis (✨💫🎬⭐)\n4. **CTA:** Engaging question in Urdu\n5. **Tone:** Conversational, exciting, emotional\n6. **Hashtags:** Add Related Hastags and some Viral related hashtags so we get traffic , hashtags in english\n\n\n**Examples:**\n✅ \"ڈرامہ\" not \"Drama\"\n✅ \"اداکارہ\" not \"Actress\"\n✅ \"ماہرہ خان\" not \"Mahira Khan\"\n\n**FORBIDDEN:**\n❌ NO English words\n❌ NO Roman Urdu\n❌ NO links/URLs (added separately in comments)\n❌ NO English celebrity names\n\n**Style:** Pakistani entertainment social media - emotional, urgent, engaging, PURE URDU\n\nOutput ONLY the post text in PURE URDU, nothing else."
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.7,
      "position": [
        -1456,
        -192
      ],
      "id": "1433095b-7e35-4995-b2f9-d711682373e1",
      "name": "Facebook Writer"
    },
    {
      "parameters": {
        "modelName": "models/gemini-2.0-flash",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "typeVersion": 1,
      "position": [
        -1392,
        48
      ],
      "id": "9962f949-aad3-45ad-96e0-7894cc0e018b",
      "name": "Gemini (Facebook)"
    },
    {
      "parameters": {
        "jsCode": "const fbContent = $input.first().json.output;\nconst articleData = $('Filter New Articles').first().json;\nconst bloggerData = $('Post to Blogger').first().json;\nconst imageData = $('Extract Image URLs').first().json;\nconst seoData = $('SEO Strategy Agent').first().json.output;\n\nconst blogUrl = bloggerData.url || bloggerData.selfLink || '';\nconst mainImage = imageData.mainImage?.url || articleData.imageUrl || '';\n\n// Extract SEO title for tracking\nconst seoTitleMatch = seoData.match(/SEO Title:\\s*(.+?)(?:\\n|$)/i);\nconst seoTitle = seoTitleMatch ? seoTitleMatch[1].trim() : articleData.title;\n\nreturn [{\n  json: {
    postContent: fbContent.trim(),
    imageUrl: mainImage,
    hasImage: !!mainImage,
    blogUrl: blogUrl,
    articleHash: articleData.articleHash,
    title: articleData.title,
    seoTitle: seoTitle,
    sourceLink: articleData.link
  }
}];"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        -1104,
        -192
      ],
      "id": "597ef5a6-8157-4b20-a485-38fcaf044034",
      "name": "Format FB Post"
    },
    {
      "parameters": {
        "conditions": {
          "boolean": [
            {
              "value1": "={{ $json.hasImage }}",
              "value2": true
            }
          ]
        }
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        -880,
        -192
      ],
      "id": "da20f42b-3584-4cc6-8808-30ac12507d09",
      "name": "Has Image?"
    },
    {
      "parameters": {
        "httpRequestMethod": "POST",
        "graphApiVersion": "v22.0",
        "node": "me",
        "edge": "feed",
        "options": {
          "queryParameters": {
            "parameter": [
              {
                "name": "message",
                "value": "={{ $('Facebook Writer').item.json.output }}"
              }
            ]
          }
        }
      },
      "type": "n8n-nodes-base.facebookGraphApi",
      "typeVersion": 1,
      "position": [
        -656,
        -288
      ],
      "id": "8b824ea6-59a4-43e2-b1d3-99fdf0c53418",
      "name": "Post to Facebook (Image)"
    },
    {
      "parameters": {
        "httpRequestMethod": "POST",
        "graphApiVersion": "v22.0",
        "node": "me",
        "edge": "feed",
        "options": {
          "queryParameters": {
            "parameter": [
              {
                "name": "message",
                "value": "={{ $json.postContent }}"
              }
            ]
          }
        }
      },
      "type": "n8n-nodes-base.facebookGraphApi",
      "typeVersion": 1,
      "position": [
        -656,
        -80
      ],
      "id": "08cb3f50-224b-4e44-8a79-f1a0d80654f6",
      "name": "Post to Facebook (Text)"
    },
    {
      "parameters": {
        "jsCode": "const fbResponse = $input.first().json;\nconst postData = $('Format FB Post').first().json;\n\nconst postId = fbResponse.id || fbResponse.post_id;\nif (!postId) throw new Error('No Facebook post ID');\n\nconst commentText = `🔗 مکمل تفصیلات یہاں پڑھیں:\\n${postData.blogUrl}`;\n\nreturn [{\n  json: {
    postId: postId,
    commentText: commentText,
    articleHash: postData.articleHash,
    blogUrl: postData.blogUrl,
    title: postData.title,
    seoTitle: postData.seoTitle
  }
}];"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        -432,
        -192
      ],
      "id": "bb52da98-b3d1-42cb-aba6-6fd9a7dfbdf5",
      "name": "Prepare Comment"
    },
    {
      "parameters": {
        "httpRequestMethod": "POST",
        "graphApiVersion": "v22.0",
        "node": "={{ $json.postId }}",
        "edge": "comments",
        "options": {
          "queryParameters": {
            "parameter": [
              {
                "name": "message",
                "value": "={{ $json.commentText }}"
              }
            ]
          }
        }
      },
      "type": "n8n-nodes-base.facebookGraphApi",
      "typeVersion": 1,
      "position": [
        -208,
        -192
      ],
      "id": "979cfb46-c7e5-4edb-844c-6dd455361a00",
      "name": "Add Comment"
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "value": "18PB5PEcPjtXsoAJYY913pX0csNNgXi6OqSluWa48EgI",
          "mode": "list",
          "cachedResultName": "Zara Facebook and Blog Automation",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/18PB5PEcPjtXsoAJYY913pX0csNNgXi6OqSluWa48EgI/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "Blog Automation",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/18PB5PEcPjtXsoAJYY913pX0csNNgXi6OqSluWa48EgI/edit#gid=0"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "articleHash": "={{ $('Prepare Comment').item.json.articleHash }}",
            "link": "={{ $('Filter New Articles').item.json.link }}",
            "title": "={{ $('Prepare Comment').item.json.title }}",
            "seoTitle": "={{ $('Prepare Comment').item.json.seoTitle }}",
            "blogUrl": "={{ $('Prepare Comment').item.json.blogUrl }}",
            "facebookPostId": "={{ $('Prepare Comment').item.json.postId }}",
            "postedAt": "={{ $now.toISO() }}"
          },
          "matchingColumns": [
            "articleHash"
          ],
          "schema": [
            {
              "id": "articleHash",
              "displayName": "articleHash",
              "required": false,
              "defaultMatch": true,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "link",
              "displayName": "link",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "title",
              "displayName": "title",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": false,
              "removed": false
            },
            {
              "id": "seoTitle",
              "displayName": "seoTitle",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": false,
              "removed": false
            },
            {
              "id": "blogUrl",
              "displayName": "blogUrl",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": false,
              "removed": false
            },
            {
              "id": "facebookPostId",
              "displayName": "facebookPostId",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": false,
              "removed": false
            },
            {
              "id": "postedAt",
              "displayName": "postedAt",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": false,
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": true
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.4,
      "position": [
        16,
        -192
      ],
      "id": "111e5e5c-536c-4683-8886-c2ab53c2f780",
      "name": "Save to Sheet"
    },
    {
      "parameters": {
        "content": "## 🎯 Complete Flow with Google Images\n\n**Schedule:** Every 6 hours\n\n**Process:**\n1. ✅ Read RSS feed\n2. ✅ Filter new articles\n3. ✅ Generate SEO strategy\n4. ✅ Search Google for copyright-free images\n5. ✅ Write blog with 3 images + SEO alt text\n6. ✅ Post to Blogger\n7. ✅ Create Facebook post with image\n8. ✅ Comment with blog link\n9. ✅ Track in Google Sheet with titles\n\n**Google Sheet Columns:**\n- articleHash\n- originalTitle\n- seoTitle\n- blogUrl\n- facebookPostId\n- postedAt",
        "height": 480,
        "width": 380
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -4176,
        112
      ],
      "id": "56f809c4-a764-49e6-abc0-7224c86842a6",
      "name": "Info"
    },
    {
      "parameters": {
        "content": "## 🔑 Setup Google Custom Search\n\n**Required:**\n1. Go to: console.cloud.google.com\n2. Enable \"Custom Search API\"\n3. Create API Key\n4. Go to: programmablesearchengine.google.com\n5. Create search engine\n6. Get Search Engine ID (cx)\n7. Configure to search images\n8. Set usage rights filter\n\n**Add to \"Google Image Search\" node:**\n- API Key: Your key\n- Search Engine ID (cx): Your ID\n\n**Free Tier:** 100 searches/day",
        "height": 480,
        "width": 400
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -2848,
        64
      ],
      "id": "2d5213eb-5aa9-43a7-bf20-d1b95d6beab3",
      "name": "Google Image Search Setup"
    }
  ],
  "pinData": {},
  "connections": {
    "Schedule Trigger (Every 15 min)": {
      "main": [
        [
          {
            "node": "Showbiz Feed Sources",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Showbiz Feed Sources": {
      "main": [
        [
          {
            "node": "Fetch RSS (HTTP)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch RSS (HTTP)": {
      "main": [
        [
          {
            "node": "Parse & Sanitize RSS",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse & Sanitize RSS": {
      "main": [
        [
          {
            "node": "Extract All Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract All Data": {
      "main": [
        [
          {
            "node": "Get Posted Articles",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Posted Articles": {
      "main": [
        [
          {
            "node": "Filter New Articles",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter New Articles": {
      "main": [
        [
          {
            "node": "SEO Strategy Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SEO Strategy Agent": {
      "main": [
        [
          {
            "node": "Prepare Image Search",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gemini (SEO)": {
      "ai_languageModel": [
        [
          {
            "node": "SEO Strategy Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Image Search": {
      "main": [
        [
          {
            "node": "Google Image Search",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Image Search": {
      "main": [
        [
          {
            "node": "Extract Image URLs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Image URLs": {
      "main": [
        [
          {
            "node": "Blog Writer with Images",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Blog Writer with Images": {
      "main": [
        [
          {
            "node": "Clean Blog HTML",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clean Blog HTML": {
      "main": [
        [
          {
            "node": "Post to Blogger",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gemini (Blog)": {
      "ai_languageModel": [
        [
          {
            "node": "Blog Writer with Images",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Post to Blogger": {
      "main": [
        [
          {
            "node": "Facebook Writer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Facebook Writer": {
      "main": [
        [
          {
            "node": "Format FB Post",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gemini (Facebook)": {
      "ai_languageModel": [
        [
          {
            "node": "Facebook Writer",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Format FB Post": {
      "main": [
        [
          {
            "node": "Has Image?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Has Image?": {
      "main": [
        [
          {
            "node": "Post to Facebook (Image)",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Post to Facebook (Text)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Post to Facebook (Image)": {
      "main": [
        [
          {
            "node": "Prepare Comment",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Post to Facebook (Text)": {
      "main": [
        [
          {
            "node": "Prepare Comment",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Comment": {
      "main": [
        [
          {
            "node": "Add Comment",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add Comment": {
      "main": [
        [
          {
            "node": "Save to Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "f097bb16-bc80-47dd-81f2-cd525d45c3e4",
  "meta": {
    "instanceId": "92572d0b44489a9901bac91bb9970c2bdb70f1a498ae20424c2e5f2dfb963f85"
  },
  "id": "S1yUeuMQYYgC6Ru8",
  "tags": [
    {
      "createdAt": "2025-10-19T15:57:30.595Z",
      "updatedAt": "2025-10-19T15:57:30.595Z",
      "id": "Mk9ShyivZOhiMV7M",
      "name": "blog-automation"
    },
    {
      "createdAt": "2025-10-19T12:55:50.630Z",
      "updatedAt": "2025-10-19T12:55:50.630Z",
      "id": "lHZwUClv0SsMZfbC",
      "name": "social-media"
    }
  ]
}

Step 3.3: Step 3: Customize Your Agent (The Beginner's Guide)

Deploying the N8n auto blog post JSON code for instant workflow setup.


Once imported, your workflow is ready, but it's still posting about Pakistani Showbiz! You need to customize a few key nodes to make it work for your niche. This is where you tell your AI Agent what to do.
1.Schedule Trigger: Adjust the interval (e.g., from 15 minutes to once a day).
2.Showbiz Feed Sources: Replace the existing RSS feed URLs with sources relevant to your niche (e.g., "AI Tools," "GoHighLevel Updates," "WordPress Plugins").
3.SEO Strategy Agent & Blog Writer: Adjust the prompts to match your desired tone, language, and target platform (e.g., change "PURE URDU" to "Professional English" or "Casual Spanish").
4.Post to Blogger/WordPress: Update the blog ID and credentials to point to your specific site.

4. The "Result": Passive Income and Authority Building on Autopilot

N8n auto blog post success showing high social media engagement and traffic.


This automation is more than a technical trick; it's a strategic business asset.
Consistent SEO Growth: Daily, high-quality, SEO-optimized content is the single best way to signal authority to search engines.
Passive Income Potential: By automating the entire content pipeline, you free up your time to focus on monetization strategies like affiliate marketing, ad revenue, or selling your own products.
Multi-Platform Presence: The simultaneous posting to your blog and social media ensures you capture traffic from multiple channels with zero extra effort.
Scalability: Want to run a blog in a new niche? Simply duplicate the workflow, change the RSS feeds, and update the AI prompts.

1 Comments

  1. Wow that is very Valuable and a good starting point to start automating in N8N social media content.thank Urooj

    ReplyDelete
Previous Post Next Post