{
  "name": "Curate & post AI news to X, Bluesky, Threads & more via GPT-5 mini & Cue",
  "tags": [],
  "nodes": [
    {
      "id": "schedule-trigger",
      "name": "Daily 9am Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        2304,
        1968
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "days",
              "triggerAtHour": 9
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "rss-techcrunch",
      "name": "TechCrunch AI",
      "type": "n8n-nodes-base.rssFeedRead",
      "position": [
        2752,
        1744
      ],
      "parameters": {
        "url": "https://techcrunch.com/category/artificial-intelligence/feed/",
        "options": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "rss-arstechnica",
      "name": "Ars Technica AI",
      "type": "n8n-nodes-base.rssFeedRead",
      "position": [
        2752,
        1888
      ],
      "parameters": {
        "url": "https://arstechnica.com/ai/feed/",
        "options": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "rss-verge",
      "name": "The Verge AI",
      "type": "n8n-nodes-base.rssFeedRead",
      "position": [
        2752,
        2032
      ],
      "parameters": {
        "url": "https://www.theverge.com/rss/ai-artificial-intelligence/index.xml",
        "options": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "rss-mit",
      "name": "MIT Tech Review",
      "type": "n8n-nodes-base.rssFeedRead",
      "position": [
        2752,
        2176
      ],
      "parameters": {
        "url": "https://www.technologyreview.com/topic/artificial-intelligence/feed",
        "options": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "merge-feeds",
      "name": "Merge All Feeds",
      "type": "n8n-nodes-base.merge",
      "position": [
        2944,
        1936
      ],
      "parameters": {
        "numberInputs": 4
      },
      "typeVersion": 3
    },
    {
      "id": "filter-recent",
      "name": "Filter Recent",
      "type": "n8n-nodes-base.code",
      "position": [
        3152,
        1968
      ],
      "parameters": {
        "jsCode": "// Filter articles from the last 7 days and limit to 30\nconst DAYS = 7;\nconst MAX_ARTICLES = 30;\nconst cutoff = new Date(Date.now() - DAYS * 24 * 60 * 60 * 1000);\n\nconst filtered = $input.all().filter(item => {\n  const pubDate = item.json.pubDate || item.json.isoDate;\n  if (!pubDate) return true;\n  \n  const articleDate = new Date(pubDate);\n  return articleDate >= cutoff;\n});\n\n// Sort by date (newest first) and take top 30\nfiltered.sort((a, b) => {\n  const dateA = new Date(a.json.isoDate || a.json.pubDate);\n  const dateB = new Date(b.json.isoDate || b.json.pubDate);\n  return dateB - dateA;\n});\n\nreturn filtered.slice(0, MAX_ARTICLES);"
      },
      "typeVersion": 2
    },
    {
      "id": "standardize-fields",
      "name": "Standardize Fields",
      "type": "n8n-nodes-base.code",
      "position": [
        3328,
        1968
      ],
      "parameters": {
        "jsCode": "// Standardize fields across different RSS feed formats\nreturn $input.all().map(item => {\n  const json = item.json;\n  return {\n    json: {\n      url: json.link || json.url,\n      title: json.title,\n      description: json.contentSnippet || json.description || json.summary || '',\n      pubDate: json.isoDate || json.pubDate,\n      source: json.creator || json.author || 'Unknown'\n    }\n  };\n});"
      },
      "typeVersion": 2
    },
    {
      "id": "aggregate-new",
      "name": "Collect New Articles",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        3520,
        1968
      ],
      "parameters": {
        "include": "allFieldsExcept",
        "options": {},
        "aggregate": "aggregateAllItemData",
        "destinationFieldName": "newArticles"
      },
      "typeVersion": 1
    },
    {
      "id": "aggregate-posted",
      "name": "Collect Posted URLs",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        3520,
        2176
      ],
      "parameters": {
        "include": "specifiedFields",
        "options": {},
        "aggregate": "aggregateAllItemData",
        "fieldsToInclude": "article_url",
        "destinationFieldName": "postedURLs"
      },
      "typeVersion": 1
    },
    {
      "id": "merge-compare",
      "name": "Compare Lists",
      "type": "n8n-nodes-base.merge",
      "position": [
        3712,
        2048
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "select-random",
      "name": "Select Random Article",
      "type": "n8n-nodes-base.code",
      "position": [
        3904,
        2048
      ],
      "parameters": {
        "jsCode": "// Filter out already-posted articles and pick a random one\nconst newArticles = $input.first().json.newArticles || [];\nconst postedData = $input.last().json.postedURLs || [];\n\n// Extract just the URLs from posted data\nconst postedURLs = postedData.map(item => item.article_url);\n\n// Filter to only unposted articles\nconst available = newArticles.filter(article => \n  !postedURLs.includes(article.url)\n);\n\nif (available.length === 0) {\n  // No new articles to process - stop workflow\n  return [];\n}\n\n// Pick a random article\nconst randomIndex = Math.floor(Math.random() * available.length);\nreturn [{ json: available[randomIndex] }];"
      },
      "typeVersion": 2
    },
    {
      "id": "sheets-lookup",
      "name": "Get Recent Posts",
      "type": "n8n-nodes-base.googleSheets",
      "onError": "continueRegularOutput",
      "position": [
        2512,
        2176
      ],
      "parameters": {
        "options": {},
        "operation": "read",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.5,
      "alwaysOutputData": true
    },
    {
      "id": "trigger-feeds",
      "name": "Trigger Feeds",
      "type": "n8n-nodes-base.code",
      "position": [
        2512,
        1968
      ],
      "parameters": {
        "jsCode": "// Always output exactly 1 item to trigger RSS feeds once\n// Regardless of how many rows are in the sheet\nreturn [{ json: { ready: true } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "ai-agent",
      "name": "Write Social Posts",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        4128,
        2048
      ],
      "parameters": {
        "text": "=Write social media posts for this article:\n\nTITLE: {{ $json.title }}\nSUMMARY: {{ $json.description }}\n\nGenerate posts for all 5 platforms. Each post MUST:\n- Start with a compelling hook (not \"Check out\" or \"New article\")\n- Include the key insight or news\n- Stay within character limits\n- Do NOT include any URLs",
        "options": {
          "systemMessage": "You are a social media content writer specializing in AI/tech news.\nGenerate engaging posts tailored to each platform's audience and style.\n\nGuidelines:\n- X: Punchy, hook-first, drives curiosity (max 280 chars)\n- Bluesky: Conversational, community-oriented (max 300 chars)\n- Threads: Casual, Instagram-audience friendly (max 500 chars)\n- Mastodon: Technical angle, open-source perspective (max 500 chars)\n- Facebook: Broader context, accessible to non-experts (max 600 chars)"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 3.1
    },
    {
      "id": "openai-model",
      "name": "GPT-5 mini",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        4128,
        2272
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-5-mini",
          "cachedResultName": "gpt-5-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "output-parser",
      "name": "Post Format",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        4272,
        2272
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"x\": {\n      \"type\": \"string\",\n      \"description\": \"X/Twitter post (max 280 chars)\"\n    },\n    \"bluesky\": {\n      \"type\": \"string\",\n      \"description\": \"Bluesky post (max 300 chars)\"\n    },\n    \"threads\": {\n      \"type\": \"string\",\n      \"description\": \"Threads post (max 500 chars)\"\n    },\n    \"mastodon\": {\n      \"type\": \"string\",\n      \"description\": \"Mastodon post (max 500 chars)\"\n    },\n    \"facebook\": {\n      \"type\": \"string\",\n      \"description\": \"Facebook post (max 600 chars)\"\n    }\n  },\n  \"required\": [\"x\", \"bluesky\", \"threads\", \"mastodon\", \"facebook\"]\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "prepare-cue",
      "name": "Prepare for Cue",
      "type": "n8n-nodes-base.code",
      "position": [
        4496,
        2048
      ],
      "parameters": {
        "jsCode": "// Prepare for Cue - AI Agent outputs structured JSON directly\nconst article = $('Select Random Article').item.json;\nconst content = $json.output; // Structured output from AI Agent\n\nreturn [{\n  json: {\n    article,\n    content\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "cue-create-post",
      "name": "Create Draft in Cue",
      "type": "@cuehq/n8n-nodes-cue.cue",
      "position": [
        4688,
        2048
      ],
      "parameters": {
        "resource": "post",
        "operation": "create",
        "platforms": {
          "platform": [
            {
              "content": "={{ $json.content.x }}",
              "socialAccountId": {
                "__rl": true,
                "mode": "list",
                "value": ""
              }
            },
            {
              "content": "={{ $json.content.bluesky }}",
              "socialAccountId": {
                "__rl": true,
                "mode": "list",
                "value": ""
              }
            },
            {
              "content": "={{ $json.content.threads }}",
              "socialAccountId": {
                "__rl": true,
                "mode": "list",
                "value": ""
              }
            },
            {
              "content": "={{ $json.content.mastodon }}",
              "socialAccountId": {
                "__rl": true,
                "mode": "list",
                "value": ""
              }
            },
            {
              "content": "={{ $json.content.facebook }}",
              "socialAccountId": {
                "__rl": true,
                "mode": "list",
                "value": ""
              }
            }
          ]
        },
        "profileId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        }
      },
      "credentials": {
        "cueApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "prepare-sheet-data",
      "name": "Prepare Sheet Data",
      "type": "n8n-nodes-base.code",
      "position": [
        4880,
        2048
      ],
      "parameters": {
        "jsCode": "// Prepare data for Google Sheets logging\nconst preparedData = $('Prepare for Cue').item.json;\nconst article = preparedData.article;\n\nreturn [{\n  json: {\n    article_url: article.url,\n    title: article.title,\n    source: article.source || 'AI News Digest',\n    processed_at: new Date().toISOString()\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "sheets-append",
      "name": "Log to Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        5072,
        2048
      ],
      "parameters": {
        "columns": {
          "value": {
            "title": "={{ $json.title }}",
            "source": "={{ $json.source }}",
            "article_url": "={{ $json.article_url }}",
            "processed_at": "={{ $json.processed_at }}"
          },
          "mappingMode": "defineBelow"
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Get Recent Posts').params.sheetName.value }}"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Get Recent Posts').params.documentId.value }}"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "sticky-intro",
      "name": "Intro",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1744,
        1488
      ],
      "parameters": {
        "width": 480,
        "height": 912,
        "content": "## Curate AI news and generate platform-tailored posts for X, Bluesky, Threads, Mastodon & Facebook via Cue.\n\n### How it works\n\u2022 Fetches from 4 AI/tech RSS feeds daily\n\u2022 Filters to articles from the last 7 days\n\u2022 Skips already-posted articles using Google Sheets tracking\n\u2022 Picks a random new article\n\u2022 GPT-5 mini generates platform-tailored posts\n\u2022 Creates draft in Cue for review\n\n### How to use\n\u2022 Configure your Google Sheets for tracking\n\u2022 Add your OpenAI API credentials\n\u2022 Set up the Cue node with your social accounts\n\u2022 Activate the workflow - it runs daily at 9am\n\n### Requirements\n\u2022 Cue account (oncue.so)\n\u2022 OpenAI API key\n\u2022 Google Sheets\n\n### Need Help?\nCheck out [docs.oncue.so](https://docs.oncue.so) for setup guides!\n\nHappy Posting!"
      },
      "typeVersion": 1
    },
    {
      "id": "sticky-sources",
      "name": "Section 1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2256,
        1488
      ],
      "parameters": {
        "color": 7,
        "width": 840,
        "height": 920,
        "content": "## 1. Fetch News\n\n4 AI/tech RSS feeds checked daily.\n\n\u2022 Replace feeds with your niche sources\n\u2022 Keep 3-6 feeds for best results"
      },
      "typeVersion": 1
    },
    {
      "id": "sticky-ai",
      "name": "Section 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4064,
        1488
      ],
      "parameters": {
        "color": 4,
        "width": 352,
        "height": 920,
        "content": "## 3. Write Posts\n\nGPT-5 mini generates tailored content for each platform.\n\n\u2022 Configure OpenAI credentials"
      },
      "typeVersion": 1
    },
    {
      "id": "sticky-cue",
      "name": "Section 4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4448,
        1488
      ],
      "parameters": {
        "color": 6,
        "width": 800,
        "height": 928,
        "content": "## 4. Publish to Cue\n\nCreates drafts in Cue for review. Logs to spreadsheet for tracking.\n\n\u2022 Configure Cue credentials\n\u2022 Select your social accounts\n\n**Platforms:**\n\u2022 Slot 1 \u2192 X/Twitter\n\u2022 Slot 2 \u2192 Bluesky\n\u2022 Slot 3 \u2192 Threads\n\u2022 Slot 4 \u2192 Mastodon\n\u2022 Slot 5 \u2192 Facebook"
      },
      "typeVersion": 1
    },
    {
      "id": "sticky-sheets",
      "name": "Section 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3120,
        1488
      ],
      "parameters": {
        "color": 2,
        "width": 912,
        "height": 928,
        "content": "## 2. Find New Stories\n\nFilters to last 7 days, skips already-posted articles.\n\n\u2022 Configure Google Sheets credentials\n\u2022 Select your tracking spreadsheet\n\u2022 Import tracking-sheet.csv to get started"
      },
      "typeVersion": 1
    },
    {
      "id": "sticky-tip",
      "name": "Tip",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4592,
        2224
      ],
      "parameters": {
        "color": 2,
        "width": 280,
        "height": 100,
        "content": "**Tip:** To auto-publish instead of drafts, enable \"Publish Immediately\" in the Cue node settings."
      },
      "typeVersion": 1
    }
  ],
  "settings": {
    "executionOrder": "v1"
  },
  "staticData": null,
  "connections": {
    "GPT-5 mini": {
      "ai_languageModel": [
        [
          {
            "node": "Write Social Posts",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Post Format": {
      "ai_outputParser": [
        [
          {
            "node": "Write Social Posts",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "The Verge AI": {
      "main": [
        [
          {
            "node": "Merge All Feeds",
            "type": "main",
            "index": 2
          }
        ]
      ]
    },
    "Compare Lists": {
      "main": [
        [
          {
            "node": "Select Random Article",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Recent": {
      "main": [
        [
          {
            "node": "Standardize Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "TechCrunch AI": {
      "main": [
        [
          {
            "node": "Merge All Feeds",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Trigger Feeds": {
      "main": [
        [
          {
            "node": "TechCrunch AI",
            "type": "main",
            "index": 0
          },
          {
            "node": "Ars Technica AI",
            "type": "main",
            "index": 0
          },
          {
            "node": "The Verge AI",
            "type": "main",
            "index": 0
          },
          {
            "node": "MIT Tech Review",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Ars Technica AI": {
      "main": [
        [
          {
            "node": "Merge All Feeds",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "MIT Tech Review": {
      "main": [
        [
          {
            "node": "Merge All Feeds",
            "type": "main",
            "index": 3
          }
        ]
      ]
    },
    "Merge All Feeds": {
      "main": [
        [
          {
            "node": "Filter Recent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare for Cue": {
      "main": [
        [
          {
            "node": "Create Draft in Cue",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Recent Posts": {
      "main": [
        [
          {
            "node": "Trigger Feeds",
            "type": "main",
            "index": 0
          },
          {
            "node": "Collect Posted URLs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Daily 9am Trigger": {
      "main": [
        [
          {
            "node": "Get Recent Posts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Sheet Data": {
      "main": [
        [
          {
            "node": "Log to Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Standardize Fields": {
      "main": [
        [
          {
            "node": "Collect New Articles",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Write Social Posts": {
      "main": [
        [
          {
            "node": "Prepare for Cue",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Collect Posted URLs": {
      "main": [
        [
          {
            "node": "Compare Lists",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Create Draft in Cue": {
      "main": [
        [
          {
            "node": "Prepare Sheet Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Collect New Articles": {
      "main": [
        [
          {
            "node": "Compare Lists",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Select Random Article": {
      "main": [
        [
          {
            "node": "Write Social Posts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "triggerCount": 0
}