{
  "name": "AI Innovation Feed \u2192 Notion (Top 3 every 3 days)",
  "nodes": [
    {
      "id": "Cron_3Day",
      "name": "Every 3 Days @ 9:00 ET",
      "type": "n8n-nodes-base.cron",
      "typeVersion": 2,
      "position": [
        200,
        200
      ],
      "parameters": {
        "triggerTimes": {
          "item": [
            {
              "mode": "everyX",
              "everyX": 3,
              "unit": "days"
            }
          ]
        }
      },
      "notesInFlow": true,
      "notes": "Runs every 3 days. n8n server timezone should be America/New_York or adjust in your host."
    },
    {
      "id": "RSS_OpenAI",
      "name": "RSS: OpenAI",
      "type": "n8n-nodes-base.rssFeedRead",
      "typeVersion": 1,
      "position": [
        480,
        40
      ],
      "parameters": {
        "url": "https://openai.com/blog/rss.xml"
      }
    },
    {
      "id": "RSS_Anthropic",
      "name": "RSS: Anthropic",
      "type": "n8n-nodes-base.rssFeedRead",
      "typeVersion": 1,
      "position": [
        480,
        160
      ],
      "parameters": {
        "url": "https://www.anthropic.com/news/rss.xml"
      }
    },
    {
      "id": "RSS_GoogleAI",
      "name": "RSS: Google AI",
      "type": "n8n-nodes-base.rssFeedRead",
      "typeVersion": 1,
      "position": [
        480,
        280
      ],
      "parameters": {
        "url": "https://ai.googleblog.com/atom.xml"
      }
    },
    {
      "id": "RSS_HF",
      "name": "RSS: Hugging Face",
      "type": "n8n-nodes-base.rssFeedRead",
      "typeVersion": 1,
      "position": [
        480,
        400
      ],
      "parameters": {
        "url": "https://huggingface.co/blog/rss.xml"
      }
    },
    {
      "id": "RSS_arXiv",
      "name": "RSS: arXiv cs.AI",
      "type": "n8n-nodes-base.rssFeedRead",
      "typeVersion": 1,
      "position": [
        480,
        520
      ],
      "parameters": {
        "url": "https://export.arxiv.org/rss/cs.AI"
      }
    },
    {
      "id": "Merge_1",
      "name": "Merge Feeds (1)",
      "type": "n8n-nodes-base.merge",
      "typeVersion": 2,
      "position": [
        720,
        120
      ],
      "parameters": {
        "mode": "append"
      }
    },
    {
      "id": "Merge_2",
      "name": "Merge Feeds (2)",
      "type": "n8n-nodes-base.merge",
      "typeVersion": 2,
      "position": [
        920,
        200
      ],
      "parameters": {
        "mode": "append"
      }
    },
    {
      "id": "Merge_3",
      "name": "Merge Feeds (3)",
      "type": "n8n-nodes-base.merge",
      "typeVersion": 2,
      "position": [
        1120,
        280
      ],
      "parameters": {
        "mode": "append"
      }
    },
    {
      "id": "Merge_4",
      "name": "Merge Feeds (4)",
      "type": "n8n-nodes-base.merge",
      "typeVersion": 2,
      "position": [
        1320,
        360
      ],
      "parameters": {
        "mode": "append"
      }
    },
    {
      "id": "Fn_Normalize",
      "name": "Normalize Items",
      "type": "n8n-nodes-base.function",
      "typeVersion": 2,
      "position": [
        1540,
        360
      ],
      "parameters": {
        "functionCode": "const out = [];\nfor (const item of items) {\n  const i = item.json;\n  // n8n RSS node outputs fields like: title, link, content, isoDate, pubDate\n  out.push({\n    json: {\n      title: i.title || '',\n      link: i.link || i.guid || '',\n      content: i.content || i['content:encoded'] || i.summary || '',\n      pubDate: i.isoDate || i.pubDate || null,\n      source: i['feed']?.title || i.source || '',\n    }\n  })\n}\nreturn out;"
      }
    },
    {
      "id": "Fn_ScoreTop3",
      "name": "Score + Pick Top 3",
      "type": "n8n-nodes-base.function",
      "typeVersion": 2,
      "position": [
        1740,
        360
      ],
      "parameters": {
        "functionCode": "function daysAgo(d) {\n  if (!d) return 9999;\n  const dt = new Date(d);\n  return Math.floor((Date.now() - dt.getTime()) / (1000*60*60*24));\n}\nconst KEYWORDS = [\n  'rag','retrieval','agent','agents','agentic','workflow','automation','prompt','prompting','guardrails','eval','evaluation','langchain','langgraph','n8n','zapier','make','vertex','watsonx','openai','anthropic','google','hugging face','vector','embedding','faiss','chroma','pinecone','mcp','connector','tool use','function calling'\n];\nconst seen = new Set();\nconst scored = items.map(item => {\n  const j = item.json;\n  const age = daysAgo(j.pubDate);\n  const text = (j.title + ' ' + (j.content||'')).toLowerCase();\n  let relevance = 0;\n  for (const k of KEYWORDS) if (text.includes(k)) relevance += 1;\n  const recency = Math.max(0, 10 - age); // fresher is higher\n  const score = recency * 1.5 + relevance * 2.0;\n  return { ...j, age, score };\n}).filter(x => x.age <= 5); // only last ~5 days\n\n// dedupe by link/title\nconst dedup = [];\nfor (const x of scored) {\n  const key = (x.link||'') + '|' + (x.title||'');\n  if (!seen.has(key)) { seen.add(key); dedup.push(x); }\n}\n\ndedup.sort((a,b)=> b.score - a.score);\nreturn dedup.slice(0,3).map(j=>({json:j}));"
      }
    },
    {
      "id": "OpenAI_Researcher",
      "name": "OpenAI: Researcher \u2192 Outline",
      "type": "n8n-nodes-base.openAi",
      "typeVersion": 4,
      "position": [
        1960,
        300
      ],
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "parameters": {
        "resource": "chat",
        "operation": "createChatCompletion",
        "model": "gpt-4o-mini",
        "messages": "={{[\n  { role: 'system', content: 'You are a strict research analyst for an AI Automation Engineer. Produce a fact-grounded outline with citations. Do not hallucinate.' },\n  { role: 'user', content: `Create a structured outline for a short blog about this item. Use ONLY the info below and the linked page. Include: TL;DR bullets; What happened; Why it matters to automation/prompt engineers; How to use it (actionable steps/prompts); Risks/limits; Citations.\\n\\nTitle: ${$json.title}\\nURL: ${$json.link}\\nSnippet: ${($json.content||'').slice(0,1500)}` }\n]}}",
        "temperature": 0.2,
        "maxTokens": 800
      }
    },
    {
      "id": "OpenAI_Writer",
      "name": "OpenAI: Writer \u2192 Full Blog",
      "type": "n8n-nodes-base.openAi",
      "typeVersion": 4,
      "position": [
        2160,
        300
      ],
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "parameters": {
        "resource": "chat",
        "operation": "createChatCompletion",
        "model": "gpt-4o",
        "messages": "={{[\n  { role: 'system', content: 'You are a technical writer for Synth Alchemy. Write concise, actionable posts for AI automation & prompt engineers. Use short sentences. No fluff. Include citations with the source URL provided. American English.' },\n  { role: 'user', content: `Turn this outline into a 700\u20131000 word blog post. Use sections: Title, TL;DR, What happened, Why it matters for automation/prompt engineers, How to use it (steps/prompts), Caveats & limits, Sources. Add 1\u20132 specific prompts or workflow steps tailored to n8n/automation.\\n\\nOutline:\\n${$json.choices[0].message.content}` }\n]}}",
        "temperature": 0.3,
        "maxTokens": 1400
      }
    },
    {
      "id": "Fn_PackForNotion",
      "name": "Pack Fields for Notion",
      "type": "n8n-nodes-base.function",
      "typeVersion": 2,
      "position": [
        2360,
        300
      ],
      "parameters": {
        "functionCode": "const results = [];\nfor (const item of items) {\n  const blog = item.json.choices?.[0]?.message?.content || '';\n  const titleMatch = blog.match(/^\\s*#?\\s*(.+?)\\n/);\n  const title = titleMatch ? titleMatch[1].trim().slice(0, 200) : this.getNode().name + ' Post';\n  const sourceUrl = $item(0).$node[\"Fn_ScoreTop3\"].json.link || '';\n  const dateFound = new Date().toISOString();\n  // crude tags\n  const t = ($item(0).$node[\"Fn_ScoreTop3\"].json.title + ' ' + $item(0).$node[\"Fn_ScoreTop3\"].json.content).toLowerCase();\n  const tags = [];\n  const tagMap = ['RAG','Agents','Prompting','Automation','LangChain','n8n','Zapier','Make','Guardrails','Evals','LLM'];\n  const kwMap = ['rag','agent','prompt','automation','langchain','n8n','zapier','make','guardrail','eval','llm'];\n  kwMap.forEach((kw, idx)=>{ if (t.includes(kw)) tags.push(tagMap[idx]); });\n  results.push({ json: { title, blog, sourceUrl, dateFound, tags, relevance: 0, link: sourceUrl } });\n}\nreturn results;"
      }
    },
    {
      "id": "Notion_Create",
      "name": "Notion: Create Page",
      "type": "n8n-nodes-base.notion",
      "typeVersion": 2,
      "position": [
        2580,
        300
      ],
      "credentials": {
        "notionApi": {
          "name": "<your credential>"
        }
      },
      "parameters": {
        "resource": "databasePage",
        "operation": "create",
        "databaseId": "{{NOTION_DATABASE_ID}}",
        "propertiesUi": {
          "property": [
            {
              "key": "Title",
              "type": "title",
              "title": {
                "title": [
                  {
                    "text": {
                      "content": "={{$json.title}}"
                    }
                  }
                ]
              }
            },
            {
              "key": "Date Found",
              "type": "date",
              "date": {
                "date": {
                  "start": "={{$json.dateFound}}"
                }
              }
            },
            {
              "key": "Source URL",
              "type": "url",
              "url": "={{$json.sourceUrl}}"
            },
            {
              "key": "Tags",
              "type": "multiSelect",
              "multiSelect": {
                "multi_select": "={{$json.tags.map(t=>({name:t}))}}"
              }
            },
            {
              "key": "AI Relevance Score",
              "type": "number",
              "number": "={{$item(0).$node[\"Fn_ScoreTop3\"].json.score || 0}}"
            }
          ]
        },
        "blocksUi": {
          "block": [
            {
              "type": "heading_2",
              "heading_2": {
                "text": [
                  {
                    "type": "text",
                    "text": {
                      "content": "Blog Post"
                    }
                  }
                ]
              }
            },
            {
              "type": "paragraph",
              "paragraph": {
                "text": [
                  {
                    "type": "text",
                    "text": {
                      "content": "={{$json.blog}}"
                    }
                  }
                ]
              }
            }
          ]
        }
      }
    },
    {
      "id": "Split_Top3",
      "name": "Split Top 3 (Iterate)",
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 1,
      "position": [
        1880,
        360
      ],
      "parameters": {
        "batchSize": 1
      }
    }
  ],
  "connections": {
    "Every 3 Days @ 9:00 ET": {
      "main": [
        [
          {
            "node": "RSS: OpenAI",
            "type": "main",
            "index": 0
          },
          {
            "node": "RSS: Anthropic",
            "type": "main",
            "index": 0
          },
          {
            "node": "RSS: Google AI",
            "type": "main",
            "index": 0
          },
          {
            "node": "RSS: Hugging Face",
            "type": "main",
            "index": 0
          },
          {
            "node": "RSS: arXiv cs.AI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "RSS: OpenAI": {
      "main": [
        [
          {
            "node": "Merge Feeds (1)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "RSS: Anthropic": {
      "main": [
        [
          {
            "node": "Merge Feeds (1)",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Merge Feeds (1)": {
      "main": [
        [
          {
            "node": "Merge Feeds (2)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "RSS: Google AI": {
      "main": [
        [
          {
            "node": "Merge Feeds (2)",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Merge Feeds (2)": {
      "main": [
        [
          {
            "node": "Merge Feeds (3)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "RSS: Hugging Face": {
      "main": [
        [
          {
            "node": "Merge Feeds (3)",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Merge Feeds (3)": {
      "main": [
        [
          {
            "node": "Merge Feeds (4)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "RSS: arXiv cs.AI": {
      "main": [
        [
          {
            "node": "Merge Feeds (4)",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Merge Feeds (4)": {
      "main": [
        [
          {
            "node": "Normalize Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Items": {
      "main": [
        [
          {
            "node": "Score + Pick Top 3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Score + Pick Top 3": {
      "main": [
        [
          {
            "node": "Split Top 3 (Iterate)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Top 3 (Iterate)": {
      "main": [
        [
          {
            "node": "OpenAI: Researcher \u2192 Outline",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI: Researcher \u2192 Outline": {
      "main": [
        [
          {
            "node": "OpenAI: Writer \u2192 Full Blog",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI: Writer \u2192 Full Blog": {
      "main": [
        [
          {
            "node": "Pack Fields for Notion",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Pack Fields for Notion": {
      "main": [
        [
          {
            "node": "Notion: Create Page",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Notion: Create Page": {
      "main": [
        [
          {
            "node": "Split Top 3 (Iterate)",
            "type": "main",
            "index": 1
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "saveExecutionProgress": true,
    "executionOrder": "v1"
  },
  "version": 1
}