{
  "id": "LK8w6RitrC23KFoc",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Telegram Idea Capture \u2192 Claude \u2192 Notion",
  "tags": [
    {
      "id": "evmVKJiyqNiVHKMr",
      "name": "Idea Capture",
      "createdAt": "2026-04-23T15:51:36.326Z",
      "updatedAt": "2026-04-23T15:51:36.326Z"
    },
    {
      "id": "usoZFZbzTl3qbBC9",
      "name": "Aelaris",
      "createdAt": "2026-04-23T15:51:36.356Z",
      "updatedAt": "2026-04-23T15:51:36.356Z"
    }
  ],
  "nodes": [
    {
      "id": "e9676f04-c76d-4c72-a47b-1c8c54873612",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        1136,
        768
      ],
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "8b1dcfe5-4c09-46d2-aa4e-20ebba091189",
      "name": "Idea Classification",
      "type": "@n8n/n8n-nodes-langchain.anthropic",
      "position": [
        1376,
        768
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "claude-sonnet-4-6",
          "cachedResultName": "claude-sonnet-4-6"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=You are a content strategist for a creator in the AI + automation space.\n\nThe user has sent this idea: \"{{ $json.message.text }}\"\n\nYour job:\n1. Decide the BEST content format for this idea. Choose ONE: carousel, reel, or blog post.\n2. Choose the most relevant topic tag from this exact list:\n   ai-tools | automation | notion | n8n | content-strategy | build-in-public | hot-take | workflow | prompt-engineering | client-work\n3. Write 3 punchy hooks for that format.\n4. Write a content draft for each hook.\n\nRules for format selection:\n- carousel \u2192 if the idea is a process, list, or how-to\n- reel \u2192 if the idea is a single tip, story, or before/after\n- blog post \u2192 if the idea needs depth, nuance, or multiple sections\n\nRules for topic tag:\n- Pick ONE tag only\n- Use the exact string as written above\n- If nothing fits well, default to \"automation\"\n\nRules for hooks:\n- Lead with tension, not topic\n- Max 10 words\n- Peer-to-peer tone, not teacher tone\n- One hook per angle: problem, curiosity, contrarian\n\nRules for drafts:\n- Match the format (carousel draft = slide-by-slide outline, reel draft = script, blog post draft = section outline with key points)\n- Sharp, warm, unbothered tone\n- Write at 6th grade level\n- No jargon unless explained\n- Max 300 words per draft\n\nReturn ONLY valid JSON. No preamble, no markdown, no backticks.\n\n{\n  \"format\": \"carousel | reel | blog post\",\n  \"topic_tag\": \"one tag from the allowed list\",\n  \"hooks\": [\n    {\n      \"angle\": \"problem\",\n      \"hook\": \"...\",\n      \"draft\": \"...\"\n    },\n    {\n      \"angle\": \"curiosity\",\n      \"hook\": \"...\",\n      \"draft\": \"...\"\n    },\n    {\n      \"angle\": \"contrarian\",\n      \"hook\": \"...\",\n      \"draft\": \"...\"\n    }\n  ]\n}"
            }
          ]
        }
      },
      "credentials": {
        "anthropicApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "8a26d6b0-a08a-4d9d-afb0-bdf44edd9c1d",
      "name": "Parse Classification",
      "type": "n8n-nodes-base.code",
      "position": [
        1680,
        768
      ],
      "parameters": {
        "jsCode": "// Parse Claude's response and expose clean fields for the Notion node.\nconst item = $input.first().json;\n\n// Anthropic returns { content: [{ type: 'text', text: '...' }], ... }\nconst rawText = item?.content?.[0]?.text ?? '';\n\n// Extract JSON by finding the first { and last } \u2014 ignores whatever Claude wraps around it\nconst start = rawText.indexOf('{');\nconst end = rawText.lastIndexOf('}');\n\nif (start === -1 || end === -1) {\n  throw new Error(`Could not find JSON object in Claude response. Raw: ${rawText}`);\n}\n\nconst cleaned = rawText.slice(start, end + 1);\n\nlet parsed;\ntry {\n  parsed = JSON.parse(cleaned);\n} catch (err) {\n  throw new Error(`Claude did not return valid JSON. Raw: ${rawText}`);\n}\n\n// Validate format \u2014 fall back to 'carousel' if Claude ever drifts\nconst allowedFormats = ['carousel', 'reel', 'blog post'];\nconst format = allowedFormats.includes(parsed.format) ? parsed.format : 'carousel';\n\n// Validate topic tag \u2014 fall back to 'automation' if Claude ever drifts\nconst allowedTags = ['ai-tools', 'automation', 'notion', 'n8n', 'content-strategy', 'build-in-public', 'hot-take', 'workflow', 'prompt-engineering', 'client-work'];\nconst topic_tag = allowedTags.includes(parsed.topic_tag) ? parsed.topic_tag : 'automation';\n\n// Safely pull hooks \u2014 default to empty objects if Claude returns fewer than 3\nconst hooks = Array.isArray(parsed.hooks) ? parsed.hooks : [];\nconst h1 = hooks[0] || {};\nconst h2 = hooks[1] || {};\nconst h3 = hooks[2] || {};\n\n// Pull the original Telegram message back into scope\nconst original = $('Telegram Trigger').first().json.message;\n\nreturn [\n  {\n    json: {\n      format,\n      topic_tag,\n      hook_1: (h1.hook || '').slice(0, 300),\n      draft_1: h1.draft || '',\n      angle_1: h1.angle || 'problem',\n      hook_2: (h2.hook || '').slice(0, 300),\n      draft_2: h2.draft || '',\n      angle_2: h2.angle || 'curiosity',\n      hook_3: (h3.hook || '').slice(0, 300),\n      draft_3: h3.draft || '',\n      angle_3: h3.angle || 'contrarian',\n      original_text: original.text,\n      telegram_chat_id: original.chat.id,\n      captured_at: new Date().toISOString()\n    }\n  }\n];"
      },
      "typeVersion": 2
    },
    {
      "id": "c6370b4f-56a3-46a1-9d48-a3fc53b0fb85",
      "name": "Notion: Create Page",
      "type": "n8n-nodes-base.notion",
      "position": [
        1888,
        768
      ],
      "parameters": {
        "title": "={{ $json.original_text }}",
        "options": {},
        "resource": "databasePage",
        "databaseId": {
          "__rl": true,
          "mode": "id",
          "value": "",
          "cachedResultUrl": "",
          "cachedResultName": ""
        },
        "propertiesUi": {
          "propertyValues": [
            {},
            {},
            {},
            {},
            {},
            {},
            {},
            {},
            {}
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "e364f66c-eefc-4f4b-89d9-d955cbf0ce5a",
      "name": "Telegram: Confirm",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2128,
        768
      ],
      "parameters": {
        "text": "=\u2705 Idea captured.\n\nFormat: {{ $('Parse Classification').first().json.format }}\nTag: #{{ $('Parse Classification').first().json.topic_tag }}\n\nHook 1 ({{ $('Parse Classification').first().json.angle_1 }}):\n{{ $('Parse Classification').first().json.hook_1 }}\n\nHook 2 ({{ $('Parse Classification').first().json.angle_2 }}):\n{{ $('Parse Classification').first().json.hook_2 }}\n\nHook 3 ({{ $('Parse Classification').first().json.angle_3 }}):\n{{ $('Parse Classification').first().json.hook_3 }}\n\nFull drafts saved to Notion \ud83d\udc46",
        "chatId": "={{ $('Parse Classification').first().json.telegram_chat_id }}",
        "additionalFields": {
          "parse_mode": "Markdown"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "58275812-354e-404a-a2ad-96d5d67247f3",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1072,
        624
      ],
      "parameters": {
        "color": 7,
        "width": 272,
        "height": 320,
        "content": "## Initialize Workflow\n\nWorkflow starts after a message is sent into Telegram."
      },
      "typeVersion": 1
    },
    {
      "id": "2c79ee31-8996-4d32-b26b-1e14c3ef040c",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        416,
        624
      ],
      "parameters": {
        "width": 624,
        "height": 720,
        "content": "## Idea Capturing & Categorisation Workflow\n\n### How it works\nThis workflow helps you capture and categorise your ideas using telegram, claude and notion!\n\n@[youtube](yCyO9k7I5E0)\n\n\n### Setup steps\n- [ ] Set up a telegram bot via @BotFather\n- [ ] Set up Anthropic/Claude credentials for the idea classification node \n- [ ] Set up Notion credentials\n- [ ] Create Notion database\n\n### Customization\nYou can customize the idea classification and notion database into different categories that suit you better"
      },
      "typeVersion": 1
    },
    {
      "id": "05d3aabd-f1cb-4744-9ac8-dd8f84c1b7e0",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1360,
        624
      ],
      "parameters": {
        "color": 7,
        "width": 464,
        "height": 320,
        "content": "## Idea Classification & Parsing\n\nThis is where Claude reads your idea and decides the format + drafts the content"
      },
      "typeVersion": 1
    },
    {
      "id": "c0297ee2-258b-4f5d-a4ec-1acafaa4db50",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1840,
        624
      ],
      "parameters": {
        "color": 7,
        "width": 224,
        "height": 320,
        "content": "## Saved into Notion\nYour idea is now saved and categorised in Notion"
      },
      "typeVersion": 1
    },
    {
      "id": "d1f90a88-487c-4e1f-9165-56913b4e547d",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2080,
        624
      ],
      "parameters": {
        "color": 7,
        "width": 224,
        "height": 320,
        "content": "## Send Notification back\nyou get a confirmation back via telegram"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "executionOrder": "v1"
  },
  "versionId": "71eaa282-5b16-4b4b-bbf1-d5461ac168d3",
  "connections": {
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Idea Classification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Idea Classification": {
      "main": [
        [
          {
            "node": "Parse Classification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Notion: Create Page": {
      "main": [
        [
          {
            "node": "Telegram: Confirm",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Classification": {
      "main": [
        [
          {
            "node": "Notion: Create Page",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}