{
  "id": "rUKy8bpD27piXChW",
  "name": "Demo Email to Share",
  "tags": [],
  "nodes": [
    {
      "id": "f5543636-85b1-4fc0-a249-a24c89c28a7e",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -384,
        624
      ],
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "11c0072b-8f85-42af-a5bb-7ea0e0534ea6",
      "name": "Edit Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        1520,
        288
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "f334ff6c-3501-4199-8763-a1646c6386e4",
              "name": "Name",
              "type": "string",
              "value": "={{ $('Code in JavaScript').item.json.name }}"
            },
            {
              "id": "d413b489-746e-43fd-ab2e-6e0a25fc05aa",
              "name": "Website",
              "type": "string",
              "value": "=https://{{ $('Code in JavaScript').item.json.website }}"
            },
            {
              "id": "25471945-5ebc-4a7e-ae7f-4befae7d88fd",
              "name": "Receive_Email",
              "type": "string",
              "value": "={{ $('Code in JavaScript').item.json.email }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "9bd90f31-1d1d-4042-8405-790a00e4a344",
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueErrorOutput",
      "position": [
        2176,
        528
      ],
      "parameters": {
        "url": "={{ $json.Website }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "d98093eb-aa44-40ed-8f8c-02a836b07082",
      "name": "Markdown",
      "type": "n8n-nodes-base.markdown",
      "position": [
        2400,
        432
      ],
      "parameters": {
        "html": "={{ $json.data }}",
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "43db5cdf-c940-42f3-aeb4-4707f871f4b8",
      "name": "getting link",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "onError": "continueRegularOutput",
      "position": [
        2720,
        400
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "GPT-4O-MINI"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "you're a helpfull, intelligent web scraper asisstant."
            },
            {
              "content": "=Your task is to extract all URLs from the raw markdown data of a website.\n\nRules:\n\nAlways include both absolute URLs (e.g., https://example.com/page) and relative PHP links (e.g., index.php, about.php).\n\nIf the URL is relative, prepend the base domain {{ $('Edit Fields').item.json.Website }} to make it absolute.\n\nIgnore anchor-only links (e.g., #, ?lang=).\n\nOutput should be a simple list, one URL per line.\n\nOutput format example:\n\nhttps://www.Example.com/index\nhttps://www.Example.com/vision-mission.php\nhttps://www.Example.com/our-leadership.php\nhttps://www.Example.com/our-history"
            },
            {
              "content": "={{ $json.data }}"
            }
          ]
        }
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "b4005b51-ce73-42a9-97f1-8e8a8614cdee",
      "name": "Split Out",
      "type": "n8n-nodes-base.splitOut",
      "onError": "continueRegularOutput",
      "position": [
        3552,
        400
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "message.content.BestLinks"
      },
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "id": "1e723bb4-fe00-4d23-b94c-3393a5919b78",
      "name": "HTTP Request1",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueErrorOutput",
      "position": [
        3776,
        400
      ],
      "parameters": {
        "url": "={{ $json['message.content.BestLinks'] }}",
        "options": {}
      },
      "retryOnFail": false,
      "typeVersion": 4.2,
      "alwaysOutputData": false
    },
    {
      "id": "34ebbd2e-4225-42f2-b33a-6c0fa060ca39",
      "name": "Markdown1",
      "type": "n8n-nodes-base.markdown",
      "onError": "continueRegularOutput",
      "position": [
        4224,
        208
      ],
      "parameters": {
        "html": "={{ $json.data }}",
        "options": {}
      },
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "id": "69b856ea-87a4-4eb1-a3d2-3c980e03d1a0",
      "name": "Page Sumarize",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "onError": "continueRegularOutput",
      "position": [
        5120,
        304
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "GPT-4O-MINI"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "you 're a helpfull, intelligent web scrapper assistant."
            },
            {
              "content": "You are given a markdown scrape of a website page.\nYour task is to write a one-paragraph abstract summarizing what this page is about.\nPrioritize identifying the company\u2019s featured products, their current market condition, and any implied beliefs or values.\nIf these details are missing, still provide the best possible abstract based on the available content.\n\nReturn in JSON format:\n\n{\"abstract\": \"your abstract goes here\"}\n\n\nRules:\n\n-The abstract should be comprehensive, similar in detail to an abstract of a published paper.\n-Prefer extracting specific, concrete products rather than broad categories. For example: use \"coconut shell\" or \"copra\" instead of just \"coconut\". another examples: Use \"ginger\" or \"cinnamon\" instead of a vague term like \"healthy spices\".\n-Use a straightforward, Spartan tone of voice.\n-If the page has no content, return \"no content\"."
            },
            {
              "content": "={{ $json.flattext && $json.flattext.length > 5000 ? $json.flattext.slice(0, 5000) : $json.flattext }}\n"
            }
          ]
        },
        "jsonOutput": true
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "123f6919-ea53-4a16-a5dd-34951012e0b6",
      "name": "Aggregate",
      "type": "n8n-nodes-base.aggregate",
      "onError": "continueRegularOutput",
      "position": [
        5472,
        304
      ],
      "parameters": {
        "options": {},
        "fieldsToAggregate": {
          "fieldToAggregate": [
            {
              "fieldToAggregate": "message.content.abstract"
            }
          ]
        }
      },
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "id": "a572ae39-d493-4478-b12d-b45e51ef6516",
      "name": "Send email",
      "type": "n8n-nodes-base.emailSend",
      "onError": "continueRegularOutput",
      "position": [
        6272,
        304
      ],
      "parameters": {
        "html": "={{ $json.Body }}{{ $json.Signature }}",
        "options": {
          "appendAttribution": false
        },
        "subject": "={{ $json.subject_line }}",
        "toEmail": "={{ $json.receive_email }}",
        "fromEmail": "={{ 'Michael <' + $json.Send_Email + '>' }}"
      },
      "credentials": {
        "smtp": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "86f377a6-b51e-4eaf-94c3-c2d783401319",
      "name": "Email Craft",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "onError": "continueRegularOutput",
      "position": [
        5696,
        304
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-5-mini",
          "cachedResultName": "GPT-5-MINI"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "you're a helpful, intelligent sales asisstant."
            },
            {
              "content": "We just scraped a series of web pages from a business.\nYour task is to take their summaries and turn them into catchy, personalized openers for a cold email campaign, designed to imply that the rest of the campaign is also personalized.\n\nYou'll return your icebreakers in the following text format:\n\n{\"Subject\"={created subject here\",\"Body\"= <div style=\"font-family: Arial, sans-serif; line-height: 1.6; color: #333;\">\n  <p>Dear <strong>{name}</strong>,</p>\n\n  <p>\n    I noticed that your team supports organizations in <strong>{scraped_solution_area}</strong> \n    through <strong>{scraped_solution_name_or_method}</strong>, \n    addressing <strong>{scraped_problem_they_solve}</strong>, which many companies in {your_target_industry} also face.\n  </p>\n\n  <p>\n    We have developed a new concept that we believe could be a good fit for collaboration.\n  </p>\n\n  <p>\n    Over the past few months, we have been working on a concept that seems to help companies like yours. \n    In short, it is an AI-based outreach (lead generation) system \n    that helps find clients both in Indonesia and abroad, \n    and then creates customized proposal emails for each client \u2014 \n    for example, connecting your <strong>{scraped_solution_area}</strong> solution \n    to companies currently facing <strong>{scraped_problem_they_solve}</strong>.\n  </p>\n\n  <p>\n    The cost is very low, and the conversion rate is very high. We believe this aligns with \n    <strong>{SomeImpliedBeliefTheyHave}</strong>.\n  </p>\n\n  <p>\n    Interested? If you agree, we can send you a link to schedule a meeting. \n    Does that sound good to you?\n  </p>\n</div>\n\n\nRules:\n\nWrite in a natural, friendly, but formal tone of voice.\n\nMake sure to use the above format when constructing your icebreakers \u2014 we wrote it this way on purpose.\n\nFor {scraped_solution_name_or_method}\nShorten the solution name.\nExample: Use Managed WordPress instead of Managed WordPress (DreamPress)\nUse Liftoff instead of Liftoff (AI website builder)\nUse XYZ instead of XYZ Company Inc.\n\nRules for {your_target_industry}\nMake it specific (general \u2192 sub-industry/product).\nConvert tools/services \u2192 user industry.\nNo company names (inc, pt, etc.).\nKeep it 2\u20134 words.\nExample: coconut to coconut cream industry, website to growing IT company, press machine to ceramic factory.\n\nFor {SomeImpliedBeliefTheyHave}\nRefer to goals or ambitions, not formal values.\nUse casual phrasing like focus on, aim to, trying to.\nKeep it short (7\u201310 words).\nAvoid corporate buzzwords or brand slogans.\nUse [\u2026this aligns with your focus on expanding into new markets.] instead of [\u2026this aligns with your commitment to quality and sustainability.]"
            },
            {
              "content": "=here is some imformation that you will need\nname:{{ $('Edit Fields').item.json.Name }}"
            },
            {
              "content": "={{ $json.abstract.join(\"/n\") }}"
            }
          ]
        },
        "jsonOutput": true
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "dec239f6-fceb-4454-b8ab-67d97de955cd",
      "name": "Delete row(s)",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        64,
        0
      ],
      "parameters": {
        "filters": {
          "conditions": [
            {
              "condition": "isNotEmpty"
            }
          ]
        },
        "options": {
          "dryRun": false
        },
        "matchType": "allConditions",
        "operation": "deleteRows",
        "dataTableId": {
          "__rl": true,
          "mode": "list",
          "value": "lUt0VsvPO063mnyQ",
          "cachedResultUrl": "/projects/ty2N3FKN04d75oM7/datatables/lUt0VsvPO063mnyQ",
          "cachedResultName": "demo log"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "10c33257-aa0d-48e3-a8e7-afdc5a7ae158",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -384,
        0
      ],
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "7dcf44c7-cc7f-433e-9d16-a2a9616bc391",
      "name": "Get row(s)1",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        -160,
        0
      ],
      "parameters": {
        "operation": "get",
        "dataTableId": {
          "__rl": true,
          "mode": "list",
          "value": "lUt0VsvPO063mnyQ",
          "cachedResultUrl": "/projects/ty2N3FKN04d75oM7/datatables/lUt0VsvPO063mnyQ",
          "cachedResultName": "demo log"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "65368d29-be1f-427c-8b12-dc90987e6bc5",
      "name": "If1",
      "type": "n8n-nodes-base.if",
      "position": [
        -160,
        624
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "8fdf339e-0d75-4c54-b6a6-218048745485",
              "operator": {
                "type": "string",
                "operation": "startsWith"
              },
              "leftValue": "={{ $json.message.text }}",
              "rightValue": "!"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "8b62b092-b4dd-43bd-a21f-8d6e4e004fdb",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        32,
        992
      ],
      "parameters": {
        "model": "gpt-4.1-mini",
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "dbd37933-28fd-4c13-aa8f-bc3abe7f5805",
      "name": "Postgres Chat Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryPostgresChat",
      "position": [
        160,
        992
      ],
      "parameters": {},
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      },
      "notesInFlow": false,
      "typeVersion": 1
    },
    {
      "id": "82f58e56-bfb7-4ca8-be65-e51ab4d3920b",
      "name": "RAG AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        272,
        768
      ],
      "parameters": {
        "text": "={{ $json.chatInput }}",
        "options": {
          "systemMessage": "You are Demo Assistant.  \n\nWhen a new user arrives:  \n1) Introduce yourself,  \n2) Give instruction to fill a form using the template\n3) Fetch and present the input form template using RAG,  \n4) Explain what the bot will do, and  \n5) Display any important notes.  \n\nForm generation rules:  \n- Always fetch the form template from RAG.  \n- Must start with !FORM.  \n- Exactly 3 lines: Name, Email (valid), Website (domain only, no http/https).  \n- No extra text, formatting, or explanations outside the form.  \n- If user input is wrong or incomplete: ask for missing info, then regenerate the correct form with their data.  \n\nIf the user is confused:  \n- Ask for their Name, Email, and Website.  \n- Fill in the form template with their answers, outputting only the ready-to-copy form.\n- After the form, tell the user: **\u201cPlease copy, paste, and send this form.\u201d** \n- Keep replies short and easy to copy.  \n\nRAG usage rules:  \n- You are given tools to perform RAG in the 'documents' table.  \n- Use RAG first to fetch the introduction, form template, bot description, and notes.  \n- Only use SQL on the 'document_rows' table for tabular queries (sums, max, etc.) when RAG would be unreliable.  \n- If RAG doesn\u2019t provide an answer, check available documents, analyze them, and tell the user if nothing is found.  \n- Never invent answers.  \n"
        },
        "promptType": "define"
      },
      "typeVersion": 1.6
    },
    {
      "id": "753a19d3-dfd4-472b-9a4d-bae89b0e55b8",
      "name": "List Documents",
      "type": "n8n-nodes-base.postgresTool",
      "position": [
        288,
        992
      ],
      "parameters": {
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "document_metadata",
          "cachedResultName": "document_metadata"
        },
        "schema": {
          "__rl": true,
          "mode": "list",
          "value": "public"
        },
        "options": {},
        "operation": "select",
        "returnAll": true,
        "descriptionType": "manual",
        "toolDescription": "Use this tool to fetch all available documents, including the table schema if the file is a CSV or Excel file."
      },
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.5
    },
    {
      "id": "fa0a3c9d-63c5-45ec-bd6e-70c69cf33d1b",
      "name": "Get File Contents",
      "type": "n8n-nodes-base.postgresTool",
      "position": [
        416,
        992
      ],
      "parameters": {
        "query": "SELECT \n    string_agg(text, ' ') as document_text\nFROM documents_pg\n  WHERE metadata->>'file_id' = $1\nGROUP BY metadata->>'file_id';",
        "options": {
          "queryReplacement": "={{ $fromAI('file_id') }}"
        },
        "operation": "executeQuery",
        "descriptionType": "manual",
        "toolDescription": "Given a file ID, fetches the text from the document."
      },
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.5
    },
    {
      "id": "b51ec26a-0a56-474a-9061-60e4a11fef1f",
      "name": "Query Document Rows",
      "type": "n8n-nodes-base.postgresTool",
      "position": [
        544,
        992
      ],
      "parameters": {
        "query": "{{ $fromAI('sql_query') }}",
        "options": {},
        "operation": "executeQuery",
        "descriptionType": "manual",
        "toolDescription": "Run a SQL query - use this to query from the document_rows table once you know the file ID you are querying. dataset_id is the file_id and you are always using the row_data for filtering, which is a jsonb field that has all the keys from the file schema given in the document_metadata table.\n\nExample query:\n\nSELECT AVG((row_data->>'revenue')::numeric)\nFROM document_rows\nWHERE dataset_id = '123';\n\nExample query 2:\n\nSELECT \n    row_data->>'category' as category,\n    SUM((row_data->>'sales')::numeric) as total_sales\nFROM dataset_rows\nWHERE dataset_id = '123'\nGROUP BY row_data->>'category';"
      },
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.5
    },
    {
      "id": "11903393-1b81-4409-b4f0-c82f0e490d5e",
      "name": "Embeddings OpenAI2",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        752,
        1200
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "f4fd9497-f01e-42ae-8bf8-faef16ae3a6d",
      "name": "Postgres PGVector Store",
      "type": "@n8n/n8n-nodes-langchain.vectorStorePGVector",
      "position": [
        672,
        992
      ],
      "parameters": {
        "mode": "retrieve-as-tool",
        "topK": 25,
        "options": {},
        "tableName": "documents_pg",
        "toolDescription": "Use RAG to look up information in the knowledgebase."
      },
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "3a8b8da3-6d18-45fd-a8d7-a300fb82adaa",
      "name": "Edit Fields5",
      "type": "n8n-nodes-base.set",
      "position": [
        112,
        768
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "9a9a245e-f1a1-4282-bb02-a81ffe629f0f",
              "name": "chatInput",
              "type": "string",
              "value": "={{ $json.message.text }}"
            },
            {
              "id": "b80831d8-c653-4203-8706-adedfdb98f77",
              "name": "sessionId",
              "type": "string",
              "value": "={{ $json.message.chat.id }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "d6eb2aa8-017c-4b7b-b5e6-e26cf8fd7283",
      "name": "If2",
      "type": "n8n-nodes-base.if",
      "position": [
        1072,
        384
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "3a65e649-786b-4d93-bb7f-121ed4a2233e",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.name }}",
              "rightValue": ""
            },
            {
              "id": "f7c82960-c9b2-4603-827b-680208ed8d25",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.email }}",
              "rightValue": ""
            },
            {
              "id": "ef098bcb-82a6-4a92-b5e3-be9f1660a1ee",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.website }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "5226d39f-b833-4097-87ce-2f301f0814da",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -16,
        672
      ],
      "parameters": {
        "width": 976,
        "height": 672,
        "content": "## Instructor+RAG Agent\n"
      },
      "typeVersion": 1
    },
    {
      "id": "a2302647-5703-427b-91ec-1d0ff2bfd5ab",
      "name": "XML",
      "type": "n8n-nodes-base.xml",
      "position": [
        2176,
        208
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "0135647f-e136-43a9-b0db-c802c022d63e",
      "name": "sitemap.xml request",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueErrorOutput",
      "position": [
        1728,
        400
      ],
      "parameters": {
        "url": "={{ $json.Website }}/sitemap.xml",
        "options": {}
      },
      "typeVersion": 4.2,
      "alwaysOutputData": false
    },
    {
      "id": "b6b14a81-5267-4a41-9c47-7abadfc1d8b3",
      "name": "sitemap_index.xml request",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueErrorOutput",
      "position": [
        1952,
        480
      ],
      "parameters": {
        "url": "={{ $json.Website }}/sitemap_index.xml",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "7c26fff0-e0fb-4752-9143-be5a42525e7d",
      "name": "crawl4ai",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "position": [
        2624,
        624
      ],
      "parameters": {
        "url": "=http://00.00.00.000:11235/crawl",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"urls\": [\"{{ $('Edit Fields').item.json.Website }}\"],\n  \"priority\": 10\n}",
        "sendBody": true,
        "specifyBody": "json"
      },
      "executeOnce": false,
      "retryOnFail": true,
      "typeVersion": 4.2,
      "alwaysOutputData": true
    },
    {
      "id": "f3334eac-4ed8-4b51-a843-f7cbed070b79",
      "name": "Check how many email created by id",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        64,
        416
      ],
      "parameters": {
        "filters": {
          "conditions": [
            {
              "keyName": "Telegram_id",
              "keyValue": "={{ $json.message.from.id }}"
            }
          ]
        },
        "operation": "get",
        "dataTableId": {
          "__rl": true,
          "mode": "list",
          "value": "lUt0VsvPO063mnyQ",
          "cachedResultUrl": "/projects/ty2N3FKN04d75oM7/datatables/lUt0VsvPO063mnyQ",
          "cachedResultName": "demo log"
        }
      },
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "id": "d8572789-5683-4b6d-a0d2-27708098afa7",
      "name": "answer query",
      "type": "n8n-nodes-base.telegram",
      "position": [
        576,
        768
      ],
      "parameters": {
        "text": "={{ $json.output }}",
        "chatId": "={{ $('Telegram Trigger').item.json.message.from.id }}",
        "forceReply": {},
        "replyMarkup": "=none",
        "additionalFields": {
          "appendAttribution": false
        },
        "replyKeyboardRemove": {},
        "replyKeyboardOptions": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "4cdc7181-6f34-455b-81ba-fc94039faa2e",
      "name": "set maximum email per id",
      "type": "n8n-nodes-base.switch",
      "position": [
        432,
        416
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "368c343e-fc6e-46f0-9e82-c50a1c2f707f",
                    "operator": {
                      "type": "array",
                      "operation": "lengthGt",
                      "rightType": "number"
                    },
                    "leftValue": "={{ $json.Telegram_id }}",
                    "rightValue": 2
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "3b3b9bc8-298c-4da3-9341-82e20344a82d",
                    "operator": {
                      "type": "array",
                      "operation": "lengthLte",
                      "rightType": "number"
                    },
                    "leftValue": "={{ $json.Telegram_id }}",
                    "rightValue": 2
                  }
                ]
              }
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.3,
      "alwaysOutputData": false
    },
    {
      "id": "cb9bc574-6dba-4654-b24f-bb5dc655610f",
      "name": "apologize message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        656,
        320
      ],
      "parameters": {
        "text": "Thank you, but the demo can only be used up to 3 times. \ud83d\ude14\n",
        "chatId": "={{ $('Telegram Trigger').item.json.message.from.id }}",
        "forceReply": {},
        "replyMarkup": "=none",
        "additionalFields": {
          "appendAttribution": false
        },
        "replyKeyboardRemove": {},
        "replyKeyboardOptions": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "c9f859c0-2cab-4d92-8267-d5302a27019c",
      "name": "Code in JavaScript",
      "type": "n8n-nodes-base.code",
      "position": [
        880,
        384
      ],
      "parameters": {
        "jsCode": "// --- n8n entry point ---\nconst raw = $('Telegram Trigger').first().json.message.text || '';\n\n// Split lines, trim, remove empty lines, !FORM header, and instruction line\nconst lines = raw\n  .split('\\n')\n  .map(l => l.trim())\n\n// Map to JSON keys\nconst json = {\n  name: lines[1] || '',\n  email: lines[2] || '',\n  website: lines[3] || ''\n};\n\n// Return in n8n format\nreturn [\n  {\n    json\n  }\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "cb5dcd48-e2cd-48ed-a348-f368a4636cc0",
      "name": "notif email creating",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1296,
        288
      ],
      "parameters": {
        "text": "Creating email...",
        "chatId": "={{ $('Telegram Trigger').item.json.message.from.id }}",
        "additionalFields": {
          "appendAttribution": false,
          "disable_notification": true
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "4106b03d-4cfb-499a-afff-43edf7246610",
      "name": "missing input notif",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1296,
        480
      ],
      "parameters": {
        "text": "=Missing Input please use this template...\n!FORM\nname\nemail (valid format)\nwebsite (domain only, no http/https)",
        "chatId": "={{ $('Telegram Trigger').item.json.message.from.id }}",
        "additionalFields": {
          "appendAttribution": false,
          "disable_notification": true
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "9c492a4a-75da-4ee3-8849-34e83a8e9346",
      "name": "make link array to string",
      "type": "n8n-nodes-base.code",
      "position": [
        2400,
        208
      ],
      "parameters": {
        "jsCode": "// Get the input array safely\nconst urlArray = $input.first().json.urlset?.url || [];\n\n// Extract all loc values\nconst locLinks = urlArray.map(item => item.loc).filter(Boolean);\n\n// Join into a single string using '|'\nconst locString = locLinks.join('\\n');\n\n// Return as a single n8n item\nreturn [\n  {\n    json: {\n      loc_links: locString\n    }\n  }\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "0a40ad84-137d-4429-8edc-80df679eecee",
      "name": "extract link",
      "type": "n8n-nodes-base.code",
      "position": [
        2912,
        624
      ],
      "parameters": {
        "jsCode": "function extractLinks(raw) {\n  const urlRegex = /\\bhttps?:\\/\\/\\S+/gi;\n  const links = raw.match(urlRegex) || [];\n  const uniqueLinks = [...new Set(links.map(link => link.trim()))];\n  return uniqueLinks.join('\\n'); // single string with \\n separator\n}\n\n// --- n8n entry point ---\nconst rawMarkdown = $input.first().json.results[0].markdown.raw_markdown || '';\nconst linksString = extractLinks(rawMarkdown);\n\n// \u2705 Return valid n8n output\nreturn [\n  {\n    json: {\n      links: linksString\n    }\n  }\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "a6603e84-7029-4c61-b7a6-c2bdfdee5dc3",
      "name": "Links ranking",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        3200,
        400
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-5-nano",
          "cachedResultName": "GPT-5-NANO"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "You are a link checker.\nYour task is to analyze a list of links given and select no more than 5 links that are most useful for creating a personalized email.\n\nExamples of useful links:\nsolutions\nservices\nwhat-we-do\nsolutions\ncapabilities\nexpertise\napproach\nmethodology\nour-framework\nhow-we-work\nprocess\ncase-studies\nclients\nindustries\ninsights\nblog\nsuccess-stories\nAbout Us\nCompany Profile\nNews\nVision and Mission\n\nRules:\n\nOnly return absolute URLs (e.g., https://example.com/about-us).\n\nIgnore relative URLs (e.g., /about-us).\n\nDo not return more than 5 links.\n\nOutput format (JSON):\n\n{\n  \"BestLinks\": [\n    \"https://example.com/about-us\",\n    \"https://example.com/services\",\n    \"https://example.com/news\",\n    \"https://example.com/vision-mission\"\n  ]\n}"
            },
            {
              "content": "={{ $json.loc_links }}{{ $json.message.content }}{{ $json.links }}"
            }
          ]
        },
        "jsonOutput": true
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "d0d9c975-15cc-4999-8c7a-48d9bb1c7e49",
      "name": "crawl4ai1",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueErrorOutput",
      "position": [
        4000,
        496
      ],
      "parameters": {
        "url": "=http://00.00.00.000:11235/crawl",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"urls\": [\"{{ $json['message.content.BestLinks'] }}\"],\n  \"priority\": 10\n}",
        "sendBody": true,
        "specifyBody": "json"
      },
      "executeOnce": false,
      "retryOnFail": true,
      "typeVersion": 4.2,
      "alwaysOutputData": true
    },
    {
      "id": "4c4522be-5cd0-4ecd-aa91-14be3d3a3823",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        4448,
        304
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "264be0b6-5340-44f6-b9fa-26ee354459fe",
      "name": "Edit Fields3",
      "type": "n8n-nodes-base.set",
      "position": [
        4224,
        400
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "2b5bb36f-a7f8-41c7-8de0-1cd1ad2ea06a",
              "name": "data",
              "type": "string",
              "value": "={{ $json.results[0].markdown.raw_markdown }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "26c8001f-2ac1-4f9f-b288-19ab5e502d1c",
      "name": "broken links notif",
      "type": "n8n-nodes-base.telegram",
      "position": [
        4224,
        592
      ],
      "parameters": {
        "text": "Some links may be broken. If no update is received within the next few minutes, the process will be considered failed.\n",
        "chatId": "={{ $('Telegram Trigger').item.json.message.from.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "a3e83a25-7cd9-44af-9556-bedb2c459992",
      "name": "flattext",
      "type": "n8n-nodes-base.set",
      "position": [
        4896,
        304
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "87306b67-4fa7-4e0c-a6f4-c95d30bd3172",
              "name": "flattext",
              "type": "string",
              "value": "={{ $json.flatText }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "69d2748f-b15d-42ad-a74e-10af8a390641",
      "name": "trim markdown to less token",
      "type": "n8n-nodes-base.code",
      "position": [
        4672,
        304
      ],
      "parameters": {
        "jsCode": "// --- n8n entry point ---\nconst items = $input.all();\nfunction normalizeMarkdown(raw) {\n  let text = raw\n    .replace(/[*#>`~_]+/g, ' ')\n    .replace(/\\[([^\\]]+)\\]\\([^)]+\\)/g, '$1')\n    .replace(/\\bhttps?:\\/\\/\\S+/gi, '')\n    .replace(/\\|/g, ', ')\n    .replace(/^- /gm, '\u2022 ')\n    .replace(/\\s{2,}/g, ' ')\n    .replace(/\\n{2,}/g, '\\n')\n    .trim();\n\n  const lines = text.split('\\n');\n  const sections = [];\n  let current = { title: 'General', content: [] };\n\n  for (const line of lines) {\n    const heading = line.match(/^(?:#+|SECTION:)\\s*(.*)/i);\n    if (heading) {\n      if (current.content.length) sections.push(current);\n      current = { title: heading[1].trim(), content: [] };\n    } else {\n      current.content.push(line.trim());\n    }\n  }\n  if (current.content.length) sections.push(current);\n\n  const structured = sections.map(s => ({\n    section: s.title,\n    text: s.content\n      .join(' ')\n      .replace(/\\s+/g, ' ')\n      .replace(/\\b(the|a|an|this|that|these|those)\\b/gi, '')\n      .trim()\n  }));\n\n  const flatText = structured.map(s => `${s.section}: ${s.text}`).join('\\n\\n');\n\n  return { structured, flatText };\n}\n// Process all items\nconst output = items.map(item => {\n  const rawMarkdown = item?.json?.data || '';\n  const result = normalizeMarkdown(rawMarkdown);\n  return {\n    json: {\n      structured: result.structured,\n      flatText: result.flatText,\n      sectionCount: result.structured.length\n    }\n  };\n});\n\nreturn output;\n"
      },
      "typeVersion": 2
    },
    {
      "id": "c111426c-6435-4be5-9fc3-909dd6327635",
      "name": "sender + signature",
      "type": "n8n-nodes-base.set",
      "onError": "continueRegularOutput",
      "position": [
        6048,
        304
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "b44d2183-02ee-4413-874e-244aab9ed453",
              "name": "Send_Email",
              "type": "string",
              "value": "=email@gmail.com"
            },
            {
              "id": "ea41bba5-ee38-4acb-bd37-414183747aca",
              "name": "receive_email",
              "type": "string",
              "value": "={{ $('Edit Fields').item.json.Receive_Email }}"
            },
            {
              "id": "af35045d-9756-47bf-8030-94e80f8f27b5",
              "name": "subject_line",
              "type": "string",
              "value": "={{ $json.message.content.Subject }}"
            },
            {
              "id": "bf4310e5-9f18-47ac-82b0-5b3cc2e65951",
              "name": "Body",
              "type": "string",
              "value": "={{ $json.message.content.Body }}"
            },
            {
              "id": "b41c6372-446a-4a9e-bd2d-dc12cd51b84e",
              "name": "Signature",
              "type": "string",
              "value": "<your email signature>"
            }
          ]
        }
      },
      "executeOnce": false,
      "retryOnFail": false,
      "typeVersion": 3.4
    },
    {
      "id": "a13c1a7a-a810-40eb-b17b-1758c5092ca5",
      "name": "calculate how many session",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        240,
        416
      ],
      "parameters": {
        "options": {},
        "fieldsToAggregate": {
          "fieldToAggregate": [
            {
              "fieldToAggregate": "Telegram_id"
            }
          ]
        }
      },
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "id": "d5568cdf-5905-4c0e-a078-88693ba27e75",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        16,
        256
      ],
      "parameters": {
        "color": 3,
        "width": 816,
        "height": 368,
        "content": "## Limit how many demo emails can be sent per ID"
      },
      "typeVersion": 1
    },
    {
      "id": "901a436e-509a-4195-b343-7d25578ad515",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        864,
        256
      ],
      "parameters": {
        "color": 5,
        "width": 768,
        "height": 368,
        "content": "## Input Formatting"
      },
      "typeVersion": 1
    },
    {
      "id": "1c8832d8-b1bc-436f-9f3f-47ce4feb8bed",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1680,
        192
      ],
      "parameters": {
        "color": 2,
        "width": 2000,
        "height": 576,
        "content": "## Extract sublinks from a website"
      },
      "typeVersion": 1
    },
    {
      "id": "d157a162-804b-46c5-a5c5-9dc57429a420",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3728,
        192
      ],
      "parameters": {
        "color": 6,
        "width": 1920,
        "height": 560,
        "content": "## Extract content from sublinks\n"
      },
      "typeVersion": 1
    },
    {
      "id": "1e7a804d-21cc-4a0d-aa13-587a5772b1a8",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        5680,
        208
      ],
      "parameters": {
        "width": 976,
        "height": 288,
        "content": "## Crafting and sending email\n"
      },
      "typeVersion": 1
    },
    {
      "id": "a7b0258e-2f1c-4dca-9a0c-f614cc6251a9",
      "name": "Finish notif",
      "type": "n8n-nodes-base.telegram",
      "position": [
        6496,
        304
      ],
      "parameters": {
        "text": "Done. Please check your email inbox.",
        "chatId": "={{ $('Telegram Trigger').item.json.message.from.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "bcbb5b6d-5344-40ac-ad35-f9df2b83e8f8",
      "name": "insert log",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        6720,
        304
      ],
      "parameters": {
        "columns": {
          "value": {
            "nama": "={{ $('Telegram Trigger').item.json.message.from.first_name }}",
            "Telegram_id": "={{ $('Telegram Trigger').item.json.message.from.id }}"
          },
          "schema": [
            {
              "id": "nama",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "nama",
              "defaultMatch": false
            },
            {
              "id": "Telegram_id",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Telegram_id",
              "defaultMatch": false
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "dataTableId": {
          "__rl": true,
          "mode": "list",
          "value": "lUt0VsvPO063mnyQ",
          "cachedResultUrl": "/projects/ty2N3FKN04d75oM7/datatables/lUt0VsvPO063mnyQ",
          "cachedResultName": "demo log"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "cf96a14b-bdc0-4deb-a464-41f334e5ed89",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -416,
        -80
      ],
      "parameters": {
        "width": 688,
        "height": 224,
        "content": "## Cleaning log data"
      },
      "typeVersion": 1
    },
    {
      "id": "cab89871-f0e6-46e6-9382-4f23090a03e3",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1264,
        -80
      ],
      "parameters": {
        "color": 7,
        "width": 736,
        "height": 2384,
        "content": "# Demo Personalized Email\n\nThis n8n workflow is built for AI and automation agencies to **promote their workflows through an interactive demo** that prospects can try themselves.  \nThe featured system is a **deep personalized email demo**.\n\n---\n\n## \ud83d\udd04 How It Works\n\n1. **Prospect Interaction**\n   - A prospect starts the demo via Telegram.  \n   - The Telegram bot (created with BotFather) connects directly to your n8n instance.\n\n2. **Demo Guidance**\n   - The **RAG agent** and **instructor** guide the user step-by-step through the demo.  \n   - Instructions and responses are dynamically generated based on user input.\n\n3. **Workflow Execution**\n   - When the user triggers an action (e.g., testing the email demo), n8n runs the workflow.  \n   - The workflow collects website data using **Crawl4AI** or standard HTTP requests.\n\n4. **Email Demo**\n   - The system personalizes and sends a demo email through **SparkPost**, showing the automation\u2019s capability.  \n\n5. **Logging and Control**\n   - Each user interaction is logged in your database using their `name` and `id`.  \n   - The workflow checks limits to prevent misuse or spam.  \n\n6. **Error Handling**\n   - If a low-CPU scraping method fails, the workflow automatically escalates to a higher-CPU method.  \n\n## \u2699\ufe0f Requirements\n\nBefore setting up, make sure you have the following:\n\n- [**n8n**](https://n8n.io/) \u2014 Automation platform to run the workflow  \n- [**Docker**](https://www.docker.com/) \u2014 Required to run Crawl4AI  \n- [**Crawl4AI**](https://github.com/unclecode/crawl4ai) \u2014 For intelligent website crawling  \n- [**Telegram Account**](https://t.me/BotFather) \u2014 To create your Telegram bot via BotFather  \n- [**SparkPost Account**](https://www.sparkpost.com/) \u2014 To send personalized demo emails  \n- A database (e.g., PostgreSQL, MySQL, or SQLite) \u2014 To store log data such as user name and ID  \n\n\n## \ud83d\ude80 Features\n\n- **Telegram interface** using the BotFather API  \n- **Instructor and RAG agent** to guide prospects through the demo  \n- **Flow generation limits per user ID** to prevent abuse  \n- **Low-cost yet powerful web scraping**, escalating from low- to high-CPU flows if earlier ones fail  \n\n---\n\n## \ud83d\udca1 Development Ideas\n\n- Replace the RAG logic with your own query-answering and guidance method  \n- Remove the flow limit if you\u2019re confident the demo can\u2019t be misused  \n- Swap the personalized email demo with any other workflow you want to showcase  \n\n---\n\n## \ud83e\udde0 Technical Notes\n\n- **Telegram bot** created with BotFather  \n- **Website crawl process:**\n  - Extract sub-links via `/sitemap.xml`, `sitemap_index.xml`, or standard HTTP requests  \n  - Fall back to **Crawl4AI** if normal requests fail  \n  - Fetch sub-link content via HTTPS or Crawl4AI as backup  \n- **SparkPost** used for sending demo emails  \n\n---\n\n## \u2699\ufe0f Setup Instructions\n\n### 1. Create a Telegram Bot\n- Use **BotFather** on Telegram to create your bot and get the **API token**.  \n- This token will be used to connect your n8n workflow to Telegram.  \n\n### 2. Create a Log Data Table\n- In your database, create a table to store user logs.  \n- The table must include at least the following columns:\n  - `name` \u2014 to store the user\u2019s name or Telegram username.  \n  - `id` \u2014 to store the user\u2019s unique identifier.  \n\n### 3. Install Crawl4AI with Docker\n- Follow the installation guide from the official repository:  \n  \ud83d\udc49 [https://github.com/unclecode/crawl4ai](https://github.com/unclecode/crawl4ai)  \n- **Crawl4AI** will handle website crawling and content extraction in your workflow.  \n\n---\n## \ud83d\udce6 Notes\n\nThis setup is optimized for **low cost**, **easy scalability**, and **real-time interaction** with prospects.  \nYou can customize each component \u2014 **Telegram bot behavior**, **RAG logic**, **scraping strategy**, and **email workflow** \u2014 to fit your agency\u2019s demo needs.\n\n\n\ud83d\udc49 You can try the live demo here: [**@email_demo_bot**](https://t.me/email_demo_bot)\n\n---\n\n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "04e561c3-2990-43d0-acd6-284618766ac4",
  "connections": {
    "If1": {
      "main": [
        [
          {
            "node": "Check how many email created by id",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Edit Fields5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If2": {
      "main": [
        [
          {
            "node": "notif email creating",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "missing input notif",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "XML": {
      "main": [
        [
          {
            "node": "make link array to string",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge": {
      "main": [
        [
          {
            "node": "trim markdown to less token",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Markdown": {
      "main": [
        [
          {
            "node": "getting link",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "crawl4ai": {
      "main": [
        [
          {
            "node": "extract link",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "flattext": {
      "main": [
        [
          {
            "node": "Page Sumarize",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate": {
      "main": [
        [
          {
            "node": "Email Craft",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Markdown1": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out": {
      "main": [
        [
          {
            "node": "HTTP Request1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "crawl4ai1": {
      "main": [
        [
          {
            "node": "Edit Fields3",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "broken links notif",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send email": {
      "main": [
        [
          {
            "node": "Finish notif",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "sitemap.xml request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email Craft": {
      "main": [
        [
          {
            "node": "sender + signature",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s)1": {
      "main": [
        [
          {
            "node": "Delete row(s)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields3": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Edit Fields5": {
      "main": [
        [
          {
            "node": "RAG AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Finish notif": {
      "main": [
        [
          {
            "node": "insert log",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "Markdown",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "crawl4ai",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "RAG AI Agent": {
      "main": [
        [
          {
            "node": "answer query",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "extract link": {
      "main": [
        [
          {
            "node": "Links ranking",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "getting link": {
      "main": [
        [
          {
            "node": "Links ranking",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request1": {
      "main": [
        [
          {
            "node": "Markdown1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "crawl4ai1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Links ranking": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Page Sumarize": {
      "main": [
        [
          {
            "node": "Aggregate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "List Documents": {
      "ai_tool": [
        [
          {
            "node": "RAG AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Get row(s)1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "If1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get File Contents": {
      "ai_tool": [
        [
          {
            "node": "RAG AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "RAG AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Code in JavaScript": {
      "main": [
        [
          {
            "node": "If2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI2": {
      "ai_embedding": [
        [
          {
            "node": "Postgres PGVector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "sender + signature": {
      "main": [
        [
          {
            "node": "Send email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Query Document Rows": {
      "ai_tool": [
        [
          {
            "node": "RAG AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "sitemap.xml request": {
      "main": [
        [
          {
            "node": "XML",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "sitemap_index.xml request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Postgres Chat Memory": {
      "ai_memory": [
        [
          {
            "node": "RAG AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "notif email creating": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Postgres PGVector Store": {
      "ai_tool": [
        [
          {
            "node": "RAG AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "set maximum email per id": {
      "main": [
        [
          {
            "node": "apologize message",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Code in JavaScript",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "make link array to string": {
      "main": [
        [
          {
            "node": "Links ranking",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "sitemap_index.xml request": {
      "main": [
        [
          {
            "node": "XML",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "calculate how many session": {
      "main": [
        [
          {
            "node": "set maximum email per id",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "trim markdown to less token": {
      "main": [
        [
          {
            "node": "flattext",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check how many email created by id": {
      "main": [
        [
          {
            "node": "calculate how many session",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}