{
    "name": "Beeznez starter: source monitor with a short summary",
    "nodes": [
        {
            "parameters": {
                "content": "## Source monitor\n**Untested starter** from Beeznez Tech. Not run in production.\n\n1. Put an official source RSS feed in the RSS node.\n2. The Keep-only-new node remembers what it has seen while the workflow is active, and passes at most 10 new items per run. That is your daily cost cap.\n3. Set your AI API key and model name.\n4. Add SMTP credentials and your addresses.\nA summary is a pointer to the source. Read the original before you rely on it.\n\nKeep a person in the loop before anything reaches a customer.",
                "height": 320,
                "width": 380
            },
            "id": "b4943569-6883-477f-8828-2aecb423f476",
            "name": "READ ME",
            "type": "n8n-nodes-base.stickyNote",
            "typeVersion": 1,
            "position": [
                -420,
                -40
            ]
        },
        {
            "parameters": {
                "rule": {
                    "interval": [
                        {
                            "field": "days",
                            "daysInterval": 1,
                            "triggerAtHour": 7,
                            "triggerAtMinute": 0
                        }
                    ]
                }
            },
            "id": "c51349c0-faa4-4b0c-8c2a-057a865d387a",
            "name": "Every day at 7",
            "type": "n8n-nodes-base.scheduleTrigger",
            "typeVersion": 1.2,
            "position": [
                -20,
                200
            ]
        },
        {
            "parameters": {
                "url": "https://example.com/feed",
                "options": []
            },
            "id": "63f685a3-684f-4854-9073-4a3dbeaac8c6",
            "name": "Read RSS feed",
            "type": "n8n-nodes-base.rssFeedRead",
            "typeVersion": 1.1,
            "position": [
                200,
                200
            ]
        },
        {
            "parameters": {
                "jsCode": "const store = $getWorkflowStaticData('global');\nstore.seen = store.seen || [];\nconst fresh = [];\nfor (const item of $input.all()) {\n  const id = item.json.guid || item.json.link;\n  if (!id || store.seen.includes(id)) { continue; }\n  store.seen.push(id);\n  fresh.push({ json: { id, title: item.json.title || '', link: item.json.link } });\n  if (fresh.length >= 10) { break; }\n}\nstore.seen = store.seen.slice(-500);\nreturn fresh;"
            },
            "id": "f07a2622-63af-4cf4-b729-00ecff6b48da",
            "name": "Keep only new items (max 10)",
            "type": "n8n-nodes-base.code",
            "typeVersion": 2,
            "position": [
                420,
                200
            ]
        },
        {
            "parameters": {
                "url": "={{ $json.link }}",
                "options": {
                    "timeout": 30000,
                    "response": {
                        "response": {
                            "responseFormat": "text",
                            "outputPropertyName": "data"
                        }
                    }
                }
            },
            "id": "fd152a4e-e024-42ab-9038-53ea4a5e0efe",
            "name": "Fetch the page",
            "type": "n8n-nodes-base.httpRequest",
            "typeVersion": 4.2,
            "position": [
                640,
                200
            ],
            "onError": "continueRegularOutput"
        },
        {
            "parameters": {
                "jsCode": "const src = $('Keep only new items (max 10)').item.json;\nconst html = typeof $json.data === 'string' ? $json.data : '';\nconst text = html\n  .replace(/<script[\\s\\S]*?<\\/script>/gi, ' ')\n  .replace(/<style[\\s\\S]*?<\\/style>/gi, ' ')\n  .replace(/<[^>]+>/g, ' ')\n  .replace(/\\s+/g, ' ')\n  .trim()\n  .slice(0, 6000);\nreturn { json: { title: src.title, link: src.link, text } };",
                "mode": "runOnceForEachItem"
            },
            "id": "d88dfcc5-2bc4-4ce8-a602-500dd4a1745e",
            "name": "Clean page text",
            "type": "n8n-nodes-base.code",
            "typeVersion": 2,
            "position": [
                860,
                200
            ]
        },
        {
            "parameters": {
                "method": "POST",
                "url": "https://api.openai.com/v1/chat/completions",
                "sendHeaders": true,
                "headerParameters": {
                    "parameters": [
                        {
                            "name": "Authorization",
                            "value": "Bearer YOUR_API_KEY"
                        },
                        {
                            "name": "Content-Type",
                            "value": "application/json"
                        }
                    ]
                },
                "sendBody": true,
                "specifyBody": "json",
                "jsonBody": "={{ JSON.stringify({ model: \"YOUR_MODEL\", temperature: 0, messages: [ { role: \"system\", content: \"Summarise the page text in three bullets. Then list up to three claims worth verifying against the original source. Use only the text provided. If the text is empty or looks like an error page, say so instead of guessing.\" }, { role: \"user\", content: \"Title: \" + $json.title + \"\\nText:\\n\" + $json.text } ] }) }}",
                "options": {
                    "timeout": 60000
                }
            },
            "id": "1ec7cd00-63ff-4d37-81cf-5f4e51765049",
            "name": "AI: summarise and list claims to check",
            "type": "n8n-nodes-base.httpRequest",
            "typeVersion": 4.2,
            "position": [
                1080,
                200
            ]
        },
        {
            "parameters": {
                "fromEmail": "you@example.com",
                "toEmail": "team@example.com",
                "subject": "=Source update: {{ $(\"Clean page text\").item.json.title }}",
                "emailFormat": "text",
                "text": "={{ $json.choices[0].message.content }}\n\nRead the original: {{ $(\"Clean page text\").item.json.link }}\n\nA summary is a pointer to the source, not the source.",
                "options": []
            },
            "id": "cf1853a6-9a0d-4bd3-beba-638e12969c02",
            "name": "Email the summary",
            "type": "n8n-nodes-base.emailSend",
            "typeVersion": 2.1,
            "position": [
                1320,
                200
            ]
        }
    ],
    "connections": {
        "Every day at 7": {
            "main": [
                [
                    {
                        "node": "Read RSS feed",
                        "type": "main",
                        "index": 0
                    }
                ]
            ]
        },
        "Read RSS feed": {
            "main": [
                [
                    {
                        "node": "Keep only new items (max 10)",
                        "type": "main",
                        "index": 0
                    }
                ]
            ]
        },
        "Keep only new items (max 10)": {
            "main": [
                [
                    {
                        "node": "Fetch the page",
                        "type": "main",
                        "index": 0
                    }
                ]
            ]
        },
        "Fetch the page": {
            "main": [
                [
                    {
                        "node": "Clean page text",
                        "type": "main",
                        "index": 0
                    }
                ]
            ]
        },
        "Clean page text": {
            "main": [
                [
                    {
                        "node": "AI: summarise and list claims to check",
                        "type": "main",
                        "index": 0
                    }
                ]
            ]
        },
        "AI: summarise and list claims to check": {
            "main": [
                [
                    {
                        "node": "Email the summary",
                        "type": "main",
                        "index": 0
                    }
                ]
            ]
        }
    },
    "active": false,
    "settings": {
        "executionOrder": "v1"
    },
    "tags": []
}