{
  "name": "دایرکت و کامنت هوشمند اینستاگرام (API رسمی متا + Gemini) — v2.0",
  "nodes": [
    {
      "parameters": {
        "content": "# 📘 دایرکت و کامنت هوشمند اینستاگرام — نسخه 2.0\nبا **API رسمی متا** (Instagram API with Instagram Login)\n\n## چه می‌کند؟\n- 💬 **دایرکت:** به پیام‌های مشتری با هوش مصنوعی (Gemini) جواب می‌دهد و گفتگو را به خاطر می‌سپارد\n- 📝 **کامنت → دایرکت:** زیر کامنت یک جواب کوتاه عمومی می‌گذارد و **جواب کامل را به دایرکت** همان شخص می‌فرستد\n- 🔑 **کلمه‌ی کلیدی:** مثلاً هر کس «قیمت» بنویسد، پیام آماده‌ی شما برایش می‌رود (بدون هوش مصنوعی)\n- 🖼 به عکس/ویس/استیکر یک پیام ثابت می‌دهد\n- 🛟 اگر هوش مصنوعی خطا داد، پیام پشتیبان می‌رود\n\n## مسیر کلی\n```\nوبهوک متا → ⚙️ تنظیمات → تأیید وبهوک؟\n   GET  → چک Verify Token → پاسخ challenge\n   POST → ✅ جواب فوری 200 → یکسان‌سازی رویدادها\n        → کلمه‌ی کلیدی یا رسانه؟ ── بله ───────────┐\n                                └─ نه → 🧠 AI Agent ┤→ ساخت پاسخ\n                                        → ارسال دایرکت + جواب عمومی کامنت\n```\n\n## اعتبارنامه‌ها\n| نوع | کجا | مقدار |\n|---|---|---|\n| Header Auth «Instagram Token» | Send DM و Public Reply | Name: `Authorization` · Value: `Bearer توکن_اینستاگرام` |\n| Google Gemini (PaLM) API | Gemini Chat Model | کلید Gemini |\n\n---\nطراحی و آموزش: **مرتضی عظیمی** — mortezaazimi.ir",
        "height": 1180,
        "width": 700,
        "color": 4
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -1500,
        -600
      ],
      "id": "bea4a17d-5266-48dc-83a3-a3d83f151812",
      "name": "📘 راهنمای کلی"
    },
    {
      "parameters": {
        "content": "## 1️⃣ تنظیمات (فقط همین گره را پر کنید)\n\n| فیلد | توضیح |\n|---|---|\n| `verifyToken` | یک رمز دلخواه؛ همین را در پنل متا هم وارد می‌کنید |\n| `replyToDMs` / `replyToComments` | روشن/خاموش هر بخش |\n| `commentMode` | `both` = جواب عمومی کوتاه + دایرکت کامل · `dm` = فقط دایرکت · `public` = فقط جواب عمومی |\n| `publicReplyText` | متن جواب عمومی زیر کامنت؛ `{username}` = آیدی کامنت‌گذار |\n| `keywords` | هر خط: `کلمه | پاسخ` |\n| `mediaReplyText` | جواب به عکس، ویس و استیکر |\n| `fallbackText` | پیام وقتی هوش مصنوعی خطا بدهد |\n| `businessInfo` | ⭐ اطلاعات کسب‌وکار برای هوش مصنوعی |\n\n💡 آی‌دی پیج لازم نیست؛ خودکار از رویداد متا خوانده می‌شود.",
        "height": 760,
        "width": 620,
        "color": 7
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -760,
        -600
      ],
      "id": "33fae9f6-83bf-4542-be7c-b57491d10707",
      "name": "۱ — تنظیمات"
    },
    {
      "parameters": {
        "content": "## 2️⃣ دریافت امن رویدادها\n\n- **Is Verification?** درخواست تأیید متا (GET) را از رویداد واقعی (POST) جدا می‌کند\n- **Verify Webhook** فقط اگر Verify Token درست باشد challenge را برمی‌گرداند\n- **Ack 200** همان لحظه به متا جواب می‌دهد تا پیام **دوباره ارسال نشود**\n- **Normalize Events** (کد):\n  همه‌ی رویدادهای یک درخواست را پردازش می‌کند؛ پیام‌های خود پیج، «دیده شد»، ری‌اکشن و رویداد تکراری را حذف می‌کند و کلمه‌های کلیدی را چک می‌کند",
        "height": 760,
        "width": 560,
        "color": 5
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -100,
        -600
      ],
      "id": "60116945-1f9e-4635-9caf-409ad6c6470d",
      "name": "۲ — دریافت امن"
    },
    {
      "parameters": {
        "content": "## 3️⃣ مغز دستیار\n\n- **Needs AI?** اگر کلمه‌ی کلیدی پیدا شد یا پیام رسانه بود، هوش مصنوعی لازم نیست\n- **AI Agent** — یک مغز مشترک برای دایرکت و کامنت؛ اطلاعات کسب‌وکار از تنظیمات می‌آید\n- **Gemini Chat Model** — `gemini-3.5-flash-lite` (قوی‌تر: `gemini-3.8-flash`)\n- **Memory** — ۱۰ پیام آخر هر کاربر\n\n💡 Simple Memory با ری‌استارت n8n پاک می‌شود؛ برای حافظه‌ی دائمی Postgres یا Redis.",
        "height": 760,
        "width": 560,
        "color": 2
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        500,
        -600
      ],
      "id": "372c351d-3e30-4626-bd01-c2924d74f9cc",
      "name": "۳ — مغز"
    },
    {
      "parameters": {
        "content": "## 4️⃣ ارسال\n\n**Build Replies** تصمیم می‌گیرد چه چیزی کجا برود و متن را برای اینستاگرام تمیز می‌کند (بدون علامت Markdown، حداکثر ۹۵۰ کاراکتر).\n\n- **Send DM** — دایرکت؛ برای کامنت به‌صورت *Private Reply* (پیام خصوصی به کامنت‌گذار)\n- **Public Reply** — جواب عمومی زیر کامنت\n\n⚠️ قوانین متا:\n- به هر کامنت فقط **یک** پیام خصوصی، تا ۷ روز بعد از کامنت\n- در دایرکت فقط تا **۲۴ ساعت** بعد از آخرین پیام مشتری می‌شود جواب داد",
        "height": 760,
        "width": 760,
        "color": 6
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1100,
        -600
      ],
      "id": "aa7c66c7-ef8f-4dd1-b977-f4e1c345789e",
      "name": "۴ — ارسال"
    },
    {
      "parameters": {
        "multipleMethods": true,
        "httpMethod": [
          "GET",
          "POST"
        ],
        "path": "instagram-ai",
        "responseMode": "responseNode",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        -720,
        0
      ],
      "id": "21226c88-5d12-4ded-a39b-53c569ed116d",
      "name": "Instagram Webhook",
      "webhookId": "4c9f5479-5a9a-4804-8c2e-08f4a770061e"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "7ca41ea7-799c-4be6-87a9-fa3c2b85e13f",
              "name": "verifyToken",
              "value": "my-secret-verify-token",
              "type": "string"
            },
            {
              "id": "b4c1a4dc-ca07-4e27-b0d4-945d4d693e52",
              "name": "replyToDMs",
              "value": true,
              "type": "boolean"
            },
            {
              "id": "824f0349-9511-4198-b1db-37cc08e2f6ad",
              "name": "replyToComments",
              "value": true,
              "type": "boolean"
            },
            {
              "id": "500d951f-b2f8-4b0f-9b0f-39ca0e20fdf0",
              "name": "commentMode",
              "value": "both",
              "type": "string"
            },
            {
              "id": "5f416157-be78-4883-9d5b-8e924254c7f8",
              "name": "publicReplyText",
              "value": "{username} جواب کامل رو براتون دایرکت فرستادم 🌷",
              "type": "string"
            },
            {
              "id": "7ed6f77e-de49-4b1c-b4e7-7dd2dd72661b",
              "name": "keywords",
              "value": "قیمت | سلام 🌷 لیست قیمت‌ها اینجاست: https://your-site.ir/prices\nآدرس | آدرس ما: [آدرس کامل] — ساعت کاری ۱۰ تا ۲۰",
              "type": "string"
            },
            {
              "id": "42f5ecd6-f7d6-4a3b-9dc2-fc14d8caa36f",
              "name": "mediaReplyText",
              "value": "ممنون که فرستادید 🙏 لطفاً سؤالتون رو به‌صورت متن هم بنویسید تا دقیق جواب بدیم.",
              "type": "string"
            },
            {
              "id": "8c88ac22-045e-49b3-a084-d4a5f16acb2b",
              "name": "fallbackText",
              "value": "سلام 🌷 پیامتون رسید؛ همکاران ما به‌زودی جواب می‌دن.",
              "type": "string"
            },
            {
              "id": "56a781d4-3497-4faa-b2e2-3955889cfaee",
              "name": "businessInfo",
              "value": "[اطلاعات کسب‌وکار را اینجا بنویسید: معرفی، محصولات و خدمات، قیمت‌ها، شرایط ارسال، ساعت کاری، آدرس، لینک سایت و راه‌های تماس]",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -500,
        0
      ],
      "id": "979c1810-9d9a-4457-9d6f-bde1db3f8d89",
      "name": "⚙️ Settings"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose",
            "version": 2
          },
          "conditions": [
            {
              "id": "78041b42-cf57-4794-884c-32d7d846eb3f",
              "leftValue": "={{ $('Instagram Webhook').item.json.query?.['hub.mode'] || '' }}",
              "rightValue": "subscribe",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        -280,
        0
      ],
      "id": "8fbc8f71-2881-4295-8807-1e1d1ce3df88",
      "name": "Is Verification?"
    },
    {
      "parameters": {
        "respondWith": "text",
        "responseBody": "={{ $('Instagram Webhook').item.json.query['hub.verify_token'] === $('⚙️ Settings').item.json.verifyToken ? $('Instagram Webhook').item.json.query['hub.challenge'] : 'Invalid verify token' }}",
        "options": {
          "responseCode": "={{ $('Instagram Webhook').item.json.query['hub.verify_token'] === $('⚙️ Settings').item.json.verifyToken ? 200 : 403 }}"
        }
      },
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.3,
      "position": [
        -40,
        -160
      ],
      "id": "f355fffd-1fcd-416e-bdb5-1424c06f1e0e",
      "name": "Verify Webhook"
    },
    {
      "parameters": {
        "respondWith": "text",
        "responseBody": "EVENT_RECEIVED",
        "options": {}
      },
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.3,
      "position": [
        -40,
        120
      ],
      "id": "4d99fe66-fc42-46cf-833a-a07738c955b9",
      "name": "Ack 200"
    },
    {
      "parameters": {
        "jsCode": "// ─────────────────────────────────────────────────────────────\n// همه‌ی رویدادهای متا را باز می‌کند و فقط پیام‌ها و کامنت‌های واقعی مشتری را نگه می‌دارد\n// - پیام‌های خود پیج، «دیده شد»، ری‌اکشن و رویدادهای تکراری حذف می‌شوند\n// - کلمه‌های کلیدی تنظیمات بررسی می‌شوند\n// ─────────────────────────────────────────────────────────────\nconst cfg = $('⚙️ Settings').first().json;\nconst body = $('Instagram Webhook').first().json.body || {};\nconst store = $getWorkflowStaticData('global');\nstore.seen = store.seen || [];\nconst seen = new Set(store.seen);\nconst out = [];\n\n// «کلمه | پاسخ» در هر خط\nconst keywords = String(cfg.keywords || '').split('\\n')\n  .map(l => l.split('|')).filter(p => p.length >= 2 && p[0].trim())\n  .map(p => ({ k: p[0].trim().toLowerCase(), r: p.slice(1).join('|').trim() }));\nconst matchKeyword = t => {\n  const s = String(t || '').toLowerCase();\n  const hit = keywords.find(x => s.includes(x.k));\n  return hit ? hit.r : '';\n};\nconst once = id => { if (!id || seen.has(id)) return false; seen.add(id); store.seen.push(id); return true; };\n\nfor (const entry of body.entry || []) {\n  const igId = String(entry.id);\n\n  // ── دایرکت ──\n  if (cfg.replyToDMs) for (const ev of entry.messaging || []) {\n    const msg = ev.message;\n    const from = String(ev.sender?.id || '');\n    if (!msg || msg.is_echo || msg.is_deleted || msg.is_unsupported) continue;   // پیام خود پیج، حذف‌شده، دیده‌شده، ری‌اکشن\n    if (from === igId) continue;\n    if (!once(msg.mid)) continue;                                                // ارسال تکراری متا\n    const text = (msg.text || '').trim();\n    const isMedia = !text && Array.isArray(msg.attachments) && msg.attachments.length;\n    if (!text && !isMedia) continue;\n    out.push({ json: {\n      kind: isMedia ? 'media' : 'dm', igId, userId: from, commentId: '',\n      text, keywordReply: text ? matchKeyword(text) : '', username: '',\n    } });\n  }\n\n  // ── کامنت ──\n  if (cfg.replyToComments) for (const ch of entry.changes || []) {\n    if (ch.field !== 'comments') continue;\n    const v = ch.value || {};\n    if (String(v.from?.id) === igId) continue;                                   // کامنت/جواب خود پیج\n    if (!v.text || !once(v.id)) continue;\n    out.push({ json: {\n      kind: 'comment', igId, userId: String(v.from?.id || ''), commentId: String(v.id),\n      text: v.text.trim(), keywordReply: matchKeyword(v.text), username: v.from?.username || '',\n    } });\n  }\n}\n\nstore.seen = store.seen.slice(-300);   // فقط ۳۰۰ شناسه‌ی آخر\nreturn out;\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        180,
        120
      ],
      "id": "58b84e19-1fdd-4212-96b7-e97d89dc68b1",
      "name": "Normalize Events"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose",
            "version": 2
          },
          "conditions": [
            {
              "id": "fde8401f-518f-4cb4-9369-7902ec8684fc",
              "leftValue": "={{ $json.kind !== 'media' && !$json.keywordReply }}",
              "rightValue": "",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        400,
        120
      ],
      "id": "018e6ef7-eb2a-4e3d-9195-9046c082514e",
      "name": "Needs AI?"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.kind === 'comment' ? 'کامنت زیر پست اینستاگرام' + ($json.username ? ' از @' + $json.username : '') + ':\\n«' + $json.text + '»' : $json.text }}",
        "options": {
          "systemMessage": "=تو ادمین هوشمند پیج اینستاگرام این کسب‌وکار هستی و در دایرکت به مشتری‌ها جواب می‌دهی.\n- همیشه فارسی، گرم، محترمانه و کوتاه جواب بده (حداکثر ۵ خط).\n- از ** و # و جدول استفاده نکن؛ دایرکت اینستاگرام قالب‌بندی ندارد. لینک را کامل و ساده بنویس.\n- اگر پیام یک کامنت زیر پست بود، جوابت در دایرکت همان شخص ارسال می‌شود؛ طوری بنویس که بدون دیدن کامنت هم معلوم باشد درباره‌ی چیست.\n- قیمت، تخفیف یا تعهدی که در اطلاعات زیر نیست از خودت نساز. اگر جواب را نمی‌دانی، بگو همکاران به‌زودی جواب می‌دهند.\n- در پایان، اگر مناسب بود، مشتری را به قدم بعد دعوت کن (سفارش، تماس یا دیدن سایت).\n\nاطلاعات کسب‌وکار:\n{{ $('⚙️ Settings').first().json.businessInfo }}"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.9,
      "position": [
        640,
        0
      ],
      "id": "bb77d40e-b8a8-4294-bbec-274c3c98d9a6",
      "name": "AI Agent",
      "onError": "continueRegularOutput"
    },
    {
      "parameters": {
        "modelName": "models/gemini-3.5-flash-lite",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "typeVersion": 1,
      "position": [
        580,
        240
      ],
      "id": "200a5d56-ea0f-480f-8164-bfc8db7a160b",
      "name": "Gemini Chat Model"
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ 'ig-' + $('Normalize Events').item.json.userId }}",
        "contextWindowLength": 10
      },
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        780,
        240
      ],
      "id": "e940df78-f6c2-449f-9387-74e9c37bad43",
      "name": "Memory"
    },
    {
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "// ─────────────────────────────────────────────────────────────\n// تصمیم نهایی: چه متنی، کجا ارسال شود (دایرکت، جواب عمومی، یا هر دو)\n// ─────────────────────────────────────────────────────────────\nconst cfg = $('⚙️ Settings').first().json;\nconst n = $('Normalize Events').item.json;\nconst clean = t => String(t || '')\n  .replace(/\\[([^\\]]+)\\]\\((https?:\\/\\/[^)]+)\\)/g, '$1: $2')   // لینک Markdown → متن ساده\n  .replace(/\\*\\*|__|`|^#+\\s*/gm, '')\n  .replace(/\\n{3,}/g, '\\n\\n').trim();\nconst cut = (t, max) => t.length <= max ? t : t.slice(0, t.lastIndexOf(' ', max - 1) > max * 0.6 ? t.lastIndexOf(' ', max - 1) : max - 1) + '…';\n\nlet answer;\nif (n.kind === 'media') answer = cfg.mediaReplyText;\nelse if (n.keywordReply) answer = n.keywordReply;\nelse answer = clean($json.output) || cfg.fallbackText;      // اگر هوش مصنوعی خطا داد → پیام پشتیبان\nanswer = cut(clean(answer), 950);                           // سقف دایرکت اینستاگرام ۱۰۰۰ کاراکتر\n\nlet dm = null, pub = null;\nif (n.kind !== 'comment') {\n  dm = { recipient: { id: n.userId }, text: answer };\n} else {\n  const mode = String(cfg.commentMode || 'both');\n  if (mode === 'both' || mode === 'dm') dm = { recipient: { comment_id: n.commentId }, text: answer };\n  if (mode === 'both') pub = cut(String(cfg.publicReplyText || '').replace('{username}', n.username ? '@' + n.username : ''), 300);\n  if (mode === 'public') pub = cut(answer, 1000);\n}\nreturn { json: { igId: n.igId, commentId: n.commentId, kind: n.kind, dm, pub } };\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1160,
        120
      ],
      "id": "495f49bd-eb86-48d7-80d0-3753c3940ca2",
      "name": "Build Replies"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose",
            "version": 2
          },
          "conditions": [
            {
              "id": "41beaa5d-cbda-4307-8204-4b5df01b2ec8",
              "leftValue": "={{ !!$json.dm }}",
              "rightValue": "",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        1380,
        0
      ],
      "id": "14cb573d-62de-45f4-8744-5216463849ad",
      "name": "Send DM?"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose",
            "version": 2
          },
          "conditions": [
            {
              "id": "dc0b9716-22d2-418f-b388-c9869b634316",
              "leftValue": "={{ !!$json.pub }}",
              "rightValue": "",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        1380,
        240
      ],
      "id": "57e5b10a-e384-4f23-bca9-e6787470883f",
      "name": "Reply Publicly?"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "={{ 'https://graph.instagram.com/v23.0/' + $json.igId + '/messages' }}",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ recipient: $json.dm.recipient, message: { text: $json.dm.text } }) }}",
        "options": {
          "timeout": 20000
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1620,
        0
      ],
      "id": "ba55cb41-8a4c-4be2-ba3c-7d66f61c9929",
      "name": "Send DM",
      "onError": "continueRegularOutput"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "={{ 'https://graph.instagram.com/v23.0/' + $json.commentId + '/replies' }}",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ message: $json.pub }) }}",
        "options": {
          "timeout": 20000
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1620,
        240
      ],
      "id": "923cf293-f2cf-4e2f-9104-533023e48ccb",
      "name": "Public Reply",
      "onError": "continueRegularOutput"
    }
  ],
  "pinData": {},
  "connections": {
    "Instagram Webhook": {
      "main": [
        [
          {
            "node": "⚙️ Settings",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "⚙️ Settings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "⚙️ Settings": {
      "main": [
        [
          {
            "node": "Is Verification?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is Verification?": {
      "main": [
        [
          {
            "node": "Verify Webhook",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Ack 200",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Ack 200": {
      "main": [
        [
          {
            "node": "Normalize Events",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Events": {
      "main": [
        [
          {
            "node": "Needs AI?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Needs AI?": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Build Replies",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Build Replies",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Replies": {
      "main": [
        [
          {
            "node": "Send DM?",
            "type": "main",
            "index": 0
          },
          {
            "node": "Reply Publicly?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send DM?": {
      "main": [
        [
          {
            "node": "Send DM",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Reply Publicly?": {
      "main": [
        [
          {
            "node": "Public Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "tags": []
}