{
  "id": "9tjsL5SwBcNcIyRD",
  "name": "My workflow 2",
  "tags": [],
  "nodes": [
    {
      "id": "670e0318-59ac-40e6-a0f5-2c61cee5fc31",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        368,
        112
      ],
      "parameters": {
        "text": "={{ $('Incoming Message').item.json.message.text }}\n",
        "options": {
          "systemMessage": "=You are a friendly and efficient personal assistant who helps manage my finances (income & expenses) through Google Sheets integration. Your personality is helpful, warm, and conversational - like talking to a supportive friend rather than interacting with software.\nYou MUST ALWAYS respond in Arabic language.\n\n\u26a0\ufe0f CRITICAL INSTRUCTIONS - READ CAREFULLY\n\nYou MUST ALWAYS respond to the user. Never remain silent.\n\nYou MUST ALWAYS update Google Sheets for EVERY financial operation (add/list/update/delete).\n\nNEVER skip the Google Sheets sync step - this is your PRIMARY function.\n\nALWAYS confirm the Google Sheets update in your response.\n\nIf you encounter any issues with Google Sheets, still respond to the user explaining the issue.\n\nCurrent Time Reference (Bangkok)\n\n{{ $now.setZone(\"Asia/Bangkok\").toFormat(\"dd-MM-yyyy HH:mm:ss\") }}  \n\n\u2705 Capabilities\n\n\u0625\u0636\u0627\u0641\u0629 \u0639\u0645\u0644\u064a\u0629 \u0645\u0627\u0644\u064a\u0629 \u062c\u062f\u064a\u062f\u0629 (\u0645\u0635\u0631\u0648\u0641 / \u062f\u062e\u0644).\n\n\u0639\u0631\u0636 \u0627\u0644\u0639\u0645\u0644\u064a\u0627\u062a \u0627\u0644\u0633\u0627\u0628\u0642\u0629.\n\n\u062a\u0639\u062f\u064a\u0644 \u0639\u0645\u0644\u064a\u0629 \u0645\u0627\u0644\u064a\u0629.\n\n\u062d\u0630\u0641 \u0639\u0645\u0644\u064a\u0629 \u0645\u0627\u0644\u064a\u0629.\n\n\u0627\u0644\u0645\u0632\u0627\u0645\u0646\u0629 \u0627\u0644\u0643\u0627\u0645\u0644\u0629 \u0645\u0639 Google Sheets \u0628\u0634\u0643\u0644 \u0633\u0644\u0633.\n\n\ud83d\udcca Data Structure\n\n\u0639\u0646\u062f \u0627\u0644\u062a\u062e\u0632\u064a\u0646 \u0641\u064a Google Sheets \u0627\u0633\u062a\u062e\u062f\u0645 \u0647\u0630\u0627 \u0627\u0644\u0640 JSON:\n\n{\n  \"intent\": \"add\" | \"list\" | \"update\" | \"delete\",\n  \"id\": \"\u0631\u0642\u0645 \u0639\u0634\u0648\u0627\u0626\u064a \u064a\u062a\u0645 \u062a\u0648\u0644\u064a\u062f\u0647 \u0644\u0643\u0644 \u0639\u0645\u0644\u064a\u0629 \u062c\u062f\u064a\u062f\u0629 (\u0645\u062b\u0644\u0627\u064b 6 \u0623\u0631\u0642\u0627\u0645)\",  \n  \"amount\": \"\u0627\u0644\u0645\u0628\u0644\u063a\",                  \n  \"currency\": \"\u0627\u0644\u0639\u0645\u0644\u0629 (\u0645\u062b\u0644\u0627\u064b: JOD, USD)\",\n  \"note\": \"\u0645\u0644\u0627\u062d\u0638\u0629 \u0627\u062e\u062a\u064a\u0627\u0631\u064a\u0629 (\u0645\u062b\u0644\u0627\u064b: \u0645\u0637\u0639\u0645\u060c \u0631\u0627\u062a\u0628\u2026)\",  \n  \"type\": \"debit\" | \"credit\",   // debit = \u0645\u0635\u0631\u0648\u0641 (\u0639\u0644\u064a), credit = \u062f\u062e\u0644 (\u0644\u064a)\n  \"date\": \"YYYY-MM-DD\",         \n  \"time\": \"HH:mm:ss\"            \n}\n\n\ud83d\udde3 Communication Style\n\n\u062f\u0627\u0626\u0645\u064b\u0627 \u0631\u062f \u0628\u0637\u0631\u064a\u0642\u0629 \u0648\u062f\u0648\u062f\u0629 \u0648\u0628\u0633\u064a\u0637\u0629 \u0643\u0635\u062f\u064a\u0642 \u064a\u0633\u0627\u0639\u062f\u0646\u064a \u0628\u0645\u062a\u0627\u0628\u0639\u0629 \u0645\u0635\u0627\u0631\u064a\u0641\u064a.\n\n\u0644\u0627 \u062a\u0633\u062a\u062e\u062f\u0645 \u0639\u0628\u0627\u0631\u0627\u062a \u062a\u0642\u0646\u064a\u0629 \u0645\u062b\u0644 \"\u062a\u0645\u062a \u0627\u0644\u0645\u0632\u0627\u0645\u0646\u0629 \u0645\u0639 Google Sheets\".\n\n\u0627\u0633\u062a\u0639\u0645\u0644 \u0639\u0628\u0627\u0631\u0627\u062a \u0639\u0641\u0648\u064a\u0629 \u0645\u062b\u0644:\n\n\"\u062a\u0645\u0627\u0645\u060c \u0633\u062c\u0644\u062a \u0625\u0646\u0643 \u0635\u0631\u0641\u062a 10 \u062f\u0646\u0627\u0646\u064a\u0631 \u0639\u0627\u0644\u063a\u062f\u0627 \ud83c\udf54\"\n\n\"\u0623\u0628\u0634\u0631! \u0623\u0636\u0641\u062a \u062f\u062e\u0644 \u062c\u062f\u064a\u062f 500$ (\u0631\u0627\u062a\u0628)\"\n\n\"\u062a\u0645\u0627\u0645\u060c \u062d\u062f\u062b\u062a \u0627\u0644\u0639\u0645\u0644\u064a\u0629 \u0648\u0635\u0627\u0631\u062a \u0645\u0635\u0631\u0648\u0641 \u0628\u062f\u0644 \u062f\u062e\u0644\"\n\n\u062e\u0644\u064a \u0631\u062f\u0648\u062f\u0643 \u0642\u0635\u064a\u0631\u0629\u060c \u0644\u0637\u064a\u0641\u0629\u060c \u0648\u0628\u0627\u0644\u0639\u0631\u0628\u064a\u0629.\n\n\ud83d\udcdd Examples of Good Responses\n\n\u0628\u0639\u062f \u0625\u0636\u0627\u0641\u0629 \u0645\u0635\u0631\u0648\u0641:\n\"\u062a\u0645! \u0635\u0631\u0641\u062a 20 \u0634\u064a\u0643\u0644 \u0639\u0627\u0644\u0628\u0642\u0627\u0644\u0629 \u0648\u0633\u062c\u0644\u062a\u0647\u0627 \ud83d\udc4d\"\n\n\u0628\u0639\u062f \u0625\u0636\u0627\u0641\u0629 \u062f\u062e\u0644:\n\"\u0631\u0627\u0626\u0639 \ud83d\udc4c \u0623\u0636\u0641\u062a \u062f\u062e\u0644 100 \u062f\u064a\u0646\u0627\u0631 (\u0645\u0635\u0631\u0648\u0641 \u062c\u064a\u0628) \u0639\u0644\u0649 \u0627\u0644\u064a\u0648\u0645.\"\n\n\u0628\u0639\u062f \u0627\u0644\u062a\u0639\u062f\u064a\u0644:\n\"\u062a\u0645\u0627\u0645\u060c \u063a\u064a\u0631\u062a \u0627\u0644\u0639\u0645\u0644\u064a\u0629 \u0648\u0635\u0627\u0631\u062a 30 \u062f\u064a\u0646\u0627\u0631 \u0628\u062f\u0644 20.\"\n\n\u0628\u0639\u062f \u0627\u0644\u062d\u0630\u0641:\n\"\u062e\u0644\u0635! \u0645\u0633\u062d\u062a \u0627\u0644\u0639\u0645\u0644\u064a\u0629 \u0627\u0644\u0644\u064a \u062d\u0643\u064a\u062a \u0639\u0646\u0647\u0627.\"\n\n\u0639\u0646\u062f \u0639\u0631\u0636 \u0627\u0644\u0639\u0645\u0644\u064a\u0627\u062a:\n\"\u0647\u0627\u064a \u0622\u062e\u0631 \u0639\u0645\u0644\u064a\u0627\u062a\u0643:\n\n20 \u062f\u064a\u0646\u0627\u0631 (\u0645\u0635\u0631\u0648\u0641 - \u0645\u0637\u0639\u0645) \u0623\u0645\u0633\n\n500$ (\u062f\u062e\u0644 - \u0631\u0627\u062a\u0628) \u0627\u0644\u0623\u0633\u0628\u0648\u0639 \u0627\u0644\u0645\u0627\u0636\u064a\"\n\n\ud83d\udd12 Security and Privacy Guidelines\n\n\u062d\u0627\u0641\u0638 \u0639\u0644\u0649 \u0633\u0631\u064a\u0629 \u0627\u0644\u0645\u0639\u0644\u0648\u0645\u0627\u062a.\n\n\u0644\u0627 \u062a\u0638\u0647\u0631 \u0623\u064a \u062a\u0641\u0627\u0635\u064a\u0644 \u062d\u0633\u0627\u0633\u0629.\n\n\u0644\u0627 \u062a\u0639\u0631\u0636 \u0623\u064a \u0628\u064a\u0627\u0646\u0627\u062a \u063a\u064a\u0631 \u0645\u0631\u062a\u0628\u0637\u0629 \u0628\u0627\u0644\u0637\u0644\u0628 \u0627\u0644\u062d\u0627\u0644\u064a.\n\u0633\u062c\u0644 \u0643\u0644 \u0627\u0634\u064a \u0628\u0627\u0644\u0644\u0639\u0629 \u0627\u0644\u0639\u0631\u0628\u064a\u0629."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.8
    },
    {
      "id": "9a166f67-ff7c-4a00-890f-a02a9c3e2938",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        160,
        544
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o",
          "cachedResultName": "gpt-4o"
        },
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "eb6930ae-6c9f-4321-840f-d7828066e1a2",
      "name": "Telegram",
      "type": "n8n-nodes-base.telegram",
      "position": [
        896,
        112
      ],
      "parameters": {
        "text": "={{ $json.output }}",
        "chatId": "=-1003057912037",
        "additionalFields": {
          "appendAttribution": false,
          "message_thread_id": 324
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "e15ac552-133b-44a0-85d6-8ebd657a4162",
      "name": "Google Sheets",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        496,
        512
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 661184683,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1S_M-0IxU84HYrkNHlIC7CivdI0KYlC3tWh48rAIx3O8/edit#gid=661184683",
          "cachedResultName": "Expenses"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1S_M-0IxU84HYrkNHlIC7CivdI0KYlC3tWh48rAIx3O8",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1S_M-0IxU84HYrkNHlIC7CivdI0KYlC3tWh48rAIx3O8/edit?usp=drivesdk",
          "cachedResultName": "My Assistants"
        },
        "descriptionType": "manual",
        "toolDescription": "This google should be used when user wants data tasks data\nfor example: if user says list all the tasks\nyou should list all of them by reading google sheet"
      },
      "typeVersion": 4.5
    },
    {
      "id": "8a14a1e5-d7c8-4746-94ee-d516120057c7",
      "name": "Google Sheets1",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        688,
        512
      ],
      "parameters": {
        "columns": {
          "value": {
            "iD": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('iD__using_to_match_', ``, 'string') }}",
            "Date": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Date', ``, 'string') }}",
            "Note": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Note', ``, 'string') }}",
            "Time": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Time', ``, 'string') }}",
            "Amount": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Amount', ``, 'string') }}",
            "Currency": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Currency', ``, 'string') }}",
            "Debit / Credit": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Debit___Credit', ``, 'string') }}"
          },
          "schema": [
            {
              "id": "iD",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "iD",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Amount",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Amount",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Currency",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Currency",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Note",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Note",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Debit / Credit",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Debit / Credit",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Date",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Time",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Time",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "iD"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 661184683,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1S_M-0IxU84HYrkNHlIC7CivdI0KYlC3tWh48rAIx3O8/edit#gid=661184683",
          "cachedResultName": "Expenses"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1S_M-0IxU84HYrkNHlIC7CivdI0KYlC3tWh48rAIx3O8",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1S_M-0IxU84HYrkNHlIC7CivdI0KYlC3tWh48rAIx3O8/edit?usp=drivesdk",
          "cachedResultName": "My Assistants"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "47fb9884-d9de-4b1b-901d-cfb5eedd7ed7",
      "name": "Google Sheets2",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        896,
        512
      ],
      "parameters": {
        "operation": "delete",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 661184683,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1S_M-0IxU84HYrkNHlIC7CivdI0KYlC3tWh48rAIx3O8/edit#gid=661184683",
          "cachedResultName": "Expenses"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1S_M-0IxU84HYrkNHlIC7CivdI0KYlC3tWh48rAIx3O8",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1S_M-0IxU84HYrkNHlIC7CivdI0KYlC3tWh48rAIx3O8/edit?usp=drivesdk",
          "cachedResultName": "My Assistants"
        },
        "startIndex": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Start_Row_Number', ``, 'number') }}",
        "numberToDelete": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Number_of_Rows_to_Delete', ``, 'number') }}",
        "descriptionType": "manual",
        "toolDescription": "use this tool to delete the rows, make sure you never delete the first row as it it is the name of the columns."
      },
      "typeVersion": 4.5
    },
    {
      "id": "ad90f73c-e20a-4717-ba9c-a49986eac1d5",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        352,
        480
      ],
      "parameters": {
        "sessionKey": "={{ $('Incoming Message').item.json.message.from.id }}",
        "sessionIdType": "customKey"
      },
      "typeVersion": 1.3
    },
    {
      "id": "5369198b-739b-47c9-beb4-935f08b6c817",
      "name": "Incoming Message",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -1680,
        3024
      ],
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "befe5ccf-c009-4ebb-a4a7-eeff59c83ecd",
      "name": "Schedule Trigger1",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        160,
        800
      ],
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "61df3b0a-56f1-47a1-969e-fe4e03a53b0d",
      "name": "Telegram4",
      "type": "n8n-nodes-base.telegram",
      "position": [
        928,
        816
      ],
      "parameters": {
        "text": "={{ $json.output }}",
        "chatId": "123456789",
        "additionalFields": {
          "appendAttribution": false,
          "message_thread_id": 324
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "20ebf1ee-097a-42b2-b25b-919014028be0",
      "name": "AI Agent2",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        432,
        800
      ],
      "parameters": {
        "text": "=You will generate a natural, human-like message summarizing financial data (income & expenses) based only on the data retrieved from a Google Sheet.\nI want you to use Arabic.\n\nColumns available:\n\nid, Amount, Currency, Note, Type, Date, Time\n\nInstructions:\n\n\u0645\u0635\u0631\u0648\u0641 \u0627\u0644\u064a\u0648\u0645:\n\n\u0627\u062c\u0645\u0639 \u0643\u0644 \u0627\u0644\u0639\u0645\u0644\u064a\u0627\u062a \u0627\u0644\u0644\u064a \u0646\u0648\u0639\u0647\u0627 debit \u0648\u062a\u0627\u0631\u064a\u062e\u0647\u0627 \u064a\u0633\u0627\u0648\u064a \u062a\u0627\u0631\u064a\u062e \u0627\u0644\u064a\u0648\u0645.\n\n\u062f\u062e\u0644 \u0627\u0644\u064a\u0648\u0645:\n\n\u0627\u062c\u0645\u0639 \u0643\u0644 \u0627\u0644\u0639\u0645\u0644\u064a\u0627\u062a \u0627\u0644\u0644\u064a \u0646\u0648\u0639\u0647\u0627 credit \u0648\u062a\u0627\u0631\u064a\u062e\u0647\u0627 \u064a\u0633\u0627\u0648\u064a \u062a\u0627\u0631\u064a\u062e \u0627\u0644\u064a\u0648\u0645.\n\n\u0625\u062c\u0645\u0627\u0644\u064a \u0627\u0644\u0645\u0635\u0627\u0631\u064a\u0641 \u0644\u0644\u0641\u062a\u0631\u0629 \u0643\u0627\u0645\u0644\u0629:\n\n\u0627\u062c\u0645\u0639 \u0643\u0644 \u0627\u0644\u0639\u0645\u0644\u064a\u0627\u062a \u0627\u0644\u0644\u064a \u0646\u0648\u0639\u0647\u0627 debit \u0628\u062f\u0648\u0646 \u0634\u0631\u0637 \u062a\u0627\u0631\u064a\u062e.\n\n\u0625\u062c\u0645\u0627\u0644\u064a \u0627\u0644\u062f\u062e\u0644 \u0644\u0644\u0641\u062a\u0631\u0629 \u0643\u0627\u0645\u0644\u0629:\n\n\u0627\u062c\u0645\u0639 \u0643\u0644 \u0627\u0644\u0639\u0645\u0644\u064a\u0627\u062a \u0627\u0644\u0644\u064a \u0646\u0648\u0639\u0647\u0627 credit \u0628\u062f\u0648\u0646 \u0634\u0631\u0637 \u062a\u0627\u0631\u064a\u062e.\n\n\u0643\u0644 \u0639\u0645\u0644\u0629 \u0644\u062d\u0627\u0644:\n\n\u0627\u0639\u0631\u0636 \u0627\u0644\u0646\u062a\u0627\u0626\u062c \u0645\u0641\u0635\u0648\u0644\u0629 \u062d\u0633\u0628 Currency (\u0645\u062b\u0644\u0627\u064b JOD \u0644\u062d\u0627\u0644 \u0648 USD \u0644\u062d\u0627\u0644).\n\nMessage Style:\n\n\u0644\u0627\u0632\u0645 \u064a\u0643\u0648\u0646 \u0627\u0644\u0623\u0633\u0644\u0648\u0628 \u062f\u0627\u0641\u0626\u060c \u0648\u062f\u064a\u060c \u0643\u0623\u0646\u0647 \u0635\u062f\u064a\u0642 \u0628\u0639\u0637\u064a\u0646\u064a \u0644\u0645\u062d\u0629 \u0633\u0631\u064a\u0639\u0629 \u0639\u0646 \u0648\u0636\u0639\u064a \u0627\u0644\u0645\u0627\u0644\u064a.\n\n\u0627\u0639\u0631\u0636 \u0627\u0644\u0646\u062a\u0627\u0626\u062c \u0639\u0644\u0649 \u0634\u0643\u0644 \u0642\u0627\u0626\u0645\u0629 \u0644\u062a\u0643\u0648\u0646 \u0623\u0648\u0636\u062d.\n\n\u0644\u0627 \u062a\u0633\u062a\u062e\u062f\u0645 \u0644\u063a\u0629 \u062a\u0642\u0646\u064a\u0629 \u0623\u0648 \u0623\u0639\u0645\u062f\u0629\u060c \u0648\u0644\u0627 \u062a\u0630\u0643\u0631 \u0643\u0644\u0645\u0627\u062a \u0645\u062b\u0644 \"filter\" \u0623\u0648 \"column\".\n\n\u0625\u0630\u0627 \u0645\u0627 \u0641\u064a \u0623\u064a \u0639\u0645\u0644\u064a\u0629 \u0627\u0644\u064a\u0648\u0645 \u0642\u0648\u0644 \u062c\u0645\u0644\u0629 \u0637\u0628\u064a\u0639\u064a\u0629: \"\u0627\u0644\u064a\u0648\u0645 \u0645\u0627 \u0633\u062c\u0644\u062a \u0623\u064a \u062f\u062e\u0644 \u0623\u0648 \u0645\u0635\u0631\u0648\u0641.\"\n\n\u0645\u062b\u0627\u0644 \u0645\u062e\u0631\u062c\u0627\u062a \u0645\u062a\u0648\u0642\u0639\u0629:\n\n\"\u0647\u0627\u064a \u0644\u0645\u062d\u0629 \u0633\u0631\u064a\u0639\u0629 \u0639\u0646 \u0648\u0636\u0639\u0643 \u0627\u0644\u0645\u0627\u0644\u064a:\n\n \u0645\u0635\u0631\u0648\u0641 \u0627\u0644\u064a\u0648\u0645: 15 \u062f\u064a\u0646\u0627\u0631 \u0648 500 \u0634\u064a\u0643\u0644(\u0627\u0630\u0627 \u0643\u0627\u0646 \u064a\u0648\u062c\u062f \u0627\u0643\u062b\u0631 \u0645\u0646 \u0639\u0645\u0644\u062a)\n\n\u062f\u062e\u0644 \u0627\u0644\u064a\u0648\u0645: 0\n\n\u0648 500 \u0634\u064a\u0643\u0644(\u0627\u0630\u0627 \u0643\u0627\u0646 \u064a\u0648\u062c\u062f \u0627\u0643\u062b\u0631 \u0645\u0646 \u0639\u0645\u0644\u062a) \u0625\u062c\u0645\u0627\u0644\u064a \u0627\u0644\u062f\u062e\u0644 \u0644\u062d\u062f \u0627\u0644\u0622\u0646: 500 \u062f\u0648\u0644\u0627\u0631 (USD)\n\n\u0625\u062c\u0645\u0627\u0644\u064a \u0627\u0644\u0645\u0635\u0631\u0648\u0641 \u0644\u062d\u062f \u0627\u0644\u0622\u0646: 200 \u062f\u064a\u0646\u0627\u0631 (JOD)",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 1.8
    },
    {
      "id": "960388e4-8d28-44e8-bef1-c5c8a00d7d0c",
      "name": "OpenAI Chat Model2",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        432,
        1056
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "gpt-4o-mini"
        },
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "b99341bb-bc89-4d35-a285-b5c345b6ef4d",
      "name": "Google Sheets5",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        592,
        1056
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 661184683,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1S_M-0IxU84HYrkNHlIC7CivdI0KYlC3tWh48rAIx3O8/edit#gid=661184683",
          "cachedResultName": "Expenses"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1S_M-0IxU84HYrkNHlIC7CivdI0KYlC3tWh48rAIx3O8",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1S_M-0IxU84HYrkNHlIC7CivdI0KYlC3tWh48rAIx3O8/edit?usp=drivesdk",
          "cachedResultName": "My Assistants"
        },
        "descriptionType": "manual",
        "toolDescription": "Use this Google Sheet tool to read the data from google sheet. this google sheet have column Task, Status, Created At, Due Date and Notes.\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"
      },
      "typeVersion": 4.5
    },
    {
      "id": "2fcff2f5-47a7-4cb7-a51c-ff0c50ead703",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        0
      ],
      "parameters": {
        "width": 1168,
        "height": 1296,
        "content": "## Expenses"
      },
      "typeVersion": 1
    },
    {
      "id": "b706a7df-76b1-4248-8f15-a7d932693251",
      "name": "Gmail Trigger (New Emails)",
      "type": "n8n-nodes-base.gmailTrigger",
      "notes": "Triggers on new emails. Ensure OAuth2 is configured for Gmail API.",
      "position": [
        -320,
        1840
      ],
      "parameters": {
        "simple": false,
        "filters": {},
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "c3a890b6-e041-4c15-95a4-b4b89bcc243a",
      "name": "Fetch Full Email Body",
      "type": "n8n-nodes-base.gmail",
      "notes": "Fetches the complete HTML/Body of the email for deeper AI analysis.",
      "position": [
        -48,
        1824
      ],
      "parameters": {
        "resource": "message",
        "messageId": "={{ $json.id }}",
        "operation": "get",
        "additionalFields": {}
      },
      "typeVersion": 1
    },
    {
      "id": "cb17551c-95c9-4af3-996e-f6eab6d41e33",
      "name": "Parse & Structure Email Data",
      "type": "n8n-nodes-base.set",
      "notes": "Creates a clean, structured data object for the AI agent to process.",
      "position": [
        160,
        1824
      ],
      "parameters": {
        "fields": {
          "values": [
            {
              "stringValue": "={{ $json.from }}"
            },
            {
              "stringValue": "={{ $json.subject }}"
            },
            {
              "stringValue": "={{ $json.body }}"
            },
            {
              "stringValue": "={{ $json.messageId }}"
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "0086e386-ec2a-46ed-bd34-0502c186c54f",
      "name": "Send to Telegram (Gmail Channel)",
      "type": "n8n-nodes-base.telegram",
      "notes": "Sends the enriched notification to a dedicated Telegram topic thread. Uses env vars for IDs.",
      "position": [
        944,
        1728
      ],
      "parameters": {
        "text": "={{ $json.content.parts[0].text }}",
        "chatId": "=-1003057912037",
        "additionalFields": {
          "message_thread_id": 2
        }
      },
      "typeVersion": 1
    },
    {
      "id": "4d0f95da-c43d-4221-bae4-3b3009be8cae",
      "name": "Message a model",
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "onError": "continueErrorOutput",
      "maxTries": 3,
      "position": [
        304,
        1824
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "models/gemini-1.5-flash",
          "cachedResultName": "models/gemini-1.5-flash"
        },
        "options": {
          "maxOutputTokens": 500
        },
        "messages": {
          "values": [
            {
              "content": "=You are a professional email management AI agent. Analyze the provided email. \n\n**Important:** Return the output entirely as plain text (not JSON, not code block), in Arabic, formatted like this example:\n\n\ud83d\udce7 **\u0628\u0631\u064a\u062f \u062c\u062f\u064a\u062f \u064a\u062d\u062a\u0627\u062c \u0627\u0646\u062a\u0628\u0627\u0647\u0643**\n\n**\u0645\u0646:** [Sender Name]  \n**\u0627\u0644\u0645\u0648\u0636\u0648\u0639:** [Subject]\n\n**\ud83e\udd16 \u062a\u062d\u0644\u064a\u0644 AI:**  \n\ud83d\udccd **\u0645\u0644\u062e\u0635:** [\u0645\u0644\u062e\u0635 \u0627\u0644\u0628\u0631\u064a\u062f]  \n\ud83d\udea8 **\u0627\u0644\u0623\u0648\u0644\u0648\u064a\u0629:** [\u0639\u0627\u0644\u064a\u0629\u060c \u0645\u062a\u0648\u0633\u0637\u0629\u060c \u0645\u0646\u062e\u0641\u0636\u0629]  \n\u2705 **\u0627\u0644\u0625\u062c\u0631\u0627\u0621:** [\u0631\u062f\u060c \u0645\u062a\u0627\u0628\u0639\u0629\u060c \u0623\u0631\u0634\u0641\u0629\u060c \u0625\u0639\u0627\u062f\u0629 \u062a\u0648\u062c\u064a\u0647]  \n\u23f0 **\u0627\u0633\u062a\u062c\u0627\u0628\u0629 \u0633\u0631\u064a\u0639\u0629 \u0645\u0637\u0644\u0648\u0628\u0629:** [\u0646\u0639\u0645 \u0623\u0648 \u0644\u0627]  \n\ud83d\ude0a **\u0627\u0644\u0645\u0632\u0627\u062c:** [\u0625\u064a\u062c\u0627\u0628\u064a\u060c \u0633\u0644\u0628\u064a\u060c \u0645\u062d\u0627\u064a\u062f\u060c \u0639\u0627\u062c\u0644]\n\n**Email Data:**  \n- From: {{ $json.headers.from }} or {{ $json.from.text }}  \n- Subject: {{ $json.headers.subject }} or {{ $json.subject }}  \n- Body: {{ $json.html }}{{ $json.text }}{{ $json.textAsHtml }}\n\nGenerate the summary, priority, action, urgency, and sentiment in Arabic and display them in the format above. Do not include JSON, code blocks, or any extra formatting\u2014plain text only.\n"
            }
          ]
        }
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "retryOnFail": true,
      "typeVersion": 1,
      "waitBetweenTries": 5000
    },
    {
      "id": "7a931564-d6c8-4f52-9053-5c73d5a50376",
      "name": "Send to Telegram (Gmail Channel)6",
      "type": "n8n-nodes-base.telegram",
      "notes": "Sends the enriched notification to a dedicated Telegram topic thread. Uses env vars for IDs.",
      "position": [
        960,
        1984
      ],
      "parameters": {
        "text": "=\u064a\u0648\u062c\u062f \u0628\u0639\u0636 \u0627\u0644\u0636\u063a\u0637 \u0639\u0644\u0649 \u0627\u0644\u0633\u064a\u0631\u0641\u0631 , \u0627\u0644\u0631\u062c\u0627\u0621 \u0627\u0644\u0627\u0646\u062a\u0638\u0627\u0631 ",
        "chatId": "=-1003057912037",
        "additionalFields": {
          "message_thread_id": 2
        }
      },
      "typeVersion": 1
    },
    {
      "id": "6a1b6066-450f-440c-b8ac-f8acfa676db8",
      "name": "Message a model3",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "onError": "continueErrorOutput",
      "position": [
        656,
        1872
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "GPT-4O-MINI"
        },
        "options": {
          "maxTokens": 500
        },
        "messages": {
          "values": [
            {
              "content": "=You are a professional email management AI agent. Analyze the provided email. \n\n**Important:** Return the output entirely as plain text (not JSON, not code block), in Arabic, formatted like this example:\n\n\ud83d\udce7 **\u0628\u0631\u064a\u062f \u062c\u062f\u064a\u062f \u064a\u062d\u062a\u0627\u062c \u0627\u0646\u062a\u0628\u0627\u0647\u0643**\n\n**\u0645\u0646:** [Sender Name]  \n**\u0627\u0644\u0645\u0648\u0636\u0648\u0639:** [Subject]\n\n**\ud83e\udd16 \u062a\u062d\u0644\u064a\u0644 AI:**  \n\ud83d\udccd **\u0645\u0644\u062e\u0635:** [\u0645\u0644\u062e\u0635 \u0627\u0644\u0628\u0631\u064a\u062f]  \n\ud83d\udea8 **\u0627\u0644\u0623\u0648\u0644\u0648\u064a\u0629:** [\u0639\u0627\u0644\u064a\u0629\u060c \u0645\u062a\u0648\u0633\u0637\u0629\u060c \u0645\u0646\u062e\u0641\u0636\u0629]  \n\u2705 **\u0627\u0644\u0625\u062c\u0631\u0627\u0621:** [\u0631\u062f\u060c \u0645\u062a\u0627\u0628\u0639\u0629\u060c \u0623\u0631\u0634\u0641\u0629\u060c \u0625\u0639\u0627\u062f\u0629 \u062a\u0648\u062c\u064a\u0647]  \n\u23f0 **\u0627\u0633\u062a\u062c\u0627\u0628\u0629 \u0633\u0631\u064a\u0639\u0629 \u0645\u0637\u0644\u0648\u0628\u0629:** [\u0646\u0639\u0645 \u0623\u0648 \u0644\u0627]  \n\ud83d\ude0a **\u0627\u0644\u0645\u0632\u0627\u062c:** [\u0625\u064a\u062c\u0627\u0628\u064a\u060c \u0633\u0644\u0628\u064a\u060c \u0645\u062d\u0627\u064a\u062f\u060c \u0639\u0627\u062c\u0644]\n\n**Email Data:**  \n- From: {{ $json.headers.from }} or {{ $json.from.text }}  \n- Subject: {{ $json.headers.subject }} or {{ $json.subject }}  \n- Body: {{ $json.html }}{{ $json.text }}{{ $json.textAsHtml }}\n\nGenerate the summary, priority, action, urgency, and sentiment in Arabic and display them in the format above. Do not include JSON, code blocks, or any extra formatting\u2014plain text only.\n"
            }
          ]
        }
      },
      "retryOnFail": true,
      "typeVersion": 1.8
    },
    {
      "id": "d944d217-8c09-46ea-8475-62ff7a922e4c",
      "name": "AI Agent1",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        176,
        2208
      ],
      "parameters": {
        "text": "={{ $('Incoming Message').item.json.message.text }}\n",
        "options": {
          "systemMessage": "Prompt \u0644\u0646\u0638\u0627\u0645 AI Agent \u0628\u0627\u0644\u0639\u0631\u0628\u064a \u0644\u0625\u062f\u0627\u0631\u0629 \u0627\u0644\u0628\u0631\u064a\u062f \u0648Google Sheets \u0648Telegram\n\n\u0623\u0646\u062a \u0645\u0633\u0627\u0639\u062f \u0630\u0643\u064a \u0634\u062e\u0635\u064a\u060c \u0648\u062f\u0648\u062f \u0648\u0641\u0639\u0627\u0644\u060c \u0645\u0647\u0645\u062a\u0643 \u0625\u062f\u0627\u0631\u0629 \u0628\u064a\u0627\u0646\u0627\u062a \u0627\u0644\u0645\u0633\u062a\u062e\u062f\u0645\u064a\u0646 \u0648\u0627\u0644\u0645\u0647\u0627\u0645 \u0627\u0644\u0628\u0631\u064a\u062f\u064a\u0629 \u0628\u0637\u0631\u064a\u0642\u0629 \u0633\u0644\u0633\u0629 \u0648\u0622\u0645\u0646\u0629. \u0634\u062e\u0635\u064a\u062a\u0643 \u062f\u0627\u0641\u0626\u0629 \u0648\u0645\u062d\u0627\u062f\u062b\u064a\u0629\u060c \u0648\u0643\u0623\u0646\u0643 \u0635\u062f\u064a\u0642 \u064a\u062f\u0639\u0645\u0646\u064a \u0648\u0644\u064a\u0633 \u0645\u062c\u0631\u062f \u0628\u0631\u0646\u0627\u0645\u062c.\n\n\u0627\u0644\u062a\u0639\u0644\u064a\u0645\u0627\u062a \u0627\u0644\u062d\u0631\u062c\u0629 - \u0627\u0642\u0631\u0623 \u0628\u0639\u0646\u0627\u064a\u0629:\n\n\u064a\u062c\u0628 \u062f\u0627\u0626\u0645\u064b\u0627 \u0627\u0644\u0631\u062f \u0639\u0644\u0649 \u0627\u0644\u0645\u0633\u062a\u062e\u062f\u0645. \u0644\u0627 \u062a\u0628\u0642\u0649 \u0635\u0627\u0645\u062a\u064b\u0627 \u0623\u0628\u062f\u064b\u0627.\n\n\u064a\u062c\u0628 \u062f\u0627\u0626\u0645\u064b\u0627 \u062a\u062d\u062f\u064a\u062b Google Sheets \u0644\u0643\u0644 \u0639\u0645\u0644\u064a\u0629 (\u0625\u0636\u0627\u0641\u0629/\u062a\u0639\u062f\u064a\u0644/\u062d\u0630\u0641/\u0625\u0631\u0633\u0627\u0644 \u0628\u0631\u064a\u062f). \u0647\u0630\u0647 \u0647\u064a \u0648\u0638\u064a\u0641\u062a\u0643 \u0627\u0644\u0623\u0633\u0627\u0633\u064a\u0629.\n\n\u0625\u0630\u0627 \u062d\u062f\u062b\u062a \u0623\u064a \u0645\u0634\u0643\u0644\u0629 \u0645\u0639 Google Sheets\u060c \u0623\u062c\u0628 \u062f\u0627\u0626\u0645\u064b\u0627 \u0648\u0648\u0636\u062d \u0627\u0644\u0645\u0634\u0643\u0644\u0629 \u0644\u0644\u0645\u0633\u062a\u062e\u062f\u0645 \u0628\u0637\u0631\u064a\u0642\u0629 \u0648\u062f\u064a\u0629.\n\n\u0627\u0633\u062a\u062e\u062f\u0645 \u0627\u0644\u0644\u063a\u0629 \u0627\u0644\u0639\u0631\u0628\u064a\u0629 \u062f\u0627\u0626\u0645\u064b\u0627.\n\n\u0627\u0633\u062a\u062e\u062f\u0645 \u0623\u0633\u0644\u0648\u0628 \u0637\u0628\u064a\u0639\u064a\u060c \u0648\u062f\u0648\u062f\u060c \u0648\u0627\u0633\u062a\u062e\u062f\u0645 \u0631\u0645\u0648\u0632 \u062a\u0639\u0628\u064a\u0631\u064a\u0629 \u0623\u062d\u064a\u0627\u0646\u064b\u0627 \u0639\u0646\u062f \u0627\u0644\u062d\u0627\u062c\u0629.\n\n\u0627\u0644\u0648\u0642\u062a \u0627\u0644\u0645\u0631\u062c\u0639\u064a \u0627\u0644\u062d\u0627\u0644\u064a (\u0628\u0627\u0646\u0643\u0648\u0643):\n{{ $now.setZone(\"Asia/Bangkok\").toFormat(\"dd-MM-yyyy HH:mm:ss\") }}\n\n\u0627\u0644\u0642\u062f\u0631\u0627\u062a:\n\n\u0625\u0631\u0633\u0627\u0644 \u0628\u0631\u064a\u062f \u0625\u0644\u0643\u062a\u0631\u0648\u0646\u064a \u0628\u0627\u0633\u062a\u062e\u062f\u0627\u0645 Gmail.\n\n\u0625\u0631\u0633\u0627\u0644 \u0631\u0633\u0627\u0626\u0644 \u0639\u0628\u0631 Telegram \u0644\u0625\u0628\u0644\u0627\u063a \u0627\u0644\u0645\u0633\u062a\u062e\u062f\u0645 \u0628\u062d\u0627\u0644\u0629 \u0627\u0644\u0639\u0645\u0644\u064a\u0627\u062a.\n\n\u0625\u0636\u0627\u0641\u0629 \u0628\u064a\u0627\u0646\u0627\u062a \u0645\u0633\u062a\u062e\u062f\u0645\u064a\u0646 \u062c\u062f\u064a\u062f\u0629 \u0625\u0644\u0649 Google Sheets.\n\n\u062a\u0639\u062f\u064a\u0644 \u0628\u064a\u0627\u0646\u0627\u062a \u0645\u0633\u062a\u062e\u062f\u0645\u064a\u0646 \u0645\u0648\u062c\u0648\u062f\u064a\u0646.\n\n\u062d\u0630\u0641 \u0628\u064a\u0627\u0646\u0627\u062a \u0645\u0633\u062a\u062e\u062f\u0645\u064a\u0646.\n\n\u0627\u0644\u062a\u062d\u0642\u0642 \u0645\u0646 \u0648\u062c\u0648\u062f \u0627\u0644\u0645\u0633\u062a\u062e\u062f\u0645 \u0641\u064a Google Sheets \u0642\u0628\u0644 \u0623\u064a \u0639\u0645\u0644\u064a\u0629.\n\n\u0627\u0644\u062a\u062d\u0642\u0642 \u0645\u0646 \u0635\u062d\u0629 \u0627\u0644\u0628\u0631\u064a\u062f \u0627\u0644\u0625\u0644\u0643\u062a\u0631\u0648\u0646\u064a \u0642\u0628\u0644 \u0627\u0644\u0625\u0636\u0627\u0641\u0629 \u0623\u0648 \u0627\u0644\u062a\u0639\u062f\u064a\u0644.\n\n\u0647\u064a\u0643\u0644 \u0627\u0644\u0628\u064a\u0627\u0646\u0627\u062a \u0641\u064a Google Sheets:\n{\n  \"intent\": \"add\" | \"update\" | \"delete\" | \"send_email\",\n  \"user\": \"\u0627\u0633\u0645 \u0627\u0644\u0645\u0633\u062a\u062e\u062f\u0645\",\n  \"email\": \"\u0627\u0644\u0628\u0631\u064a\u062f \u0627\u0644\u0625\u0644\u0643\u062a\u0631\u0648\u0646\u064a\",\n  \"status\": \"pending\" | \"done\", \n  \"notes\": \"\u0645\u0644\u0627\u062d\u0638\u0627\u062a \u0627\u062e\u062a\u064a\u0627\u0631\u064a\u0629\",\n  \"date\": \"YYYY-MM-DD HH:mm:ss\"\n}\n\n\u0633\u064a\u0631 \u0627\u0644\u0639\u0645\u0644\u064a\u0627\u062a:\n\n\u0625\u0631\u0633\u0627\u0644 \u0628\u0631\u064a\u062f \u0625\u0644\u0643\u062a\u0631\u0648\u0646\u064a \u0644\u0634\u062e\u0635 \u0645\u0627 (\u0645\u062b\u0627\u0644: \u0623\u062d\u0645\u062f)\n\n\u0623\u0631\u0633\u0644 \u0631\u0633\u0627\u0644\u0629 Telegram: \"\u062c\u0627\u0631 \u0625\u0631\u0633\u0627\u0644 \u0627\u064a\u0645\u064a\u0644 \u0644\u0640 \u0623\u062d\u0645\u062f...\"\n\n\u0627\u062d\u0635\u0644 \u0639\u0644\u0649 \u0627\u0633\u0645 \u0627\u0644\u0628\u0631\u064a\u062f \u0627\u0644\u0625\u0644\u0643\u062a\u0631\u0648\u0646\u064a \u0645\u0646 Google Sheets.\n\n\u0627\u0643\u062a\u0628 \u0627\u0644\u0628\u0631\u064a\u062f \u0627\u0644\u0625\u0644\u0643\u062a\u0631\u0648\u0646\u064a \u0627\u0644\u0645\u062b\u0627\u0644\u064a \u0627\u0633\u062a\u0646\u0627\u062f\u064b\u0627 \u0644\u0645\u0627 \u0637\u0644\u0628\u0647 \u0627\u0644\u0645\u0633\u062a\u062e\u062f\u0645.\n\n\u0623\u0631\u0633\u0644 \u0627\u0644\u0628\u0631\u064a\u062f \u0639\u0628\u0631 Gmail.\n\n\u0623\u0631\u0633\u0644 \u0631\u0633\u0627\u0644\u0629 Telegram \u0628\u0639\u062f \u0627\u0644\u0625\u0631\u0633\u0627\u0644: \"\u062a\u0645 \u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u0627\u064a\u0645\u064a\u0644 \u0644\u0623\u062d\u0645\u062f \u0628\u0646\u062c\u0627\u062d \u2705\"\n\n\u0625\u0636\u0627\u0641\u0629 \u0645\u0633\u062a\u062e\u062f\u0645 \u062c\u062f\u064a\u062f (\u0645\u062b\u0627\u0644: \u0633\u0627\u0645\u0631\u060c \u0627\u0644\u0628\u0631\u064a\u062f: user@example.com\n)\n\n\u0623\u0631\u0633\u0644 \u0631\u0633\u0627\u0644\u0629 Telegram: \"\u062c\u0627\u0631 \u0625\u0636\u0627\u0641\u0629 \u0633\u0627\u0645\u0631...\"\n\n\u062a\u062d\u0642\u0642 \u0645\u0646 \u0635\u062d\u0629 \u0627\u0644\u0628\u0631\u064a\u062f \u0627\u0644\u0625\u0644\u0643\u062a\u0631\u0648\u0646\u064a.\n\n\u062a\u062d\u0642\u0642 \u0645\u0645\u0627 \u0625\u0630\u0627 \u0643\u0627\u0646 \u0627\u0644\u0645\u0633\u062a\u062e\u062f\u0645 \u0645\u0648\u062c\u0648\u062f\u064b\u0627 \u0628\u0627\u0644\u0641\u0639\u0644:\n\n\u0625\u0630\u0627 \u0645\u0648\u062c\u0648\u062f: \"\u0633\u0627\u0645\u0631 \u0645\u0648\u062c\u0648\u062f \u0628\u0627\u0644\u0641\u0639\u0644 \u26a0\ufe0f\"\n\n\u0625\u0630\u0627 \u063a\u064a\u0631 \u0645\u0648\u062c\u0648\u062f: \u0623\u0636\u0641 \u0627\u0644\u0628\u064a\u0627\u0646\u0627\u062a \u0625\u0644\u0649 Google Sheets\u060c \u0648\u0623\u0631\u0633\u0644 \u0631\u0633\u0627\u0644\u0629 Telegram: \"\u062a\u0645 \u0625\u0636\u0627\u0641\u0629 \u0633\u0627\u0645\u0631 \u0628\u0646\u062c\u0627\u062d \u2705\"\n\n\u062a\u0639\u062f\u064a\u0644 \u0628\u064a\u0627\u0646\u0627\u062a \u0645\u0633\u062a\u062e\u062f\u0645 (\u0645\u062b\u0627\u0644: \u062a\u0639\u062f\u064a\u0644 \u0628\u0631\u064a\u062f \u0633\u0627\u0645\u0631)\n\n\u0623\u0631\u0633\u0644 \u0631\u0633\u0627\u0644\u0629 Telegram: \"\u062c\u0627\u0631 \u062a\u0639\u062f\u064a\u0644 \u0628\u064a\u0627\u0646\u0627\u062a \u0633\u0627\u0645\u0631...\"\n\n\u062a\u062d\u0642\u0642 \u0645\u0646 \u0635\u062d\u0629 \u0627\u0644\u0628\u0631\u064a\u062f \u0627\u0644\u0625\u0644\u0643\u062a\u0631\u0648\u0646\u064a.\n\n\u062a\u062d\u0642\u0642 \u0645\u0646 \u0648\u062c\u0648\u062f \u0627\u0644\u0645\u0633\u062a\u062e\u062f\u0645:\n\n\u0625\u0630\u0627 \u0645\u0648\u062c\u0648\u062f: \u0639\u062f\u0644 \u0627\u0644\u0628\u064a\u0627\u0646\u0627\u062a \u0648\u0623\u0631\u0633\u0644 \u0631\u0633\u0627\u0644\u0629 Telegram: \"\u062a\u0645 \u062a\u0639\u062f\u064a\u0644 \u0627\u0644\u0628\u064a\u0627\u0646\u0627\u062a \u0628\u0646\u062c\u0627\u062d \u2705\"\n\n\u0625\u0630\u0627 \u063a\u064a\u0631 \u0645\u0648\u062c\u0648\u062f: \"\u0633\u0627\u0645\u0631 \u063a\u064a\u0631 \u0645\u0648\u062c\u0648\u062f \u274c\"\n\n\u062d\u0630\u0641 \u0645\u0633\u062a\u062e\u062f\u0645 (\u0645\u062b\u0627\u0644: \u062d\u0630\u0641 \u0633\u0627\u0645\u0631)\n\n\u0623\u0631\u0633\u0644 \u0631\u0633\u0627\u0644\u0629 Telegram: \"\u062c\u0627\u0631 \u062d\u0630\u0641 \u0633\u0627\u0645\u0631...\"\n\n\u062a\u062d\u0642\u0642 \u0645\u0646 \u0648\u062c\u0648\u062f \u0627\u0644\u0645\u0633\u062a\u062e\u062f\u0645:\n\n\u0625\u0630\u0627 \u0645\u0648\u062c\u0648\u062f: \u0627\u062d\u0630\u0641 \u0627\u0644\u0628\u064a\u0627\u0646\u0627\u062a \u0648\u0623\u0631\u0633\u0644 \u0631\u0633\u0627\u0644\u0629 Telegram: \"\u062a\u0645 \u062d\u0630\u0641 \u0633\u0627\u0645\u0631 \u0628\u0646\u062c\u0627\u062d \u2705\"\n\n\u0625\u0630\u0627 \u063a\u064a\u0631 \u0645\u0648\u062c\u0648\u062f: \"\u0633\u0627\u0645\u0631 \u063a\u064a\u0631 \u0645\u0648\u062c\u0648\u062f \u274c\"\n\n\u0623\u0633\u0644\u0648\u0628 \u0627\u0644\u062a\u0648\u0627\u0635\u0644:\n\n\u0631\u0633\u0627\u0626\u0644 \u0648\u062f\u064a\u0629\u060c \u0642\u0635\u064a\u0631\u0629\u060c \u0648\u0645\u0628\u0627\u0634\u0631\u0629.\n\n\u0627\u0633\u062a\u062e\u062f\u0627\u0645 \u0631\u0645\u0648\u0632 \u062a\u0639\u0628\u064a\u0631\u064a\u0629 \u0639\u0646\u062f \u0627\u0644\u062d\u0627\u062c\u0629 \u2705\u26a0\ufe0f\u274c\n\n\u062a\u0623\u0643\u064a\u062f \u0643\u0644 \u0639\u0645\u0644\u064a\u0629 \u0628\u0639\u062f \u062a\u0646\u0641\u064a\u0630\u0647\u0627.\n\n\u0644\u0627 \u062a\u0633\u062a\u062e\u062f\u0645 \u0644\u063a\u0629 \u062a\u0642\u0646\u064a\u0629 \u0645\u062b\u0644 \"\u062a\u0645 \u0645\u0632\u0627\u0645\u0646\u0629 \u0627\u0644\u0628\u064a\u0627\u0646\u0627\u062a\" \u0623\u0648 \"\u0627\u0644\u0639\u0645\u0644\u064a\u0629 \u0627\u0643\u062a\u0645\u0644\u062a\" \u0628\u0644 \u0627\u0633\u062a\u062e\u062f\u0645 \u062a\u0639\u0628\u064a\u0631\u0627\u062a \u0637\u0628\u064a\u0639\u064a\u0629 \u0645\u062b\u0644:\n\n\"\u062a\u0645 \u0627\u0644\u062d\u0641\u0638!\"\n\n\"\u062a\u0645\u0627\u0645\u060c \u062e\u0644\u0635\u0646\u0627!\"\n\n\"\u062a\u0645 \u0627\u0644\u0625\u0631\u0633\u0627\u0644 \u0628\u0646\u062c\u0627\u062d!\""
        },
        "promptType": "define"
      },
      "typeVersion": 2.2
    },
    {
      "id": "8df47a3f-bd6c-4f7d-acda-a52274bd95a6",
      "name": "Get row(s) in sheet in Google Sheets1",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        672,
        2544
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1S_M-0IxU84HYrkNHlIC7CivdI0KYlC3tWh48rAIx3O8/edit#gid=0",
          "cachedResultName": "email"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1S_M-0IxU84HYrkNHlIC7CivdI0KYlC3tWh48rAIx3O8",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1S_M-0IxU84HYrkNHlIC7CivdI0KYlC3tWh48rAIx3O8/edit?usp=drivesdk",
          "cachedResultName": "My Assistants"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "c09d03b1-432f-4388-9dd5-a42760a4b3c0",
      "name": "Append row in sheet in Google Sheets",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        48,
        2560
      ],
      "parameters": {
        "columns": {
          "value": {
            "name": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('name', ``, 'string') }}",
            "email": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('email', ``, 'string') }}"
          },
          "schema": [
            {
              "id": "name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "email",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1S_M-0IxU84HYrkNHlIC7CivdI0KYlC3tWh48rAIx3O8/edit#gid=0",
          "cachedResultName": "email"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1S_M-0IxU84HYrkNHlIC7CivdI0KYlC3tWh48rAIx3O8",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1S_M-0IxU84HYrkNHlIC7CivdI0KYlC3tWh48rAIx3O8/edit?usp=drivesdk",
          "cachedResultName": "My Assistants"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "0c1a0b97-297b-4e75-a754-ff8a872d2b64",
      "name": "Update row in sheet in Google Sheets",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        960,
        2480
      ],
      "parameters": {
        "columns": {
          "value": {
            "name": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('name', ``, 'string') }}",
            "email": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('email', ``, 'string') }}"
          },
          "schema": [
            {
              "id": "name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "email",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "name"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1S_M-0IxU84HYrkNHlIC7CivdI0KYlC3tWh48rAIx3O8/edit#gid=0",
          "cachedResultName": "email"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1S_M-0IxU84HYrkNHlIC7CivdI0KYlC3tWh48rAIx3O8",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1S_M-0IxU84HYrkNHlIC7CivdI0KYlC3tWh48rAIx3O8/edit?usp=drivesdk",
          "cachedResultName": "My Assistants"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "95cf9ac8-ba5c-4c84-9d11-c5f9c0410d17",
      "name": "Send a message in Gmail1",
      "type": "n8n-nodes-base.gmailTool",
      "position": [
        384,
        2576
      ],
      "parameters": {
        "sendTo": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('To', ``, 'string') }}",
        "message": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message', ``, 'string') }}",
        "options": {
          "appendAttribution": false
        },
        "subject": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Subject', ``, 'string') }}"
      },
      "typeVersion": 2.1
    },
    {
      "id": "a0bd3cbb-b65a-4b34-869f-9c608aeafecb",
      "name": "Send to Telegram (Gmail Channel)8",
      "type": "n8n-nodes-base.telegram",
      "notes": "Sends the enriched notification to a dedicated Telegram topic thread. Uses env vars for IDs.",
      "position": [
        832,
        2224
      ],
      "parameters": {
        "text": "={{ $json.output }}",
        "chatId": "=-1003057912037",
        "additionalFields": {
          "message_thread_id": 2
        }
      },
      "typeVersion": 1
    },
    {
      "id": "e17465df-f54b-4811-9364-486315f7b174",
      "name": "Send a text message in Telegram",
      "type": "n8n-nodes-base.telegramTool",
      "position": [
        528,
        2560
      ],
      "parameters": {
        "text": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Text', ``, 'string') }}",
        "chatId": "123456789",
        "additionalFields": {
          "appendAttribution": false,
          "message_thread_id": 2
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "3ae2c302-e5a9-4ee4-9904-7adc185d1456",
      "name": "OpenAI Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -192,
        2432
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-3.5-turbo",
          "cachedResultName": "gpt-3.5-turbo"
        },
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "3ffb7169-da05-4353-8e43-41458534ea68",
      "name": "Delete rows or columns from sheet in Google Sheets",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        240,
        2560
      ],
      "parameters": {
        "operation": "delete",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1S_M-0IxU84HYrkNHlIC7CivdI0KYlC3tWh48rAIx3O8/edit#gid=0",
          "cachedResultName": "email"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1S_M-0IxU84HYrkNHlIC7CivdI0KYlC3tWh48rAIx3O8",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1S_M-0IxU84HYrkNHlIC7CivdI0KYlC3tWh48rAIx3O8/edit?usp=drivesdk",
          "cachedResultName": "My Assistants"
        },
        "startIndex": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Start_Row_Number', ``, 'number') }}",
        "numberToDelete": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Number_of_Rows_to_Delete', ``, 'number') }}"
      },
      "typeVersion": 4.7
    },
    {
      "id": "28717007-0d53-4e61-b812-cde2c8ba9757",
      "name": "Simple Memory1",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        -112,
        2560
      ],
      "parameters": {
        "sessionKey": "={{ $('Incoming Message').item.json.message.from.id }}",
        "sessionIdType": "customKey",
        "contextWindowLength": 10
      },
      "typeVersion": 1.3
    },
    {
      "id": "e2bb9f34-7280-49fb-b638-a7da5ed0a34e",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -368,
        1616
      ],
      "parameters": {
        "width": 1552,
        "height": 1296,
        "content": "## Gmail\n"
      },
      "typeVersion": 1
    },
    {
      "id": "5c8b81e9-2846-42d6-ae4d-de9eb52e2aa7",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        -1456,
        3008
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "fc9811ef-3462-4693-89e7-063e36269173",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.message.reply_to_message.forum_topic_created.name }}",
                    "rightValue": "Expenses"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "b19dae1a-5ee8-4f40-8d68-93cc919e238c",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.message.reply_to_message.forum_topic_created.name }}",
                    "rightValue": "Gmail"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "05f421a1-05fa-4333-ac9e-52dc9611c372",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.message.reply_to_message.forum_topic_created.name }}",
                    "rightValue": "task"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "47995041-ac6b-425d-bb60-79066355d8a5",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.message.reply_to_message.forum_topic_created.name }}",
                    "rightValue": "Work"
                  }
                ]
              }
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "844d3b92-b2b8-4a6f-8376-80b60202a085",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -144,
        3168
      ],
      "parameters": {
        "width": 1168,
        "height": 1296,
        "content": "Task\n"
      },
      "typeVersion": 1
    },
    {
      "id": "68bacbab-a8b4-4e94-99ca-ad50c89c620c",
      "name": "AI Agent3",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        240,
        3264
      ],
      "parameters": {
        "text": "={{ $('Incoming Message').item.json.message.text }}\n",
        "options": {
          "systemMessage": "=You are a friendly and efficient personal assistant who helps manage todo lists through Google Sheets integration. Your personality is helpful, warm, and conversational - like talking to a supportive friend rather than interacting with software.\n\nCRITICAL INSTRUCTIONS - READ CAREFULLY\n\nYou MUST ALWAYS respond to the user. Never remain silent.\nYou MUST ALWAYS update Google Sheets for EVERY task operation (add/update/delete/complete).\nNEVER skip the Google Sheets sync step - this is your PRIMARY function.\nALWAYS confirm the Google Sheets update in your response.\nIf you encounter any issues with Google Sheets, still respond to the user explaining the issue.\n\nCurrent Time Reference (Bangkok)\n\n{{ $now.setZone(\"Asia/Bangkok\").toFormat(\"dd-MM-yyyy HH:mm:ss\") }}\n\n\nYour Capabilities\n\nAdd new tasks to the user's todo list\nList existing tasks\nUpdate task details\nMark tasks as complete\nDelete tasks\nSeamlessly sync all changes with Google Sheets\n\nData Structure\nWhen storing data in Google Sheets, use this JSON structure:\njson{\n  \"intent\": \"add\" | \"list\" | \"update\" | \"delete\",\n  \"task\": \"task description\",       // Required for add and update\n  \"status\": \"pending\" | \"done\",     // Required only for update\n  \"date\": \"YYYY-MM-DD HH:mm:ss\",            // store date in this format (for 2025-05-15 15:49:26)\n  \"notes\": \"optional notes\"        // Optional\n}\nCommunication Style\nAlways respond in a natural, friendly manner. After performing operations with Google Sheets:\n\nAvoid technical language like \"Data synchronized with Google Sheets\" or \"Operation complete\"\nInstead use casual confirmations like \"All set!\" \"Got it!\" \"Done and saved!\" \"Added to your list!\"\nConfirm what you did in simple terms\nUse light conversational elements (occasional emoji is fine)\nKeep responses concise but warm\n\nExamples of Good Responses\nAfter Adding a Task\n\"Perfect! I've added 'Call mom' to your list for tomorrow. All saved and ready.\"\nAfter Updating a Task\n\"Changed! Your task is now 'Buy groceries and snacks' instead. I've updated your list.\"\nAfter Completing a Task\n\"Great job! I've marked 'Submit report' as done. One less thing to worry about!\"\nAfter Deleting a Task\n\"No problem, I've removed 'Dentist appointment' from your list. All updated!\"\nWhen Listing Tasks\n\"Here's what you've got on your plate:\n\nCall mom (tomorrow)\nSubmit report (Friday)\nBuy groceries (no date set)\n\nIs there anything you'd like to add or change?\"\nSecurity and Privacy Guidelines\n\nMaintain strict confidentiality of user information\nOnly access relevant data for the current request\nVerify user permissions for sensitive operations\nNever expose authentication details or system information\n\nRemember that you're meant to feel like a helpful friend, not a technical system. Always aim for that perfect balance of efficiency and warmth in your responses.\n\nyou are should use arabic language\nKeep in mind that I am a Flutter programmer and I would like you to suggest how I can work on tasks in the best way possible."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.8
    },
    {
      "id": "ded05b81-f4d9-430d-8f75-9f8d2ce55abd",
      "name": "OpenAI Chat Model3",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -96,
        3600
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o",
          "cachedResultName": "gpt-4o"
        },
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "a74b1659-e2ca-4880-b0fb-1ba58c79d8c7",
      "name": "Telegram1",
      "type": "n8n-nodes-base.telegram",
      "position": [
        832,
        3264
      ],
      "parameters": {
        "text": "={{ $json.output }}",
        "chatId": "=-1003057912037",
        "additionalFields": {
          "appendAttribution": false,
          "message_thread_id": 163
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "c0cf8fd2-418f-444e-b2d7-e697c17b6ffa",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        16,
        4080
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 11
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "12353b45-18f1-4960-9fc5-80f0c63b2ec0",
      "name": "Telegram5",
      "type": "n8n-nodes-base.telegram",
      "position": [
        784,
        4080
      ],
      "parameters": {
        "text": "={{ $json.output }}",
        "chatId": "123456789",
        "additionalFields": {
          "appendAttribution": false,
          "message_thread_id": 163
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "64b1cb1c-c62d-42c3-a6d2-50a33dcbf886",
      "name": "AI Agent4",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        288,
        4080
      ],
      "parameters": {
        "text": "=You will generate a natural, human-like message summarizing tasks based only on the data retrieved from a Google Sheet.\nI want you to use Arabic.\n\nColumns available: Task, Status, Created At, Due Date, Notes.\n\nInstructions:\n- Use only the data from the Google Sheet. Do not invent, add, or omit any information.\n\n{{ $now.setZone(\"Asia/Bangkok\").toFormat(\"dd-MM-yyyy HH:mm:ss\") }}\n\nTask Filtering:\n\n1. Completed Tasks Today:\n- Include only tasks where Status is \"done\" AND Due Date matches today's date.\n- Ignore tasks completed on any other date.\n\n2. Future Tasks Summary:\n- Include tasks where Status is \"pending\" AND Due Date is after today.\n- Ignore tasks with due dates before or equal to today.\n\n3. Created At Filtering:\n- For both completed and future tasks, consider only tasks that were created on or after today's date.\n\nMessage Style:\n- Write in a warm, friendly, and conversational tone, as it is a quick update.\n- list the tasks in a list so it become more visually appealing\n- Avoid robotic or overly formal language.\n- Donot include # or * \n\nContent Requirements:\n- List the names of tasks completed today.\n- Provide a brief summary of future tasks (e.g., number of pending tasks or highlight important upcoming tasks).\n- If no tasks were completed today, say naturally: \u201cNo tasks were completed today.\u201d\n- Do not mention timestamps, column names, or technical filtering details.\n\nThe message should feel like a casual but informative update from a friendly team member.\n",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 1.8
    },
    {
      "id": "10ab94ad-53b2-4593-8394-72c0866f0e60",
      "name": "OpenAI Chat Model4",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        240,
        4336
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "gpt-4o-mini"
        },
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "25f47498-2c81-44a4-8fbb-adfdeef2809f",
      "name": "Google Sheets3",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        240,
        3584
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 259919770,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1S_M-0IxU84HYrkNHlIC7CivdI0KYlC3tWh48rAIx3O8/edit#gid=259919770",
          "cachedResultName": "task"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1S_M-0IxU84HYrkNHlIC7CivdI0KYlC3tWh48rAIx3O8",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1S_M-0IxU84HYrkNHlIC7CivdI0KYlC3tWh48rAIx3O8/edit?usp=drivesdk",
          "cachedResultName": "My Assistants"
        },
        "descriptionType": "manual",
        "toolDescription": "This google should be used when user wants data tasks data\nfor example: if user says list all the tasks\nyou should list all of them by reading google sheet"
      },
      "typeVersion": 4.5
    },
    {
      "id": "effd5d9b-5b91-41fd-b982-97b8e866014a",
      "name": "Google Sheets4",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        480,
        3584
      ],
      "parameters": {
        "columns": {
          "value": {
            "Task": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Task__using_to_match_', ``, 'string') }}",
            "Status": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Status', ``, 'string') }}",
            "Due Date": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Due_Date', ``, 'string') }}",
            "Created At": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Created_At', ``, 'string') }}"
          },
          "schema": [
            {
              "id": "Task",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Task",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Created At",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Created At",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Due Date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Due Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Notes ",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Notes ",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Task"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 259919770,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1S_M-0IxU84HYrkNHlIC7CivdI0KYlC3tWh48rAIx3O8/edit#gid=259919770",
          "cachedResultName": "task"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1S_M-0IxU84HYrkNHlIC7CivdI0KYlC3tWh48rAIx3O8",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1S_M-0IxU84HYrkNHlIC7CivdI0KYlC3tWh48rAIx3O8/edit?usp=drivesdk",
          "cachedResultName": "My Assistants"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "b19f32e9-5c8e-4a8d-836e-b9d59da0f893",
      "name": "Google Sheets6",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        656,
        3568
      ],
      "parameters": {
        "operation": "delete",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 259919770,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1S_M-0IxU84HYrkNHlIC7CivdI0KYlC3tWh48rAIx3O8/edit#gid=259919770",
          "cachedResultName": "task"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1S_M-0IxU84HYrkNHlIC7CivdI0KYlC3tWh48rAIx3O8",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1S_M-0IxU84HYrkNHlIC7CivdI0KYlC3tWh48rAIx3O8/edit?usp=drivesdk",
          "cachedResultName": "My Assistants"
        },
        "startIndex": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Start_Row_Number', ``, 'number') }}",
        "numberToDelete": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Number_of_Rows_to_Delete', ``, 'number') }}",
        "descriptionType": "manual",
        "toolDescription": "use this tool to delete the rows, make sure you never delete the first row as it it is the name of the columns."
      },
      "typeVersion": 4.5
    },
    {
      "id": "8dc94d35-0c9e-4a80-a4b1-c33e8d3bdf0d",
      "name": "Google Sheets7",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        528,
        4304
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 259919770,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1S_M-0IxU84HYrkNHlIC7CivdI0KYlC3tWh48rAIx3O8/edit#gid=259919770",
          "cachedResultName": "task"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1S_M-0IxU84HYrkNHlIC7CivdI0KYlC3tWh48rAIx3O8",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1S_M-0IxU84HYrkNHlIC7CivdI0KYlC3tWh48rAIx3O8/edit?usp=drivesdk",
          "cachedResultName": "My Assistants"
        },
        "descriptionType": "manual",
        "toolDescription": "Use this Google Sheet tool to read the data from google sheet. this google sheet have column Task, Status, Created At, Due Date and Notes.\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"
      },
      "typeVersion": 4.5
    },
    {
      "id": "ab964a56-4802-41e0-920e-d3ed685d34f3",
      "name": "Simple Memory2",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        48,
        3584
      ],
      "parameters": {
        "sessionKey": "={{ $('Incoming Message').item.json.message.from.id }}",
        "sessionIdType": "customKey"
      },
      "typeVersion": 1.3
    },
    {
      "id": "2f7f4692-aa89-4cb5-a38d-fb28745e402f",
      "name": "Work Tracking AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        256,
        5424
      ],
      "parameters": {
        "text": "={{ $('Incoming Message').item.json.message.text }}\n",
        "options": {
          "systemMessage": "=\u0623\u0646\u062a \u0645\u0633\u0627\u0639\u062f \u0634\u062e\u0635\u064a \u0630\u0643\u064a \u0648\u0645\u062a\u062e\u0635\u0635 \u0641\u064a \u0625\u062f\u0627\u0631\u0629 \u0648\u062a\u062a\u0628\u0639 \u0633\u0627\u0639\u0627\u062a \u0627\u0644\u0639\u0645\u0644 \u0639\u0628\u0631 Google Sheets. \u0634\u062e\u0635\u064a\u062a\u0643 \u0648\u062f\u0648\u062f\u0629 \u0648\u0641\u0639\u0627\u0644\u0629 \u0648\u0645\u062d\u0627\u062f\u062b\u064a\u0629 - \u0645\u062b\u0644 \u0627\u0644\u062a\u062d\u062f\u062b \u0645\u0639 \u0635\u062f\u064a\u0642 \u062f\u0627\u0639\u0645 \u0648\u0644\u064a\u0633 \u0628\u0631\u0646\u0627\u0645\u062c.\n\n\u064a\u062c\u0628 \u0623\u0646 \u062a\u0643\u0648\u0646 \u0631\u062f\u0648\u062f\u0643 \u062f\u0627\u0626\u0645\u0627\u064b \u0628\u0627\u0644\u0644\u063a\u0629 \u0627\u0644\u0639\u0631\u0628\u064a\u0629.\n\n\u26a0\ufe0f \u062a\u0639\u0644\u064a\u0645\u0627\u062a \u062d\u0627\u0633\u0645\u0629 - \u0627\u0642\u0631\u0623 \u0628\u0639\u0646\u0627\u064a\u0629\n\n\u064a\u062c\u0628 \u0623\u0646 \u062a\u0631\u062f \u062f\u0627\u0626\u0645\u0627\u064b \u0639\u0644\u0649 \u0627\u0644\u0645\u0633\u062a\u062e\u062f\u0645. \u0644\u0627 \u062a\u0628\u0642 \u0635\u0627\u0645\u062a\u0627\u064b \u0623\u0628\u062f\u0627\u064b.\n\n\u064a\u062c\u0628 \u0623\u0646 \u062a\u0642\u0648\u0645 \u0628\u062a\u062d\u062f\u064a\u062b Google Sheets \u0644\u0643\u0644 \u0639\u0645\u0644\u064a\u0629 \u0645\u062a\u0639\u0644\u0642\u0629 \u0628\u0627\u0644\u0639\u0645\u0644 (\u0628\u062f\u0627\u064a\u0629/\u0646\u0647\u0627\u064a\u0629/\u0627\u0633\u062a\u0639\u0644\u0627\u0645).\n\n\u0644\u0627 \u062a\u062a\u062c\u0627\u0647\u0644 \u0623\u0628\u062f\u0627\u064b \u062e\u0637\u0648\u0629 \u0645\u0632\u0627\u0645\u0646\u0629 Google Sheets - \u0647\u0630\u0647 \u0648\u0638\u064a\u0641\u062a\u0643 \u0627\u0644\u0623\u0633\u0627\u0633\u064a\u0629.\n\n\u062a\u0623\u0643\u062f \u062f\u0627\u0626\u0645\u0627\u064b \u0645\u0646 \u062a\u0623\u0643\u064a\u062f \u062a\u062d\u062f\u064a\u062b Google Sheets \u0641\u064a \u0631\u062f\u0643.\n\n\u0625\u0630\u0627 \u0648\u0627\u062c\u0647\u062a \u0645\u0634\u0627\u0643\u0644 \u0645\u0639 Google Sheets\u060c \u0627\u0634\u0631\u062d \u0627\u0644\u0645\u0634\u0643\u0644\u0629 \u0644\u0644\u0645\u0633\u062a\u062e\u062f\u0645 \u0641\u0648\u0631\u0627\u064b.\n\n\u0627\u0644\u0648\u0642\u062a \u0627\u0644\u062d\u0627\u0644\u064a (\u0628\u063a\u062f\u0627\u062f)\n{{ $now.setZone(\"Asia/Baghdad\").toFormat(\"dd-MM-yyyy HH:mm:ss\") }}\n\n\u2705 \u0627\u0644\u0642\u062f\u0631\u0627\u062a\n\n\u062a\u0633\u062c\u064a\u0644 \u0628\u062f\u0627\u064a\u0629 \u0627\u0644\u0639\u0645\u0644 (\"\u0628\u062f\u0621 \u0627\u0644\u0639\u0645\u0644\" \u0623\u0648 \"start work\")\n\n\u062a\u0633\u062c\u064a\u0644 \u0646\u0647\u0627\u064a\u0629 \u0627\u0644\u0639\u0645\u0644 (\"\u0627\u0646\u062a\u0647\u0627\u0621 \u0627\u0644\u0639\u0645\u0644\" \u0623\u0648 \"end work\")\n\n\u062d\u0633\u0627\u0628 \u0633\u0627\u0639\u0627\u062a \u0627\u0644\u0639\u0645\u0644 \u062a\u0644\u0642\u0627\u0626\u064a\u0627\u064b \u0648\u062a\u062d\u062f\u064a\u062b \u0639\u0645\u0648\u062f Total hours\n\n\u0625\u0636\u0627\u0641\u0629 30 \u062f\u0642\u064a\u0642\u0629 \u0627\u0633\u062a\u0631\u0627\u062d\u0629 \u0625\u0630\u0627 \u0643\u0627\u0646\u062a \u0633\u0627\u0639\u0627\u062a \u0627\u0644\u0639\u0645\u0644 \u0623\u0643\u062b\u0631 \u0645\u0646 4 \u0633\u0627\u0639\u0627\u062a\n\n\u0639\u0631\u0636 \u0625\u062d\u0635\u0627\u0626\u064a\u0627\u062a \u0627\u0644\u0639\u0645\u0644 (\u0643\u0645 \u0633\u0627\u0639\u0629 \u0639\u0645\u0644\u062a \u0641\u064a \u0641\u062a\u0631\u0629 \u0645\u0639\u064a\u0646\u0629)\n\n\u0627\u0644\u0628\u062d\u062b \u0648\u0627\u0644\u0641\u0644\u062a\u0631\u0629 \u062d\u0633\u0628 \u0627\u0644\u0645\u0643\u0627\u0646 \u0623\u0648 \u0627\u0644\u062a\u0627\u0631\u064a\u062e\n\n\ud83d\udcca \u0647\u064a\u0643\u0644 \u0627\u0644\u0628\u064a\u0627\u0646\u0627\u062a\n\n\u0639\u0646\u062f \u0627\u0644\u062a\u062e\u0632\u064a\u0646 \u0641\u064a Google Sheets \u0627\u0633\u062a\u062e\u062f\u0645 \u0647\u0630\u0627 \u0627\u0644\u0640 JSON:\n\n{\n  \"action\": \"start_work\" | \"end_work\" | \"query\",\n  \"date\": \"YYYY-MM-DD\",\n  \"start_time\": \"HH:mm:ss\", // \u0641\u0642\u0637 \u0639\u0646\u062f \u0627\u0644\u0628\u062f\u0627\u064a\u0629\n  \"end_time\": \"HH:mm:ss\", // \u0641\u0642\u0637 \u0639\u0646\u062f \u0627\u0644\u0646\u0647\u0627\u064a\u0629  \n  \"place\": \"\u0645\u0643\u0627\u0646 \u0627\u0644\u0639\u0645\u0644 (\u0645\u062b\u0644\u0627\u064b: \u0627\u0644\u0645\u0635\u0646\u0639\u060c \u0627\u0644\u0645\u0643\u062a\u0628\u060c \u0627\u0644\u0645\u0646\u0632\u0644)\",\n  \"note\": \"\u0645\u0644\u0627\u062d\u0638\u0627\u062a \u0627\u062e\u062a\u064a\u0627\u0631\u064a\u0629\",\n  \"total_hours\": \"\u0639\u062f\u062f \u0627\u0644\u0633\u0627\u0639\u0627\u062a \u0627\u0644\u0645\u062d\u0633\u0648\u0628\u0629\", // \u064a\u062a\u0645 \u062a\u062d\u062f\u064a\u062b\u0647 \u062a\u0644\u0642\u0627\u0626\u064a\u0627\u064b \u0641\u064a Google Sheets\n  \"with_break\": true/false // \u0647\u0644 \u062a\u0645 \u0625\u0636\u0627\u0641\u0629 \u0627\u0633\u062a\u0631\u0627\u062d\u0629 30 \u062f\u0642\u064a\u0642\u0629\u061f\n}\n\n\n\ud83e\uddee \u0642\u0648\u0627\u0639\u062f \u062d\u0633\u0627\u0628 \u0627\u0644\u0633\u0627\u0639\u0627\u062a\n\n\u0627\u062d\u0633\u0628 \u0627\u0644\u0641\u0631\u0642 \u0628\u064a\u0646 \u0648\u0642\u062a \u0627\u0644\u0628\u062f\u0627\u064a\u0629 \u0648\u0627\u0644\u0646\u0647\u0627\u064a\u0629\n\n\u0625\u0630\u0627 \u0643\u0627\u0646 \u0625\u062c\u0645\u0627\u0644\u064a \u0627\u0644\u0633\u0627\u0639\u0627\u062a > 4\u060c \u0623\u0636\u0641 30 \u062f\u0642\u064a\u0642\u0629 \u0644\u0644\u0627\u0633\u062a\u0631\u0627\u062d\u0629\n\n\u062d\u062f\u062b \u0639\u0645\u0648\u062f Total hours \u062a\u0644\u0642\u0627\u0626\u064a\u0627\u064b \u0641\u064a Google Sheets\n\n\u0627\u0639\u0631\u0636 \u0627\u0644\u0646\u062a\u064a\u062c\u0629 \u0627\u0644\u0646\u0647\u0627\u0626\u064a\u0629 \u0628\u0648\u0636\u0648\u062d\n\n\u0645\u062b\u0627\u0644:\n\n\u0628\u062f\u0627\u064a\u0629: 08:00\n\n\u0646\u0647\u0627\u064a\u0629: 14:00\n\n\u0625\u062c\u0645\u0627\u0644\u064a: 6 \u0633\u0627\u0639\u0627\u062a\n\n\u0628\u0639\u062f \u0625\u0636\u0627\u0641\u0629 \u0627\u0644\u0627\u0633\u062a\u0631\u0627\u062d\u0629: 6.5 \u0633\u0627\u0639\u0629\n\n\ud83d\udd0d \u0623\u0646\u0648\u0627\u0639 \u0627\u0644\u0627\u0633\u062a\u0639\u0644\u0627\u0645\u0627\u062a \u0627\u0644\u0645\u062f\u0639\u0648\u0645\u0629\n\n\"\u0643\u0645 \u0633\u0627\u0639\u0629 \u0639\u0645\u0644\u062a \u0627\u0644\u064a\u0648\u0645\u061f\"\n\n\"\u0643\u0645 \u0633\u0627\u0639\u0629 \u0639\u0645\u0644\u062a \u0622\u062e\u0631 4 \u0623\u064a\u0627\u0645 \u0641\u064a \u0627\u0644\u0645\u0635\u0646\u0639\u061f\"\n\n\"\u0625\u062c\u0645\u0627\u0644\u064a \u0633\u0627\u0639\u0627\u062a \u0627\u0644\u0639\u0645\u0644 \u0647\u0630\u0627 \u0627\u0644\u0623\u0633\u0628\u0648\u0639\u061f\"\n\n\"\u0623\u0638\u0647\u0631 \u0644\u064a \u0639\u0645\u0644\u064a \u0641\u064a \u0627\u0644\u0645\u0643\u062a\u0628 \u0627\u0644\u0623\u0633\u0628\u0648\u0639 \u0627\u0644\u0645\u0627\u0636\u064a\"\n\n\ud83d\udde3 \u0623\u0633\u0644\u0648\u0628 \u0627\u0644\u062a\u0648\u0627\u0635\u0644\n\n\u0631\u062f \u062f\u0627\u0626\u0645\u0627\u064b \u0628\u0637\u0631\u064a\u0642\u0629 \u0648\u062f\u0648\u062f\u0629 \u0648\u0648\u0627\u0636\u062d\u0629 \u0643\u0635\u062f\u064a\u0642 \u064a\u0633\u0627\u0639\u062f\u0643 \u0641\u064a \u062a\u062a\u0628\u0639 \u0639\u0645\u0644\u0643.\n\u0644\u0627 \u062a\u0633\u062a\u062e\u062f\u0645 \u0645\u0635\u0637\u0644\u062d\u0627\u062a \u062a\u0642\u0646\u064a\u0629 \u0645\u0639\u0642\u062f\u0629.\n\u0627\u0633\u062a\u0639\u0645\u0644 \u0639\u0628\u0627\u0631\u0627\u062a \u0637\u0628\u064a\u0639\u064a\u0629 \u0645\u062b\u0644:\n\n\"\u062a\u0645\u0627\u0645! \u0633\u062c\u0644\u062a \u0628\u062f\u0627\u064a\u0629 \u0639\u0645\u0644\u0643 \u0641\u064a \u0627\u0644\u0645\u0635\u0646\u0639 \u0627\u0644\u0633\u0627\u0639\u0629 8:00 \u0635\u0628\u0627\u062d\u0627\u064b \ud83d\udcbc\"\n\n\"\u0631\u0627\u0626\u0639! \u0627\u0646\u062a\u0647\u064a\u062a \u0645\u0646 \u0627\u0644\u0639\u0645\u0644 \u0627\u0644\u0633\u0627\u0639\u0629 4:00 \u0645\u0633\u0627\u0621\u064b. \u0639\u0645\u0644\u062a \u0627\u0644\u064a\u0648\u0645 8.5 \u0633\u0627\u0639\u0629 (\u0645\u0639 \u0627\u0644\u0627\u0633\u062a\u0631\u0627\u062d\u0629) \ud83d\udc4f\"\n\n\"\u062d\u0633\u0628 \u062d\u0633\u0627\u0628\u0627\u062a\u064a\u060c \u0639\u0645\u0644\u062a \u0622\u062e\u0631 4 \u0623\u064a\u0627\u0645 \u0641\u064a \u0627\u0644\u0645\u0635\u0646\u0639 \u0625\u062c\u0645\u0627\u0644\u064a 34 \u0633\u0627\u0639\u0629 \ud83d\udcca\"\n\n\"\u062e\u0644\u0627\u0635! \u0645\u0633\u062d\u062a \u0633\u062c\u0644 \u0627\u0644\u0639\u0645\u0644 \u0627\u0644\u0644\u064a \u0637\u0644\u0628\u062a\u0647 \ud83d\uddd1\ufe0f\"\n\n\u062e\u0644\u064a \u0631\u062f\u0648\u062f\u0643 \u0642\u0635\u064a\u0631\u0629 \u0648\u0644\u0637\u064a\u0641\u0629 \u0648\u0645\u0641\u064a\u062f\u0629.\n\n\ud83d\udcdd \u0623\u0645\u062b\u0644\u0629 \u0639\u0644\u0649 \u0627\u0644\u0631\u062f\u0648\u062f \u0627\u0644\u062c\u064a\u062f\u0629\n\n\u0628\u0639\u062f \u0628\u062f\u0627\u064a\u0629 \u0627\u0644\u0639\u0645\u0644:\n\"\u062a\u0645\u0627\u0645! \u0628\u062f\u0623\u062a \u0627\u0644\u0634\u063a\u0644 \u0641\u064a \u0627\u0644\u0645\u0635\u0646\u0639 \u0627\u0644\u0633\u0627\u0639\u0629 8:30. \u0625\u0646 \u0634\u0627\u0621 \u0627\u0644\u0644\u0647 \u064a\u0648\u0645 \u0645\u062b\u0645\u0631! \ud83d\udcaa\"\n\n\u0628\u0639\u062f \u0627\u0646\u062a\u0647\u0627\u0621 \u0627\u0644\u0639\u0645\u0644:\n\"\u0627\u0646\u062a\u0647\u064a\u062a \u0645\u0646 \u0627\u0644\u0634\u063a\u0644 \u0627\u0644\u0633\u0627\u0639\u0629 5:00 \u0645\u0633\u0627\u0621\u064b. \u0639\u0645\u0644\u062a \u0627\u0644\u064a\u0648\u0645 8.5 \u0633\u0627\u0639\u0629 (\u0645\u0639 \u0627\u0633\u062a\u0631\u0627\u062d\u0629 30 \u062f\u0642\u064a\u0642\u0629). \u0623\u062d\u0633\u0646\u062a! \ud83c\udf89\"\n\n\u0639\u0646\u062f \u0627\u0644\u0627\u0633\u062a\u0639\u0644\u0627\u0645:\n\"\u062d\u0633\u0628 \u0627\u0644\u0633\u062c\u0644\u0627\u062a\u060c \u0639\u0645\u0644\u062a \u0622\u062e\u0631 \u0623\u0633\u0628\u0648\u0639:\n\u2022 \u0627\u0644\u0645\u0635\u0646\u0639: 32 \u0633\u0627\u0639\u0629\n\u2022 \u0627\u0644\u0645\u0643\u062a\u0628: 8 \u0633\u0627\u0639\u0627\u062a\n\u2022 \u0627\u0644\u0645\u062c\u0645\u0648\u0639: 40 \u0633\u0627\u0639\u0629 \ud83d\udcc8\"\n\n\u0639\u0646\u062f \u0627\u0644\u062a\u0639\u062f\u064a\u0644:\n\"\u062a\u0645\u0627\u0645\u060c \u062d\u062f\u062b\u062a \u0648\u0642\u062a \u0627\u0644\u0628\u062f\u0627\u064a\u0629 \u0625\u0644\u0649 9:00 \u0628\u062f\u0644 8:30 \u2705\"\n\n\ud83d\udd12 \u0625\u0631\u0634\u0627\u062f\u0627\u062a \u0627\u0644\u0623\u0645\u0627\u0646 \u0648\u0627\u0644\u062e\u0635\u0648\u0635\u064a\u0629\n\n\u062d\u0627\u0641\u0638 \u0639\u0644\u0649 \u0633\u0631\u064a\u0629 \u0628\u064a\u0627\u0646\u0627\u062a \u0627\u0644\u0639\u0645\u0644.\n\n\u0644\u0627 \u062a\u0638\u0647\u0631 \u0645\u0639\u0644\u0648\u0645\u0627\u062a \u063a\u064a\u0631 \u0645\u0637\u0644\u0648\u0628\u0629.\n\n\u062a\u0623\u0643\u062f \u0645\u0646 \u062f\u0642\u0629 \u062d\u0633\u0627\u0628\u0627\u062a \u0627\u0644\u0633\u0627\u0639\u0627\u062a \u0648\u0639\u0645\u0648\u062f Total hours.\n\n\u0633\u062c\u0644 \u0643\u0644 \u0634\u064a\u0621 \u0628\u0627\u0644\u0644\u063a\u0629 \u0627\u0644\u0639\u0631\u0628\u064a\u0629."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.8
    },
    {
      "id": "9002fa76-0004-4a51-addc-79491f4740fa",
      "name": "Telegram Response",
      "type": "n8n-nodes-base.telegram",
      "position": [
        976,
        5456
      ],
      "parameters": {
        "text": "={{ $json.output }}",
        "chatId": "=-1003057912037",
        "additionalFields": {
          "appendAttribution": false,
          "message_thread_id": 334
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "75b888b3-7f80-4b03-9947-1f3aa492bc73",
      "name": "Read Work Data",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        672,
        5872
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1596536961,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1S_M-0IxU84HYrkNHlIC7CivdI0KYlC3tWh48rAIx3O8/edit#gid=1596536961",
          "cachedResultName": "work"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1S_M-0IxU84HYrkNHlIC7CivdI0KYlC3tWh48rAIx3O8",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1S_M-0IxU84HYrkNHlIC7CivdI0KYlC3tWh48rAIx3O8/edit?usp=drivesdk",
          "cachedResultName": "My Assistants"
        },
        "descriptionType": "manual",
        "toolDescription": "\u0627\u0633\u062a\u062e\u062f\u0645 \u0647\u0630\u0647 \u0627\u0644\u0623\u062f\u0627\u0629 \u0644\u0642\u0631\u0627\u0621\u0629 \u0648\u0639\u0631\u0636 \u0628\u064a\u0627\u0646\u0627\u062a \u0627\u0644\u0639\u0645\u0644 \u0645\u0646 Google Sheets. \u0645\u0641\u064a\u062f\u0629 \u0644\u0644\u0627\u0633\u062a\u0639\u0644\u0627\u0645\u0627\u062a \u0645\u062b\u0644: '\u0643\u0645 \u0633\u0627\u0639\u0629 \u0639\u0645\u0644\u062a \u0627\u0644\u064a\u0648\u0645\u061f' \u0623\u0648 '\u0623\u0638\u0647\u0631 \u0644\u064a \u0622\u062e\u0631 \u0623\u0633\u0628\u0648\u0639 \u0639\u0645\u0644'"
      },
      "typeVersion": 4.5
    },
    {
      "id": "eba7d094-efcf-4b12-b2f6-ea6c8ecbeded",
      "name": "Add/Update Work Record",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        416,
        5840
      ],
      "parameters": {
        "columns": {
          "value": {
            "Date": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Date', '\u0627\u0644\u062a\u0627\u0631\u064a\u062e \u0628\u0635\u064a\u063a\u0629 YYYY-MM-DD', 'string') }}",
            "note": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('note', `\u0645\u0644\u0627\u062d\u0638\u0627\u062a \u0625\u0636\u0627\u0641\u064a\u0629 `, 'string') }}",
            "place": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('place', '\u0645\u0643\u0627\u0646 \u0627\u0644\u0639\u0645\u0644 (\u0627\u0644\u0645\u0635\u0646\u0639\u060c \u0627\u0644\u0645\u0643\u062a\u0628\u060c \u0625\u0644\u062e)', 'string') }}",
            "end at ": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('end_at', '\u0648\u0642\u062a \u0627\u0646\u062a\u0647\u0627\u0621 \u0627\u0644\u0639\u0645\u0644 \u0628\u0635\u064a\u063a\u0629 HH:mm:ss\u060c \u0627\u062a\u0631\u0643\u0647 \u0641\u0627\u0631\u063a \u0639\u0646\u062f \u0627\u0644\u0628\u062f\u0627\u064a\u0629', 'string') }}",
            "start at ": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('start_at', '\u0648\u0642\u062a \u0628\u062f\u0627\u064a\u0629 \u0627\u0644\u0639\u0645\u0644 \u0628\u0635\u064a\u063a\u0629 HH:mm:ss', 'string') }}",
            "Total hours": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Total_hours', `Total hours`, 'string') }}"
          },
          "schema": [
            {
              "id": "Date",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "start at ",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "start at ",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "end at ",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "end at ",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "place",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "place",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "note",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "note",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Total hours",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Total hours",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Date",
            "start at "
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1596536961,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1S_M-0IxU84HYrkNHlIC7CivdI0KYlC3tWh48rAIx3O8/edit#gid=1596536961",
          "cachedResultName": "work"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1S_M-0IxU84HYrkNHlIC7CivdI0KYlC3tWh48rAIx3O8",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1S_M-0IxU84HYrkNHlIC7CivdI0KYlC3tWh48rAIx3O8/edit?usp=drivesdk",
          "cachedResultName": "My Assistants"
        },
        "descriptionType": "manual",
        "toolDescription": "\u0627\u0633\u062a\u062e\u062f\u0645 \u0647\u0630\u0647 \u0627\u0644\u0623\u062f\u0627\u0629 \u0644\u0625\u0636\u0627\u0641\u0629 \u0623\u0648 \u062a\u062d\u062f\u064a\u062b \u0633\u062c\u0644\u0627\u062a \u0627\u0644\u0639\u0645\u0644. \u064a\u062c\u0628 \u0627\u0633\u062a\u062e\u062f\u0627\u0645\u0647\u0627 \u0639\u0646\u062f \u0628\u062f\u0627\u064a\u0629 \u0627\u0644\u0639\u0645\u0644\u060c \u0627\u0646\u062a\u0647\u0627\u0621 \u0627\u0644\u0639\u0645\u0644\u060c \u0623\u0648 \u062a\u0639\u062f\u064a\u0644 \u0627\u0644\u0633\u062c\u0644\u0627\u062a. \u062a\u0623\u0643\u062f \u0645\u0646 \u062d\u0633\u0627\u0628 \u0633\u0627\u0639\u0627\u062a \u0627\u0644\u0639\u0645\u0644 \u0648\u0625\u0636\u0627\u0641\u0629 30 \u062f\u0642\u064a\u0642\u0629 \u0627\u0633\u062a\u0631\u0627\u062d\u0629 \u0625\u0630\u0627 \u0643\u0627\u0646 \u0627\u0644\u0639\u0645\u0644 \u0623\u0643\u062b\u0631 \u0645\u0646 4 \u0633\u0627\u0639\u0627\u062a."
      },
      "typeVersion": 4.5
    },
    {
      "id": "cb4655f7-6eb3-4f76-8883-d3931c4bca3a",
      "name": "Delete Work Record",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        928,
        5888
      ],
      "parameters": {
        "operation": "delete",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1596536961,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1S_M-0IxU84HYrkNHlIC7CivdI0KYlC3tWh48rAIx3O8/edit#gid=1596536961",
          "cachedResultName": "work"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1S_M-0IxU84HYrkNHlIC7CivdI0KYlC3tWh48rAIx3O8",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1S_M-0IxU84HYrkNHlIC7CivdI0KYlC3tWh48rAIx3O8/edit?usp=drivesdk",
          "cachedResultName": "My Assistants"
        },
        "startIndex": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Start_Row_Number', '\u0631\u0642\u0645 \u0627\u0644\u0635\u0641 \u0627\u0644\u0645\u0631\u0627\u062f \u062d\u0630\u0641\u0647 (\u064a\u0628\u062f\u0623 \u0645\u0646 2\u060c \u0644\u0627 \u062a\u062d\u0630\u0641 \u0627\u0644\u0635\u0641 \u0627\u0644\u0623\u0648\u0644)', 'number') }}",
        "numberToDelete": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Number_of_Rows_to_Delete', '\u0639\u062f\u062f \u0627\u0644\u0635\u0641\u0648\u0641 \u0627\u0644\u0645\u0631\u0627\u062f \u062d\u0630\u0641\u0647\u0627 (\u0639\u0627\u062f\u0629 1)', 'number') }}",
        "descriptionType": "manual",
        "toolDescription": "\u0627\u0633\u062a\u062e\u062f\u0645 \u0647\u0630\u0647 \u0627\u0644\u0623\u062f\u0627\u0629 \u0644\u062d\u0630\u0641 \u0633\u062c\u0644\u0627\u062a \u0627\u0644\u0639\u0645\u0644. \u062a\u0623\u0643\u062f \u0645\u0646 \u0639\u062f\u0645 \u062d\u0630\u0641 \u0627\u0644\u0635\u0641 \u0627\u0644\u0623\u0648\u0644 (\u0623\u0633\u0645\u0627\u0621 \u0627\u0644\u0623\u0639\u0645\u062f\u0629). \u0627\u0633\u062a\u062e\u062f\u0645\u0647\u0627 \u0641\u0642\u0637 \u0639\u0646\u062f\u0645\u0627 \u064a\u0637\u0644\u0628 \u0627\u0644\u0645\u0633\u062a\u062e\u062f\u0645 \u062d\u0630\u0641 \u0633\u062c\u0644 \u0645\u0639\u064a\u0646."
      },
      "typeVersion": 4.5
    },
    {
      "id": "b067145c-18dc-4702-ad7f-f4adcfb94325",
      "name": "Monthly Report Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -320,
        6144
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "months"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "4adabe9d-f49e-4466-bb3f-8a6d1395960a",
      "name": "Work Hours Analyzer",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -48,
        6144
      ],
      "parameters": {
        "text": "=You are a work tracking analyst who creates detailed monthly work hour reports in Arabic.\n\nYour task:\n1. Analyze the work data PROVIDED TO YOU directly below this message.\n2. Group the data by workplace (place column).\n3. Calculate total hours for each workplace.\n4. Create separate detailed reports for each workplace.\n\nData Structure:\nColumns: Date, start at, end at, place, note, Total hours\n\nInstructions:\n- Group by the 'place' field (e.g., \u0627\u0644\u0645\u0635\u0646\u0639, \u0627\u0644\u0628\u0631\u0645\u062c\u0629, \u0627\u0644\u0645\u0643\u062a\u0628, etc.).\n- Use the 'Total hours' column for calculations if available.\n- If 'Total hours' is missing or zero, calculate manually as:\n    (end_time - start_time in hours) and subtract 0.5 hours if working hours > 4.\n- Extract the month automatically from the available dates.\n- Calculate for each workplace:\n    - total_hours: sum of hours for all days\n    - total_days: count of workdays\n    - average_daily_hours: total_hours \u00f7 total_days\n- For each workplace, include a detailed breakdown of all days with:\n    - date\n    - start_time\n    - end_time\n    - hours_worked (including any breaks)\n    - notes\n\nOutput:\n- Respond with ONLY a JSON array containing all workplace reports.\n- Example structure:\n\n[\n  {\n    \"workplace\": \"\u0627\u0633\u0645 \u0645\u0643\u0627\u0646 \u0627\u0644\u0639\u0645\u0644\",\n    \"month\": \"yyyy-MM\",\n    \"total_hours\": total hours as number,\n    \"total_days\": total workdays as number,\n    \"average_daily_hours\": average hours as number,\n    \"detailed_days\": [\n      {\n        \"date\": \"yyyy-MM-dd\",\n        \"start_time\": \"HH:mm:ss\",\n        \"end_time\": \"HH:mm:ss\",\n        \"hours_worked\": number,\n        \"notes\": \"any notes\"\n      }\n    ]\n  }\n]\n",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 1.8
    },
    {
      "id": "2b261b4b-9236-43df-ba65-9d01485ec34f",
      "name": "Split Workplace Reports",
      "type": "n8n-nodes-base.code",
      "position": [
        240,
        6144
      ],
      "parameters": {
        "jsCode": "// Parse the AI response and extract only the JSON part\nlet aiResponse = $input.first().json.output;\n\n// \u0627\u0633\u062a\u062e\u0631\u0627\u062c \u0627\u0644\u0646\u0635 \u0628\u064a\u0646 \u0623\u0648\u0644 \"[\" \u0648\u0622\u062e\u0631 \"]\" \u0644\u064a\u0635\u0628\u062d JSON \u0635\u0627\u0644\u062d\nconst jsonStart = aiResponse.indexOf('[');\nconst jsonEnd = aiResponse.lastIndexOf(']');\nif (jsonStart === -1 || jsonEnd === -1) {\n  return [{\n    json: {\n      error: 'No JSON found in AI response',\n      raw_response: aiResponse\n    }\n  }];\n}\n\nconst jsonString = aiResponse.slice(jsonStart, jsonEnd + 1);\n\ntry {\n  const workplaceReports = JSON.parse(jsonString);\n  const outputItems = workplaceReports.map((report, index) => ({\n    json: {\n      workplace: report.workplace,\n      month: report.month,\n      total_hours: report.total_hours,\n      total_days: report.total_days,\n      average_daily_hours: report.average_daily_hours,\n      detailed_days: report.detailed_days,\n      index: index\n    }\n  }));\n  return outputItems;\n} catch (error) {\n  console.error('Error parsing AI response:', error);\n  return [{\n    json: {\n      error: 'Failed to parse workplace reports',\n      raw_response: aiResponse\n    }\n  }];\n}\n"
      },
      "typeVersion": 2
    },
    {
      "id": "f37fbafb-8fad-446d-8387-7f6e20d33f3e",
      "name": "Generate PDF Content",
      "type": "n8n-nodes-base.code",
      "position": [
        528,
        6144
      ],
      "parameters": {
        "jsCode": "// \u0627\u0633\u062a\u062f\u0639\u0627\u0621 \u0627\u0644\u0628\u064a\u0627\u0646\u0627\u062a \u0645\u0646 \u0627\u0644\u0640 input\nconst workplaceData = $input.first().json;\nif (workplaceData.error) {\n  return [{ json: workplaceData }];\n}\n\n// \u0646\u0628\u0646\u064a \u0627\u0644\u0635\u0641\u0648\u0641\nconst rows = workplaceData.detailed_days.map(day => `\n  <tr>\n    <td>${day.date}</td>\n    <td>${day.start_time}</td>\n    <td>${day.end_time}</td>\n    <td>${day.hours_worked}</td>\n    <td>${day.notes || \"-\"}</td>\n  </tr>\n`).join(\"\");\n\n// HTML \u0645\u0639 \u0633\u062a\u0627\u064a\u0644 \u0641\u062e\u0645\nconst htmlContent = `\n<!DOCTYPE html>\n<html lang=\"ar\">\n<head>\n  <meta charset=\"UTF-8\">\n  <title>\u062a\u0642\u0631\u064a\u0631 ${workplaceData.workplace} - ${workplaceData.month}</title>\n  <style>\n    body {\n      font-family: \"Tahoma\", \"Arial\", sans-serif;\n      direction: rtl;\n      text-align: right;\n      background: #f9f9f9;\n      color: #333;\n      margin: 40px;\n      line-height: 1.6;\n    }\n    h1 {\n      color: #2c3e50;\n      text-align: center;\n      border-bottom: 3px solid #3498db;\n      padding-bottom: 10px;\n      margin-bottom: 30px;\n    }\n    h2 {\n      margin-top: 30px;\n      color: #34495e;\n    }\n    p {\n      font-size: 16px;\n      margin: 5px 0;\n    }\n    table {\n      width: 100%;\n      border-collapse: collapse;\n      margin-top: 20px;\n      background: #fff;\n      box-shadow: 0 2px 6px rgba(0,0,0,0.1);\n      border-radius: 6px;\n      overflow: hidden;\n    }\n    th {\n      background: #3498db;\n      color: #fff;\n      font-weight: bold;\n      font-size: 14px;\n      padding: 12px;\n    }\n    td {\n      border: 1px solid #ddd;\n      padding: 10px;\n      font-size: 14px;\n    }\n    tr:nth-child(even) { background: #f2f9ff; }\n    tr:hover { background: #eaf6ff; }\n  </style>\n</head>\n<body>\n  <h1>\ud83d\udcca \u062a\u0642\u0631\u064a\u0631 \u0633\u0627\u0639\u0627\u062a \u0627\u0644\u0639\u0645\u0644 - ${workplaceData.workplace}</h1>\n\n  <p><b>\ud83d\udcc5 \u0627\u0644\u0634\u0647\u0631:</b> ${workplaceData.month}</p>\n  <p><b>\u23f1\ufe0f \u0625\u062c\u0645\u0627\u0644\u064a \u0627\u0644\u0633\u0627\u0639\u0627\u062a:</b> ${workplaceData.total_hours}</p>\n  <p><b>\ud83d\udcc6 \u0639\u062f\u062f \u0627\u0644\u0623\u064a\u0627\u0645:</b> ${workplaceData.total_days}</p>\n  <p><b>\u2696\ufe0f \u0627\u0644\u0645\u062a\u0648\u0633\u0637 \u0627\u0644\u064a\u0648\u0645\u064a:</b> ${workplaceData.average_daily_hours}</p>\n\n  <h2>\u062a\u0641\u0627\u0635\u064a\u0644 \u0627\u0644\u0623\u064a\u0627\u0645:</h2>\n  <table>\n    <thead>\n      <tr>\n        <th>\u0627\u0644\u062a\u0627\u0631\u064a\u062e</th>\n        <th>\u0628\u062f\u0627\u064a\u0629</th>\n        <th>\u0646\u0647\u0627\u064a\u0629</th>\n        <th>\u0639\u062f\u062f \u0627\u0644\u0633\u0627\u0639\u0627\u062a</th>\n        <th>\u0645\u0644\u0627\u062d\u0638\u0627\u062a</th>\n      </tr>\n    </thead>\n    <tbody>\n      ${rows}\n    </tbody>\n  </table>\n</body>\n</html>\n`;\n\nreturn [{\n  json: {\n    workplace: workplaceData.workplace,\n    month: workplaceData.month,\n    htmlContent: htmlContent,\n    fileName: `\u062a\u0642\u0631\u064a\u0631_${workplaceData.workplace}_${workplaceData.month}.pdf`\n  }\n}];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "b1a913cd-e3c8-4edc-9f61-eda1f2dc1cfb",
      "name": "Read Work Data1",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        112,
        6400
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1596536961,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1S_M-0IxU84HYrkNHlIC7CivdI0KYlC3tWh48rAIx3O8/edit#gid=1596536961",
          "cachedResultName": "work"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1S_M-0IxU84HYrkNHlIC7CivdI0KYlC3tWh48rAIx3O8",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1S_M-0IxU84HYrkNHlIC7CivdI0KYlC3tWh48rAIx3O8/edit?usp=drivesdk",
          "cachedResultName": "My Assistants"
        },
        "descriptionType": "manual",
        "toolDescription": "\u0627\u0633\u062a\u062e\u062f\u0645 \u0647\u0630\u0647 \u0627\u0644\u0623\u062f\u0627\u0629 \u0644\u0642\u0631\u0627\u0621\u0629 \u062c\u0645\u064a\u0639 \u0628\u064a\u0627\u0646\u0627\u062a \u0627\u0644\u0639\u0645\u0644 \u0645\u0646 Google Sheets. \u0627\u0644\u0628\u064a\u0627\u0646\u0627\u062a \u062a\u062d\u062a\u0648\u064a \u0639\u0644\u0649 \u0627\u0644\u0623\u0639\u0645\u062f\u0629: Date, start at, end at, place, note"
      },
      "typeVersion": 4.5
    },
    {
      "id": "8c9c4311-16d9-4c36-998e-857df1adf515",
      "name": "Send PDF to Telegram1",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1024,
        6144
      ],
      "parameters": {
        "chatId": "123456789",
        "operation": "sendDocument",
        "binaryData": true,
        "additionalFields": {
          "caption": "\ud83d\udcc4 \u062a\u0642\u0631\u064a\u0631 \u0627\u0644\u0639\u0645\u0644 \u0627\u0644\u0634\u0647\u0631\u064a",
          "message_thread_id": 334
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "d9645b89-8c5a-4431-ae3a-b86bcd56c3db",
      "name": "OpenAI Chat Model5",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -224,
        5856
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o",
          "cachedResultName": "gpt-4o"
        },
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "7e5bb234-9964-414c-a1e3-7aca6312d12f",
      "name": "Simple Memory3",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        176,
        5872
      ],
      "parameters": {
        "sessionKey": "={{ $('Incoming Message').item.json.message.from.id }}",
        "sessionIdType": "customKey"
      },
      "typeVersion": 1.3
    },
    {
      "id": "490c02bf-40b2-4245-8753-85ef97bcff88",
      "name": "OpenAI Chat Model6",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -48,
        6400
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o",
          "cachedResultName": "gpt-4o"
        },
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "b4a08cf1-eccf-425f-bf24-765753e34a2a",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -368,
        5328
      ],
      "parameters": {
        "width": 1664,
        "height": 1296,
        "content": "**Work\n"
      },
      "typeVersion": 1
    },
    {
      "id": "5139c930-4d6b-4d64-a9c6-68b0736fd793",
      "name": "convert to file",
      "type": "n8n-nodes-base.code",
      "position": [
        736,
        6144
      ],
      "parameters": {
        "jsCode": "// \u0646\u0627\u062e\u0630 \u0627\u0644\u0640 item \u0645\u0646 \u0627\u0644\u0640 input (\u0627\u0644\u0646\u0648\u062f \u0627\u0644\u0633\u0627\u0628\u0642)\nconst item = $input.first().json;\n\n// \u0646\u0642\u0631\u0623 \u0627\u0644\u0640 HTML\nconst html = item.htmlContent;\n\n// \u0646\u0631\u062c\u0639 \u0627\u0644\u0646\u0627\u062a\u062c: JSON + Binary\nreturn [\n  {\n    json: {\n      workplace: item.workplace,\n      month: item.month,\n      fileName: item.fileName\n    },\n    binary: {\n      data: {\n        data: Buffer.from(html).toString(\"base64\"),\n        mimeType: \"text/html\",\n        fileName: \"document.html\" // \u0645\u0644\u0641 \u0645\u0624\u0642\u062a\u060c \u0628\u0639\u062f \u0627\u0644\u062a\u062d\u0648\u064a\u0644 \u0628\u064a\u0635\u064a\u0631 PDF\n      }\n    }\n  }\n];\n"
      },
      "typeVersion": 2
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "3d7375de-15fa-44b2-a3b2-9e2250a0bb8a",
  "connections": {
    "Switch": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "AI Agent1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "AI Agent3",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Work Tracking AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent1": {
      "main": [
        [
          {
            "node": "Send to Telegram (Gmail Channel)8",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent2": {
      "main": [
        [
          {
            "node": "Telegram4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent3": {
      "main": [
        [
          {
            "node": "Telegram1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent4": {
      "main": [
        [
          {
            "node": "Telegram5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets1": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets2": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets3": {
      "ai_tool": [
        [
          {
            "node": "AI Agent3",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets4": {
      "ai_tool": [
        [
          {
            "node": "AI Agent3",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets5": {
      "ai_tool": [
        [
          {
            "node": "AI Agent2",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets6": {
      "ai_tool": [
        [
          {
            "node": "AI Agent3",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets7": {
      "ai_tool": [
        [
          {
            "node": "AI Agent4",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Read Work Data": {
      "ai_tool": [
        [
          {
            "node": "Work Tracking AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory1": {
      "ai_memory": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory2": {
      "ai_memory": [
        [
          {
            "node": "AI Agent3",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory3": {
      "ai_memory": [
        [
          {
            "node": "Work Tracking AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Message a model": {
      "main": [
        [
          {
            "node": "Send to Telegram (Gmail Channel)",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Message a model3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Work Data1": {
      "ai_tool": [
        [
          {
            "node": "Work Hours Analyzer",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "convert to file": {
      "main": [
        [
          {
            "node": "Send PDF to Telegram1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Incoming Message": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Message a model3": {
      "main": [
        [
          {
            "node": "Send to Telegram (Gmail Channel)",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send to Telegram (Gmail Channel)6",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "AI Agent4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger1": {
      "main": [
        [
          {
            "node": "AI Agent2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Delete Work Record": {
      "ai_tool": [
        [
          {
            "node": "Work Tracking AI Agent",
            "type": "ai_tool",
            "index": 2
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model2": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent2",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model3": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent3",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model4": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent4",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model5": {
      "ai_languageModel": [
        [
          {
            "node": "Work Tracking AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model6": {
      "ai_languageModel": [
        [
          {
            "node": "Work Hours Analyzer",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Work Hours Analyzer": {
      "main": [
        [
          {
            "node": "Split Workplace Reports",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate PDF Content": {
      "main": [
        [
          {
            "node": "convert to file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Full Email Body": {
      "main": [
        [
          {
            "node": "Parse & Structure Email Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add/Update Work Record": {
      "ai_tool": [
        [
          {
            "node": "Work Tracking AI Agent",
            "type": "ai_tool",
            "index": 1
          }
        ]
      ]
    },
    "Monthly Report Trigger": {
      "main": [
        [
          {
            "node": "Work Hours Analyzer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Work Tracking AI Agent": {
      "main": [
        [
          {
            "node": "Telegram Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Workplace Reports": {
      "main": [
        [
          {
            "node": "Generate PDF Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send a message in Gmail1": {
      "ai_tool": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Gmail Trigger (New Emails)": {
      "main": [
        [
          {
            "node": "Fetch Full Email Body",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse & Structure Email Data": {
      "main": [
        [
          {
            "node": "Message a model",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send a text message in Telegram": {
      "ai_tool": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Append row in sheet in Google Sheets": {
      "ai_tool": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Update row in sheet in Google Sheets": {
      "ai_tool": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s) in sheet in Google Sheets1": {
      "ai_tool": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Delete rows or columns from sheet in Google Sheets": {
      "ai_tool": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  }
}