{
  "name": "AI News Bot Multi Message Final - SECURE",
  "nodes": [
    {
      "parameters": {
        "updates": [
          "message",
          "callback_query"
        ]
      },
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        250,
        400
      ],
      "typeVersion": 1,
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "// Router - b\u00fct\u00fcn mesajlar\u0131 y\u00f6nl\u0259ndir\nconst data = $json;\nlet output = {\n  action: 'unknown',\n  chatId: null,\n  userName: 'User',\n  callbackId: null,\n  messageId: null,\n  articleIndex: 0,\n  retryCount: 0\n};\n\ntry {\n  // Message\n  if (data.message) {\n    output.chatId = data.message.chat.id;\n    output.userName = data.message.from.first_name || 'User';\n    output.messageId = data.message.message_id;\n    \n    const text = data.message.text || '';\n    \n    if (text === '/start') {\n      output.action = 'start';\n    } else if (text === '/help') {\n      output.action = 'help';\n    } else {\n      output.action = 'unknown';\n    }\n  }\n  // Callback Query\n  else if (data.callback_query) {\n    output.chatId = data.callback_query.message.chat.id;\n    output.userName = data.callback_query.from.first_name || 'User';\n    output.callbackId = data.callback_query.id;\n    output.messageId = data.callback_query.message.message_id;\n    \n    const cbData = data.callback_query.data;\n    \n    if (cbData.startsWith('read_')) {\n      output.action = 'read';\n      output.articleIndex = parseInt(cbData.split('_')[1]);\n    } else if (cbData.startsWith('level_')) {\n      const parts = cbData.split('_');\n      output.action = 'simplify';\n      output.level = parts[1];\n      output.articleIndex = parseInt(parts[2] || 0);\n    } else if (cbData === 'refresh' || cbData === 'back') {\n      output.action = 'start';\n    } else if (cbData === 'help') {\n      output.action = 'help';\n    }\n  }\n} catch (error) {\n  console.error('Router error:', error);\n  output.action = 'error';\n  output.error = error.message;\n}\n\nreturn { json: output };"
      },
      "name": "Router",
      "type": "n8n-nodes-base.code",
      "position": [
        450,
        400
      ],
      "typeVersion": 2
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{$json['action']}}",
              "value2": "start"
            }
          ]
        }
      },
      "name": "Start?",
      "type": "n8n-nodes-base.if",
      "position": [
        650,
        300
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "jsCode": "// Random Source Selector - Her d\u0259f\u0259 f\u0259rqli m\u0259nb\u0259 se\u00e7\nconst sources = [\n  // Technology News\n  'https://techcrunch.com/feed/',\n  'https://www.theverge.com/rss/index.xml',\n  'https://feeds.arstechnica.com/arstechnica/technology-lab',\n  'https://www.wired.com/feed/rss',\n  'https://www.engadget.com/rss.xml',\n  'https://gizmodo.com/rss',\n  'https://thenextweb.com/feed/',\n  'https://www.zdnet.com/news/rss.xml',\n  'https://venturebeat.com/feed/',\n  'https://www.cnet.com/rss/news/',\n  'https://feeds.feedburner.com/Mashable',\n  'https://www.androidauthority.com/feed/',\n  '9to5mac.com/feed/',\n  'https://www.macrumors.com/macrumors.xml',\n  'https://www.androidcentral.com/feed',\n  'https://www.tomsguide.com/feeds/all',\n  'https://www.digitaltrends.com/feed/',\n  // AI & Science\n  'https://www.artificialintelligence-news.com/feed/',\n  'https://www.sciencedaily.com/rss/computers_math.xml',\n  'https://spectrum.ieee.org/feeds/feed.rss',\n  'https://news.mit.edu/rss/feed',\n  'https://www.technologyreview.com/feed/',\n  // Business Tech\n  'https://feeds.bloomberg.com/technology/news.rss',\n  'https://feeds.reuters.com/reuters/technologyNews',\n  'https://www.businessinsider.com/tech/rss',\n  'https://fortune.com/feed/',\n  // Developer News\n  'https://news.ycombinator.com/rss',\n  'https://dev.to/feed',\n  'https://stackoverflow.blog/feed/',\n  'https://github.blog/feed/'\n];\n\n// Rastgele m\u0259nb\u0259l\u0259r se\u00e7 (3-5 f\u0259rqli m\u0259nb\u0259)\nconst numSources = Math.floor(Math.random() * 3) + 3; // 3-5 aras\u0131\nconst selectedSources = [];\nconst usedIndices = new Set();\n\nwhile (selectedSources.length < numSources && selectedSources.length < sources.length) {\n  const randomIndex = Math.floor(Math.random() * sources.length);\n  if (!usedIndices.has(randomIndex)) {\n    usedIndices.add(randomIndex);\n    selectedSources.push(sources[randomIndex]);\n  }\n}\n\nconsole.log(`Selected ${selectedSources.length} sources for this refresh`);\n\n// Return selected sources\nreturn selectedSources.map(source => ({\n  json: { \n    url: source,\n    sourceName: source.split('/')[2] // Domain ad\u0131\n  }\n}));"
      },
      "name": "Source Selector",
      "type": "n8n-nodes-base.code",
      "position": [
        850,
        200
      ],
      "typeVersion": 2
    },
    {
      "parameters": {
        "url": "={{$json.url}}",
        "options": {
          "timeout": 3000,
          "allowUnauthorizedCerts": true,
          "ignoreResponseCode": true
        }
      },
      "name": "Multi RSS Feed",
      "type": "n8n-nodes-base.rssFeedRead",
      "position": [
        1050,
        200
      ],
      "typeVersion": 1,
      "continueOnFail": true
    },
    {
      "parameters": {
        "jsCode": "// Combine and deduplicate all feeds\nconst allArticles = [];\nconst seenTitles = new Set();\nconst seenUrls = new Set();\n\n// B\u00fct\u00fcn m\u0259qal\u0259l\u0259ri topla\n$input.all().forEach(item => {\n  const article = item.json;\n  \n  // Skip if error or no content\n  if (!article || !article.title || article.error) {\n    return;\n  }\n  \n  // Deduplicate by title and URL\n  const titleKey = article.title.toLowerCase().trim();\n  const urlKey = article.link || article.guid || '';\n  \n  if (!seenTitles.has(titleKey) && !seenUrls.has(urlKey)) {\n    seenTitles.add(titleKey);\n    seenUrls.add(urlKey);\n    \n    // Source domain \u0259lav\u0259 et\n    if (article.link) {\n      try {\n        const url = new URL(article.link);\n        article.source = url.hostname.replace('www.', '');\n      } catch (e) {\n        article.source = 'Unknown';\n      }\n    }\n    \n    // Tarix d\u00fcz\u0259lt\n    if (!article.isoDate && article.pubDate) {\n      article.isoDate = article.pubDate;\n    }\n    if (!article.isoDate) {\n      article.isoDate = new Date().toISOString();\n    }\n    \n    allArticles.push(article);\n  }\n});\n\n// Tarix\u0259 g\u00f6r\u0259 s\u0131rala (\u0259n yeni \u0259vv\u0259l)\nallArticles.sort((a, b) => {\n  const dateA = new Date(a.isoDate || 0);\n  const dateB = new Date(b.isoDate || 0);\n  return dateB - dateA;\n});\n\n// M\u00fcxt\u0259lif m\u0259nb\u0259l\u0259rd\u0259n balansla\u015fd\u0131r\u0131lm\u0131\u015f se\u00e7im\nconst sourceCounts = {};\nconst balancedArticles = [];\nconst maxPerSource = 2;\n\n// \u018fvv\u0259l h\u0259r m\u0259nb\u0259d\u0259n 2 m\u0259qal\u0259\nallArticles.forEach(article => {\n  const source = article.source || 'unknown';\n  if (!sourceCounts[source]) {\n    sourceCounts[source] = 0;\n  }\n  \n  if (sourceCounts[source] < maxPerSource && balancedArticles.length < 10) {\n    sourceCounts[source]++;\n    balancedArticles.push(article);\n  }\n});\n\n// \u018fg\u0259r 5-d\u0259n az m\u0259qal\u0259 varsa, qalanlar\u0131 \u0259lav\u0259 et\nif (balancedArticles.length < 5) {\n  allArticles.forEach(article => {\n    if (!balancedArticles.includes(article) && balancedArticles.length < 5) {\n      balancedArticles.push(article);\n    }\n  });\n}\n\nconsole.log(`Found ${allArticles.length} unique articles from ${Object.keys(sourceCounts).length} sources`);\nconsole.log(`Selected ${balancedArticles.length} balanced articles`);\n\n// \u0130lk 5 m\u0259qal\u0259ni qaytar\u0131\nreturn balancedArticles.slice(0, 5).map(article => ({ json: article }));"
      },
      "name": "Combine & Filter",
      "type": "n8n-nodes-base.code",
      "position": [
        1250,
        200
      ],
      "typeVersion": 2
    },
    {
      "parameters": {
        "jsCode": "// Enhanced News menu with source info\nconst items = $input.all();\nconst routerData = $node[\"Router\"].json;\nconst chatId = routerData.chatId;\nconst userName = routerData.userName;\n\nlet message = `\ud83d\udc4b Salam ${userName}!\\n\\n\ud83d\udcf0 *Son Texnologiya X\u0259b\u0259rl\u0259ri:*\\n`;\nmessage += `\ud83d\udd04 _${items.length} f\u0259rqli m\u0259nb\u0259d\u0259n t\u0259z\u0259 x\u0259b\u0259rl\u0259r_\\n\\n`;\n\nconst buttons = [];\n\nif (items.length === 0) {\n  message = `\u26a0\ufe0f Hal-haz\u0131rda x\u0259b\u0259r yoxdur.\\n\\nBir az sonra yenid\u0259n c\u0259hd edin.`;\n  buttons.push([{\n    text: \"\ud83d\udd04 Yenil\u0259\",\n    callback_data: \"refresh\"\n  }]);\n} else {\n  items.forEach((item, index) => {\n    const article = item.json;\n    const title = article.title || 'Ba\u015fl\u0131qs\u0131z';\n    const source = article.source || 'Unknown';\n    const shortTitle = title.length > 50 ? title.substring(0, 47) + '...' : title;\n    \n    // Emoji for different sources\n    const sourceEmoji = {\n      'techcrunch.com': '\ud83d\udd34',\n      'theverge.com': '\ud83d\udfe3',\n      'arstechnica.com': '\ud83d\udfe0',\n      'wired.com': '\u26ab',\n      'engadget.com': '\ud83d\udd35',\n      'gizmodo.com': '\ud83d\udfe2',\n      'thenextweb.com': '\ud83d\udfe1',\n      'venturebeat.com': '\ud83d\udd37',\n      'cnet.com': '\ud83d\udd36',\n      'mashable.com': '\ud83d\udca0',\n      '9to5mac.com': '\ud83c\udf4e',\n      'androidauthority.com': '\ud83e\udd16',\n      'bloomberg.com': '\ud83d\udcb0',\n      'reuters.com': '\ud83d\udcca',\n      'news.ycombinator.com': '\ud83e\udde1',\n      'dev.to': '\ud83d\udc68\u200d\ud83d\udcbb',\n      'github.blog': '\ud83d\udc19',\n      'mit.edu': '\ud83c\udf93'\n    };\n    \n    const emoji = sourceEmoji[source] || '\ud83d\udccc';\n    \n    message += `${index + 1}. ${emoji} ${shortTitle}\\n`;\n    message += `   _${source}_\\n\\n`;\n    \n    buttons.push([{\n      text: `\ud83d\udcd6 Oxu ${index + 1}`,\n      callback_data: `read_${index}`\n    }]);\n  });\n  \n  message += `_X\u0259b\u0259ri se\u00e7in v\u0259 dil s\u0259viyy\u0259nizi t\u0259yin edin_`;\n  \n  buttons.push([\n    { text: \"\ud83d\udd04 Yeni x\u0259b\u0259rl\u0259r\", callback_data: \"refresh\" },\n    { text: \"\u2139\ufe0f K\u00f6m\u0259k\", callback_data: \"help\" }\n  ]);\n}\n\n// Statistika \u0259lav\u0259 et\nif (items.length > 0) {\n  const sources = [...new Set(items.map(i => i.json.source))].length;\n  message += `\\n\\n\ud83d\udcca _${sources} m\u00fcxt\u0259lif m\u0259nb\u0259_`;\n  message += `\\n\ud83d\udd11 _2 API key aktiv_`;\n  message += `\\n\ud83d\udce8 _3 mesajda g\u00f6nd\u0259rilir_`;\n}\n\nreturn {\n  json: {\n    chat_id: chatId,\n    text: message,\n    parse_mode: \"Markdown\",\n    reply_markup: JSON.stringify({ inline_keyboard: buttons })\n  }\n};"
      },
      "name": "Format Menu",
      "type": "n8n-nodes-base.code",
      "position": [
        1450,
        200
      ],
      "typeVersion": 2
    },
    {
      "parameters": {
        "method": "POST",
        "url": "=https://api.telegram.org/bot{{$credentials.telegramApi.telegramApiToken}}/sendMessage",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify($json) }}",
        "options": {
          "timeout": 5000
        }
      },
      "name": "Send Menu",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1650,
        200
      ],
      "typeVersion": 4.1,
      "continueOnFail": true
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{$json['action']}}",
              "value2": "read"
            }
          ]
        }
      },
      "name": "Read?",
      "type": "n8n-nodes-base.if",
      "position": [
        650,
        500
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "url": "https://techcrunch.com/feed/",
        "options": {
          "timeout": 5000
        }
      },
      "name": "Get Article",
      "type": "n8n-nodes-base.rssFeedRead",
      "position": [
        850,
        500
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "jsCode": "// Show article with level selection and source info\nconst routerData = $node[\"Router\"].json;\nconst articleIndex = routerData.articleIndex || 0;\nconst chatId = routerData.chatId;\nconst callbackId = routerData.callbackId;\n\nconst articles = $input.all();\nconst article = articles[articleIndex]?.json;\n\nif (!article) {\n  return {\n    json: {\n      callbackId: callbackId,\n      chatId: chatId,\n      preview: \"\u26a0\ufe0f X\u0259b\u0259r tap\u0131lmad\u0131. /start yazaraq yenid\u0259n ba\u015flay\u0131n.\",\n      keyboard: {\n        inline_keyboard: [[\n          { text: \"\ud83d\udd04 Yenid\u0259n ba\u015fla\", callback_data: \"refresh\" }\n        ]]\n      }\n    }\n  };\n}\n\n// Source emoji\nconst sourceEmoji = {\n  'techcrunch.com': '\ud83d\udd34 TechCrunch',\n  'theverge.com': '\ud83d\udfe3 The Verge',\n  'arstechnica.com': '\ud83d\udfe0 Ars Technica',\n  'wired.com': '\u26ab Wired',\n  'engadget.com': '\ud83d\udd35 Engadget',\n  'gizmodo.com': '\ud83d\udfe2 Gizmodo',\n  'thenextweb.com': '\ud83d\udfe1 TNW',\n  'venturebeat.com': '\ud83d\udd37 VentureBeat',\n  'bloomberg.com': '\ud83d\udcb0 Bloomberg',\n  'reuters.com': '\ud83d\udcca Reuters',\n  'mit.edu': '\ud83c\udf93 MIT News'\n};\n\nconst sourceDisplay = sourceEmoji[article.source] || `\ud83d\udccc ${article.source || 'Unknown'}`;\n\n// \u018fvv\u0259lc\u0259 orijinal x\u0259b\u0259ri g\u00f6st\u0259r\nconst preview = `\ud83d\udcf0 *${article.title}*\\n\\n` +\n  `\ud83d\udccd *M\u0259nb\u0259:* ${sourceDisplay}\\n` +\n  `\ud83d\udcc5 _${new Date(article.isoDate).toLocaleDateString('az-AZ')}_\\n\\n` +\n  `\ud83d\udcdd *Orijinal x\u00fclas\u0259:*\\n${article.contentSnippet || article.content || 'M\u0259zmun yoxdur'}\\n\\n` +\n  `\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\\n` +\n  `*\u0130ngilis dili s\u0259viyy\u0259nizi se\u00e7in:*\\n` +\n  `_M\u0259tn 3 ayr\u0131 mesajda g\u00f6nd\u0259ril\u0259c\u0259k_`;\n\n// S\u0259viyy\u0259 se\u00e7im d\u00fcym\u0259l\u0259ri\nconst keyboard = {\n  inline_keyboard: [\n    [\n      { text: \"\ud83d\udfe2 A1-A2 (Ba\u015flan\u011f\u0131c)\", callback_data: `level_A1_${articleIndex}` },\n      { text: \"\ud83d\udd35 B1-B2 (Orta)\", callback_data: `level_B1_${articleIndex}` }\n    ],\n    [\n      { text: \"\ud83d\udfe3 C1-C2 (Y\u00fcks\u0259k)\", callback_data: `level_C1_${articleIndex}` }\n    ],\n    [\n      { text: \"\ud83d\udd17 Orijinal Link\", url: article.link }\n    ],\n    [\n      { text: \"\u2b05\ufe0f Geri\", callback_data: \"back\" },\n      { text: \"\ud83d\udd04 Yeni x\u0259b\u0259rl\u0259r\", callback_data: \"refresh\" }\n    ]\n  ]\n};\n\nreturn {\n  json: {\n    callbackId: callbackId,\n    chatId: chatId,\n    preview: preview,\n    keyboard: keyboard\n  }\n};"
      },
      "name": "Show Article Preview",
      "type": "n8n-nodes-base.code",
      "position": [
        1050,
        500
      ],
      "typeVersion": 2
    },
    {
      "parameters": {
        "method": "POST",
        "url": "=https://api.telegram.org/bot{{$credentials.telegramApi.telegramApiToken}}/answerCallbackQuery",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({callback_query_id: $json.callbackId, text: 'X\u0259b\u0259r y\u00fckl\u0259nir...'}) }}",
        "options": {
          "timeout": 5000
        }
      },
      "name": "Answer Callback",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1250,
        450
      ],
      "typeVersion": 4.1,
      "continueOnFail": true
    },
    {
      "parameters": {
        "method": "POST",
        "url": "=https://api.telegram.org/bot{{$credentials.telegramApi.telegramApiToken}}/sendMessage",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({chat_id: $json.chatId, text: $json.preview, parse_mode: 'Markdown', disable_web_page_preview: true, reply_markup: JSON.stringify($json.keyboard)}) }}",
        "options": {
          "timeout": 5000
        }
      },
      "name": "Send Preview",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1250,
        550
      ],
      "typeVersion": 4.1,
      "continueOnFail": true
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{$json['action']}}",
              "value2": "simplify"
            }
          ]
        }
      },
      "name": "Simplify?",
      "type": "n8n-nodes-base.if",
      "position": [
        650,
        800
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "url": "https://techcrunch.com/feed/",
        "options": {
          "timeout": 5000
        }
      },
      "name": "Get Article for Simplify",
      "type": "n8n-nodes-base.rssFeedRead",
      "position": [
        850,
        800
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "jsCode": "// ENHANCED Prepare for simplification with API KEY ROTATION\nconst routerData = $node[\"Router\"].json;\nconst articleIndex = routerData.articleIndex || 0;\nconst level = routerData.level || 'B1';\nconst chatId = routerData.chatId;\nconst callbackId = routerData.callbackId;\n\nconst articles = $input.all();\nconst article = articles[articleIndex]?.json;\n\nif (!article) {\n  return {\n    json: {\n      error: true,\n      message: \"X\u0259b\u0259r tap\u0131lmad\u0131\",\n      chatId: chatId,\n      callbackId: callbackId\n    }\n  };\n}\n\n// MULTI API KEY SYSTEM - Environment Variables istifad\u0259 et\nconst apiKeys = [\n  $env.GEMINI_API_KEY_1,\n  $env.GEMINI_API_KEY_2\n];\n\n// API key rotation logic\nconst timestamp = Date.now();\nconst keyIndex = Math.floor(timestamp / 60000) % apiKeys.length; // H\u0259r d\u0259qiq\u0259 d\u0259yi\u015f\nconst selectedApiKey = apiKeys[keyIndex];\n\nconsole.log(`Using API key ${keyIndex + 1} of ${apiKeys.length}`);\n\n// S\u0259viyy\u0259 parametrl\u0259ri\nconst levelParams = {\n  'A1': {\n    wordCount: '150-200',\n    sentenceLength: '8-10',\n    vocabSize: '10-12',\n    grammar: 'only simple present and past tense',\n    complexity: 'very basic vocabulary (most common 1000 words)'\n  },\n  'B1': {\n    wordCount: '200-250',\n    sentenceLength: '10-15',\n    vocabSize: '12-15',\n    grammar: 'present, past, future tenses, some passive voice',\n    complexity: 'intermediate vocabulary (common 2500 words)'\n  },\n  'C1': {\n    wordCount: '250-300',\n    sentenceLength: '15-20',\n    vocabSize: '15-20',\n    grammar: 'all tenses, complex structures, idioms',\n    complexity: 'advanced vocabulary with explanations'\n  }\n};\n\nconst params = levelParams[level] || levelParams['B1'];\n\n// YEN\u0130 PROMPT - C\u00dcML\u018f-C\u00dcML\u018f T\u018fRC\u00dcM\u018f \u0130L\u018f\nconst prompt = `You are teaching English to Azerbaijani students through technology news. Create a detailed educational lesson for ${level} level.\n\nORIGINAL ARTICLE:\nTitle: ${article.title}\nSource: ${article.source || 'Technology News'}\nContent: ${(article.contentSnippet || article.content || 'No content').substring(0, 800)}\n\nCREATE A DETAILED LESSON WITH THESE EXACT SECTIONS:\n\n\ud83d\udcf0 **SIMPLIFIED ARTICLE** (${params.wordCount} words):\n- Write an engaging, clear title\n- Write a detailed summary in 3-4 paragraphs covering:\n  \u2022 What happened (main event/announcement)\n  \u2022 Who is involved (companies, people, countries)\n  \u2022 When and where it happened\n  \u2022 Why it's important for technology/society\n  \u2022 What might happen next/impact\n- Use ${params.sentenceLength} words per sentence\n- Grammar: ${params.grammar}\n- Vocabulary: ${params.complexity}\n\n\ud83d\udd24 **SENTENCE-BY-SENTENCE TRANSLATION**:\nTake EACH sentence from your simplified article above and provide:\n[English sentence]\n\ud83d\udd39 [Azerbaijani translation]\n\nFormat exactly like this example:\nThe company announced a new product yesterday.\n\ud83d\udd39 \u015eirk\u0259t d\u00fcn\u0259n yeni m\u0259hsul elan etdi.\n\nApple is working on artificial intelligence.\n\ud83d\udd39 Apple s\u00fcni intellekt \u00fcz\u0259rind\u0259 i\u015fl\u0259yir.\n\nDo this for EVERY sentence in your article.\n\n\ud83d\udcda **VOCABULARY SECTION** (${params.vocabSize} items):\nFormat EXACTLY like this for each item:\n\u2022 **[English word/phrase]** - [Azerbaijani translation] - [pronunciation if needed]\n\nInclude:\na) 5-6 single important words from the article\nb) 4-5 useful phrases or expressions like:\n   \u2022 **broke into the system** - sistem\u0259 s\u0131zd\u0131lar\n   \u2022 **data breach** - m\u0259lumat s\u0131zmas\u0131\n   \u2022 **cyber security** - kiber t\u0259hl\u00fck\u0259sizlik\nc) 2-3 technical terms with simple explanations\n\n\ud83d\udca1 **KEY PHRASES IN CONTEXT** (5 examples):\nFor each phrase show:\n- The phrase from the article\n- A new simple example sentence\n- Azerbaijani translation\n\nExample format:\n\u2022 **\"launched a new product\"**\n  Example: Apple launched a new iPhone yesterday.\n  Translation: Apple d\u00fcn\u0259n yeni iPhone t\u0259qdim etdi.\n\n\ud83c\udfaf **MAIN POINTS** (4 bullet points):\n- Write 4 key facts in very simple English\n- Each point should be one clear sentence\n- Help students remember the most important information\n\n\u2753 **COMPREHENSION CHECK** (3 questions):\nWrite 3 simple questions to test understanding:\n1. [Question] \u2192 Answer: [Short answer]\n2. [Question] \u2192 Answer: [Short answer]  \n3. [Question] \u2192 Answer: [Short answer]\n\n\ud83d\udd24 **GRAMMAR FOCUS**:\nExplain one grammar point from the article with an example.\n\nREMEMBER:\n- Make it educational and engaging\n- Use clear, simple language for the level\n- Include Azerbaijani translations for EVERY sentence\n- Focus on learning value\n- Keep mobile-friendly formatting`;\n\nreturn {\n  json: {\n    prompt: prompt,\n    article: article,\n    level: level,\n    chatId: chatId,\n    callbackId: callbackId,\n    articleIndex: articleIndex,\n    apiKey: selectedApiKey,\n    keyIndex: keyIndex\n  }\n};"
      },
      "name": "Prepare Simplification",
      "type": "n8n-nodes-base.code",
      "position": [
        1050,
        800
      ],
      "typeVersion": 2
    },
    {
      "parameters": {
        "amount": 2,
        "unit": "seconds"
      },
      "name": "Rate Limit Delay",
      "type": "n8n-nodes-base.wait",
      "position": [
        1150,
        800
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "method": "POST",
        "url": "=https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent?key={{$json.apiKey}}",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({\n  contents: [{\n    parts: [{\n      text: $json.prompt\n    }]\n  }],\n  generationConfig: {\n    temperature: 0.6,\n    maxOutputTokens: 3500,\n    topP: 0.95,\n    topK: 40\n  }\n}) }}",
        "options": {
          "timeout": 35000,
          "retry": {
            "maxTries": 2,
            "retryInterval": 5000
          }
        }
      },
      "name": "Gemini API Multi Key",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1250,
        800
      ],
      "typeVersion": 4.1,
      "continueOnFail": true
    },
    {
      "parameters": {
        "jsCode": "// SPLIT INTO 3 MESSAGES - NO TRUNCATION\nconst prevData = $node[\"Prepare Simplification\"].json;\nconst chatId = prevData.chatId;\nconst callbackId = prevData.callbackId;\nconst level = prevData.level;\nconst article = prevData.article;\nconst articleIndex = prevData.articleIndex;\nconst usedKeyIndex = prevData.keyIndex || 0;\n\n// Error check\nif (prevData.error) {\n  return {\n    json: {\n      chatId: chatId,\n      callbackId: callbackId,\n      message: \"\u26a0\ufe0f X\u0259b\u0259r tap\u0131lmad\u0131\",\n      messageType: \"error\"\n    }\n  };\n}\n\nlet fullText = '';\nlet hasError = false;\n\ntry {\n  const aiResponse = $json;\n  \n  // Success - AI cavab verdi\n  if (aiResponse.candidates && aiResponse.candidates[0] && aiResponse.candidates[0].content) {\n    fullText = aiResponse.candidates[0].content.parts[0].text;\n    console.log(`Successfully used API key ${usedKeyIndex + 1}`);\n  } \n  // Error handling\n  else if (aiResponse.error) {\n    hasError = true;\n    console.error('API error:', aiResponse.error);\n    fullText = createOfflineContent(article, level);\n  }\n  // No response\n  else {\n    hasError = true;\n    fullText = createOfflineContent(article, level);\n  }\n} catch (error) {\n  hasError = true;\n  console.error('Processing error:', error);\n  fullText = createOfflineContent(article, level);\n}\n\n// SPLIT CONTENT INTO 3 PARTS\nfunction splitIntoThreeParts(text, level, article) {\n  // Extract sections\n  const sections = {\n    english: text.match(/\ud83d\udcf0 \\*\\*SIMPLIFIED ARTICLE\\*\\*[\\s\\S]*?(?=\ud83d\udd24 \\*\\*SENTENCE-BY-SENTENCE|$)/i),\n    translation: text.match(/\ud83d\udd24 \\*\\*SENTENCE-BY-SENTENCE[\\s\\S]*?(?=\ud83d\udcda \\*\\*VOCABULARY|$)/i),\n    vocabulary: text.match(/\ud83d\udcda \\*\\*VOCABULARY[\\s\\S]*?(?=\ud83d\udca1 \\*\\*KEY PHRASES|$)/i),\n    phrases: text.match(/\ud83d\udca1 \\*\\*KEY PHRASES[\\s\\S]*?(?=\ud83c\udfaf \\*\\*MAIN POINTS|$)/i),\n    points: text.match(/\ud83c\udfaf \\*\\*MAIN POINTS[\\s\\S]*?(?=\u2753 \\*\\*COMPREHENSION|$)/i),\n    comprehension: text.match(/\u2753 \\*\\*COMPREHENSION[\\s\\S]*?(?=\ud83d\udd24 \\*\\*GRAMMAR|$)/i),\n    grammar: text.match(/\ud83d\udd24 \\*\\*GRAMMAR[\\s\\S]*/i)\n  };\n  \n  // Source emoji\n  const sourceEmoji = {\n    'techcrunch.com': '\ud83d\udd34',\n    'theverge.com': '\ud83d\udfe3',\n    'arstechnica.com': '\ud83d\udfe0',\n    'wired.com': '\u26ab',\n    'engadget.com': '\ud83d\udd35',\n    'gizmodo.com': '\ud83d\udfe2',\n    'thenextweb.com': '\ud83d\udfe1',\n    'venturebeat.com': '\ud83d\udd37',\n    'bloomberg.com': '\ud83d\udcb0',\n    'reuters.com': '\ud83d\udcca',\n    'mit.edu': '\ud83c\udf93'\n  };\n  \n  const sourceIcon = sourceEmoji[article.source] || '\ud83d\udccc';\n  \n  // Level info\n  const levelEmoji = { 'A1': '\ud83d\udfe2', 'B1': '\ud83d\udd35', 'C1': '\ud83d\udfe3' };\n  const levelName = { 'A1': 'Ba\u015flan\u011f\u0131c', 'B1': 'Orta', 'C1': 'Y\u00fcks\u0259k' };\n  \n  // HEADER\n  const header = `${levelEmoji[level]} **${level} S\u0259viyy\u0259si - ${levelName[level]}**\\n` +\n    `${sourceIcon} _M\u0259nb\u0259: ${article.source || 'Unknown'}_\\n` +\n    `\ud83d\udd11 _API Key ${usedKeyIndex + 1} istifad\u0259 edildi_\\n` +\n    `\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\\n\\n`;\n  \n  // MESSAGE 1: ENGLISH + TRANSLATION\n  let message1 = header +\n    `\ud83d\udcd6 **ENGLISH VERSION**\\n` +\n    `\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\\n`;\n  \n  if (sections.english) {\n    message1 += sections.english[0] + '\\n\\n';\n  }\n  \n  message1 += `\\n\ud83d\udd24 **AZ\u018fRBAYCAN T\u018fRC\u00dcM\u018fS\u0130**\\n` +\n    `\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\\n`;\n  \n  if (sections.translation) {\n    message1 += sections.translation[0].replace('\ud83d\udd24 **SENTENCE-BY-SENTENCE TRANSLATION**:', '');\n  }\n  \n  message1 += `\\n\\n_\u27a1\ufe0f Vocabulary v\u0259 phrases n\u00f6vb\u0259ti mesajda..._`;\n  \n  // MESSAGE 2: VOCABULARY + PHRASES\n  let message2 = `\ud83d\udcda **VOCABULARY V\u018f PHRASES**\\n` +\n    `\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\\n\\n`;\n  \n  if (sections.vocabulary) {\n    message2 += sections.vocabulary[0] + '\\n\\n';\n  }\n  \n  if (sections.phrases) {\n    message2 += sections.phrases[0] + '\\n\\n';\n  }\n  \n  message2 += `_\u27a1\ufe0f \u018fsas m\u0259qamlar v\u0259 testl\u0259r n\u00f6vb\u0259ti mesajda..._`;\n  \n  // MESSAGE 3: POINTS + COMPREHENSION + GRAMMAR\n  let message3 = `\ud83d\udcdd **\u018fSAS M\u018fQAMLAR V\u018f TESTL\u018fR**\\n` +\n    `\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\\n\\n`;\n  \n  if (sections.points) {\n    message3 += sections.points[0] + '\\n\\n';\n  }\n  \n  if (sections.comprehension) {\n    message3 += sections.comprehension[0] + '\\n\\n';\n  }\n  \n  if (sections.grammar) {\n    message3 += sections.grammar[0] + '\\n\\n';\n  }\n  \n  // Footer only in last message\n  const footer = `\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\\n` +\n    `\ud83d\udcc5 _${new Date(article.isoDate).toLocaleDateString('az-AZ', {\n      weekday: 'long',\n      year: 'numeric',\n      month: 'long',\n      day: 'numeric'\n    })}_\\n` +\n    `\ud83d\udd17 [Orijinal m\u0259qal\u0259](${article.link})\\n` +\n    `${hasError ? '\u26a0\ufe0f _Offline rejim_' : '\u2705 _AI il\u0259 sad\u0259l\u0259\u015fdirildi_'}`;\n  \n  message3 += '\\n' + footer;\n  \n  return [message1, message2, message3];\n}\n\n// Offline content function\nfunction createOfflineContent(article, level) {\n  const title = article.title || 'Technology News';\n  const content = (article.contentSnippet || article.content || 'No content').substring(0, 300);\n  const source = article.source || 'Unknown';\n  \n  const levelContent = {\n    'A1': {\n      english: `This is technology news from ${source}. It is important. Many people use technology.`,\n      translation: `Bu ${source} sayt\u0131ndan texnologiya x\u0259b\u0259ridir. Bu vacibdir. \u00c7ox insan texnologiya istifad\u0259 edir.`,\n      vocab: '\u2022 **technology** - texnologiya\\n\u2022 **computer** - komp\u00fcter\\n\u2022 **internet** - internet'\n    },\n    'B1': {\n      english: `This article from ${source} discusses new technology developments. Companies are creating better systems.`,\n      translation: `${source} sayt\u0131ndan olan bu m\u0259qal\u0259 yeni texnologiya inki\u015faflar\u0131n\u0131 m\u00fczakir\u0259 edir. \u015eirk\u0259tl\u0259r daha yax\u015f\u0131 sisteml\u0259r yarad\u0131r.`,\n      vocab: '\u2022 **development** - inki\u015faf\\n\u2022 **system** - sistem\\n\u2022 **security** - t\u0259hl\u00fck\u0259sizlik'\n    },\n    'C1': {\n      english: `This article from ${source} explores sophisticated technological advancements.`,\n      translation: `${source} sayt\u0131ndan olan bu m\u0259qal\u0259 m\u00fcr\u0259kk\u0259b texnoloji ir\u0259lil\u0259yi\u015fl\u0259ri ara\u015fd\u0131r\u0131r.`,\n      vocab: '\u2022 **sophisticated** - m\u00fcr\u0259kk\u0259b\\n\u2022 **advancement** - ir\u0259lil\u0259yi\u015f\\n\u2022 **infrastructure** - infrastruktur'\n    }\n  };\n  \n  const current = levelContent[level] || levelContent['B1'];\n  return `\ud83d\udcf0 **${title}**\\n\\n${current.english}\\n\\n${current.translation}\\n\\n${current.vocab}`;\n}\n\n// Split messages\nconst messages = splitIntoThreeParts(fullText, level, article);\n\n// Keyboard (only in last message)\nconst keyboard = {\n  inline_keyboard: [\n    [\n      { text: \"\ud83d\udfe2 A1 Ver\", callback_data: `level_A1_${articleIndex}` },\n      { text: \"\ud83d\udd35 B1 Ver\", callback_data: `level_B1_${articleIndex}` },\n      { text: \"\ud83d\udfe3 C1 Ver\", callback_data: `level_C1_${articleIndex}` }\n    ],\n    hasError ? [\n      { text: \"\ud83d\udd04 Yenid\u0259n c\u0259hd et\", callback_data: `level_${level}_${articleIndex}` }\n    ] : [],\n    [\n      { text: \"\u2b05\ufe0f X\u0259b\u0259rl\u0259r\u0259 qay\u0131t\", callback_data: \"back\" },\n      { text: \"\ud83d\udd04 Yeni x\u0259b\u0259rl\u0259r\", callback_data: \"refresh\" }\n    ]\n  ].filter(row => row.length > 0)\n};\n\n// Return 3 messages\nreturn [\n  {\n    json: {\n      chatId: chatId,\n      callbackId: callbackId,\n      message: messages[0],\n      messageType: \"part1\"\n    }\n  },\n  {\n    json: {\n      chatId: chatId,\n      message: messages[1],\n      messageType: \"part2\"\n    }\n  },\n  {\n    json: {\n      chatId: chatId,\n      message: messages[2],\n      messageType: \"part3\",\n      keyboard: keyboard\n    }\n  }\n];"
      },
      "name": "Format Simplified",
      "type": "n8n-nodes-base.code",
      "position": [
        1450,
        800
      ],
      "typeVersion": 2
    },
    {
      "parameters": {
        "method": "POST",
        "url": "=https://api.telegram.org/bot{{$credentials.telegramApi.telegramApiToken}}/answerCallbackQuery",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({callback_query_id: $json.callbackId, text: 'Sad\u0259l\u0259\u015fdirildi! 3 mesajda g\u00f6nd\u0259rilir... \u2705'}) }}",
        "options": {
          "timeout": 5000
        }
      },
      "name": "Answer Simplify",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1650,
        750
      ],
      "typeVersion": 4.1,
      "continueOnFail": true
    },
    {
      "parameters": {
        "method": "POST",
        "url": "=https://api.telegram.org/bot{{$credentials.telegramApi.telegramApiToken}}/sendMessage",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({chat_id: $json.chatId, text: $json.message, parse_mode: 'Markdown', disable_web_page_preview: false}) }}",
        "options": {
          "timeout": 5000
        }
      },
      "name": "Send Part 1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1650,
        850
      ],
      "typeVersion": 4.1,
      "continueOnFail": true
    },
    {
      "parameters": {
        "amount": 1,
        "unit": "seconds"
      },
      "name": "Wait 1",
      "type": "n8n-nodes-base.wait",
      "position": [
        1850,
        850
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "method": "POST",
        "url": "=https://api.telegram.org/bot{{$credentials.telegramApi.telegramApiToken}}/sendMessage",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({chat_id: $node[\"Format Simplified\"].json[1].chatId, text: $node[\"Format Simplified\"].json[1].message, parse_mode: 'Markdown', disable_web_page_preview: false}) }}",
        "options": {
          "timeout": 5000
        }
      },
      "name": "Send Part 2",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2050,
        850
      ],
      "typeVersion": 4.1,
      "continueOnFail": true
    },
    {
      "parameters": {
        "amount": 1,
        "unit": "seconds"
      },
      "name": "Wait 2",
      "type": "n8n-nodes-base.wait",
      "position": [
        2250,
        850
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "method": "POST",
        "url": "=https://api.telegram.org/bot{{$credentials.telegramApi.telegramApiToken}}/sendMessage",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({chat_id: $node[\"Format Simplified\"].json[2].chatId, text: $node[\"Format Simplified\"].json[2].message, parse_mode: 'Markdown', disable_web_page_preview: false, reply_markup: JSON.stringify($node[\"Format Simplified\"].json[2].keyboard)}) }}",
        "options": {
          "timeout": 5000
        }
      },
      "name": "Send Part 3",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2450,
        850
      ],
      "typeVersion": 4.1,
      "continueOnFail": true
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{$json['action']}}",
              "value2": "help"
            }
          ]
        }
      },
      "name": "Help?",
      "type": "n8n-nodes-base.if",
      "position": [
        650,
        1000
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "jsCode": "// Enhanced Help message with 3-message info\nconst routerData = $node[\"Router\"].json;\nconst chatId = routerData.chatId;\n\nconst helpText = `\u2139\ufe0f **Bot T\u0259limatlar\u0131**\\n\\n` +\n  `\ud83d\udccc **Komandalar:**\\n` +\n  `\u2022 /start - Son x\u0259b\u0259rl\u0259ri g\u00f6st\u0259r\\n` +\n  `\u2022 /help - Bu k\u00f6m\u0259k mesaj\u0131\\n\\n` +\n  `\ud83c\udfaf **Nec\u0259 i\u015fl\u0259yir:**\\n` +\n  `1. /start yaz\u0131n\\n` +\n  `2. X\u0259b\u0259r se\u00e7in (1-5)\\n` +\n  `3. \u0130ngilis s\u0259viyy\u0259nizi se\u00e7in:\\n` +\n  `   \ud83d\udfe2 A1-A2: Ba\u015flan\u011f\u0131c (150-200 s\u00f6z)\\n` +\n  `   \ud83d\udd35 B1-B2: Orta (200-250 s\u00f6z)\\n` +\n  `   \ud83d\udfe3 C1-C2: Y\u00fcks\u0259k (250-300 s\u00f6z)\\n` +\n  `4. AI x\u0259b\u0259ri sad\u0259l\u0259\u015fdir\u0259c\u0259k\\n\\n` +\n  `\ud83d\udce8 **3 Mesajda G\u00f6nd\u0259rilir:**\\n` +\n  `\u2022 Mesaj 1: \u0130ngilis m\u0259tn + T\u0259rc\u00fcm\u0259\\n` +\n  `\u2022 Mesaj 2: Vocabulary + Phrases\\n` +\n  `\u2022 Mesaj 3: \u018fsas m\u0259qamlar + Testl\u0259r\\n` +\n  `\u2022 He\u00e7 bir m\u0259tn q\u0131sald\u0131lm\u0131r!\\n\\n` +\n  `\ud83d\udd11 **API Key Sistemi:**\\n` +\n  `\u2022 2 API key aktiv\\n` +\n  `\u2022 Avtomatik key rotation\\n` +\n  `\u2022 Rate limit qar\u015f\u0131s\u0131n\u0131 al\u0131r\\n` +\n  `\u2022 Daha stabil performans\\n\\n` +\n  `\ud83d\udcf0 **X\u0259b\u0259r M\u0259nb\u0259l\u0259ri (30+):**\\n` +\n  `\u2022 TechCrunch, The Verge, Wired\\n` +\n  `\u2022 Ars Technica, Engadget, Gizmodo\\n` +\n  `\u2022 Bloomberg Tech, Reuters Tech\\n` +\n  `\u2022 MIT News, IEEE Spectrum\\n` +\n  `\u2022 Hacker News, Dev.to, GitHub Blog\\n` +\n  `\u2022 v\u0259 dig\u0259r texnologiya saytlar\u0131\\n\\n` +\n  `\ud83d\udca1 **X\u00fcsusiyy\u0259tl\u0259r:**\\n` +\n  `\u2022 \ud83d\udd04 H\u0259r \"Yenil\u0259\" - f\u0259rqli x\u0259b\u0259rl\u0259r\\n` +\n  `\u2022 \ud83d\udcd6 Tam ingilis m\u0259tn (q\u0131sald\u0131lmam\u0131\u015f)\\n` +\n  `\u2022 \ud83d\udd24 C\u00fcml\u0259-c\u00fcml\u0259 t\u0259rc\u00fcm\u0259\\n` +\n  `\u2022 \ud83d\udcda 10-20 s\u00f6z v\u0259 ifad\u0259 t\u0259rc\u00fcm\u0259si\\n` +\n  `\u2022 \ud83d\udca1 C\u00fcml\u0259d\u0259 istifad\u0259 n\u00fcmun\u0259l\u0259ri\\n` +\n  `\u2022 \ud83c\udfaf \u018fsas m\u0259qamlar\u0131n x\u00fclas\u0259si\\n` +\n  `\u2022 \u2753 Anlama test suallar\u0131\\n` +\n  `\u2022 \ud83d\udd24 Qrammatika izahlar\u0131\\n` +\n  `\u2022 \ud83d\udccd M\u0259nb\u0259 g\u00f6st\u0259ricisi\\n` +\n  `\u2022 \ud83d\udd11 Multi API key d\u0259st\u0259yi\\n` +\n  `\u2022 \ud83d\udce8 3 ayr\u0131 mesajda g\u00f6nd\u0259rm\u0259\\n\\n` +\n  `\ud83d\udcca **S\u0259viyy\u0259 f\u0259rql\u0259ri:**\\n` +\n  `\u2022 A1: \u00c7ox sad\u0259 dil, \u0259sas zamanlar\\n` +\n  `\u2022 B1: Orta m\u00fcr\u0259kk\u0259blik, m\u00fcxt\u0259lif zamanlar\\n` +\n  `\u2022 C1: M\u00fcr\u0259kk\u0259b strukturlar, idiomlar\\n\\n` +\n  `\u26a0\ufe0f **Server y\u00fckl\u00fc olduqda:**\\n` +\n  `\u2022 Bot avtomatik dig\u0259r API key'\u0259 ke\u00e7ir\\n` +\n  `\u2022 Offline rejim aktivl\u0259\u015fir\\n` +\n  `\u2022 \u018fsas m\u0259zmun g\u00f6st\u0259rilir\\n\\n` +\n  `_Bot version 7.0 - No Truncation_\\n` +\n  `_Powered by Gemini AI_\\n` +\n  `_30+ x\u0259b\u0259r m\u0259nb\u0259yi_\\n` +\n  `_2 API key aktiv_\\n` +\n  `_3 mesajda tam m\u0259tn_`;\n\nreturn {\n  json: {\n    chat_id: chatId,\n    text: helpText,\n    parse_mode: \"Markdown\"\n  }\n};"
      },
      "name": "Help Message",
      "type": "n8n-nodes-base.code",
      "position": [
        850,
        1000
      ],
      "typeVersion": 2
    },
    {
      "parameters": {
        "method": "POST",
        "url": "=https://api.telegram.org/bot{{$credentials.telegramApi.telegramApiToken}}/sendMessage",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify($json) }}",
        "options": {
          "timeout": 5000
        }
      },
      "name": "Send Help",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1050,
        1000
      ],
      "typeVersion": 4.1,
      "continueOnFail": true
    }
  ],
  "connections": {
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Router",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Router": {
      "main": [
        [
          {
            "node": "Start?",
            "type": "main",
            "index": 0
          },
          {
            "node": "Read?",
            "type": "main",
            "index": 0
          },
          {
            "node": "Simplify?",
            "type": "main",
            "index": 0
          },
          {
            "node": "Help?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Start?": {
      "main": [
        [
          {
            "node": "Source Selector",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Source Selector": {
      "main": [
        [
          {
            "node": "Multi RSS Feed",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Multi RSS Feed": {
      "main": [
        [
          {
            "node": "Combine & Filter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Combine & Filter": {
      "main": [
        [
          {
            "node": "Format Menu",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Menu": {
      "main": [
        [
          {
            "node": "Send Menu",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read?": {
      "main": [
        [
          {
            "node": "Get Article",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Article": {
      "main": [
        [
          {
            "node": "Show Article Preview",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Show Article Preview": {
      "main": [
        [
          {
            "node": "Answer Callback",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send Preview",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simplify?": {
      "main": [
        [
          {
            "node": "Get Article for Simplify",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Article for Simplify": {
      "main": [
        [
          {
            "node": "Prepare Simplification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Simplification": {
      "main": [
        [
          {
            "node": "Rate Limit Delay",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Rate Limit Delay": {
      "main": [
        [
          {
            "node": "Gemini API Multi Key",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gemini API Multi Key": {
      "main": [
        [
          {
            "node": "Format Simplified",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Simplified": {
      "main": [
        [
          {
            "node": "Answer Simplify",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send Part 1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Part 1": {
      "main": [
        [
          {
            "node": "Wait 1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 1": {
      "main": [
        [
          {
            "node": "Send Part 2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Part 2": {
      "main": [
        [
          {
            "node": "Wait 2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 2": {
      "main": [
        [
          {
            "node": "Send Part 3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Help?": {
      "main": [
        [
          {
            "node": "Help Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Help Message": {
      "main": [
        [
          {
            "node": "Send Help",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}