{
  "name": "AI secretary for scheduling with WhatsApp and Telegram",
  "nodes": [
    {
      "id": "0a0a8719-3cd5-420a-b19e-9bd587d086af",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1984,
        128
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "7cd49d61-cf7e-426e-b4c2-47181efbc47b",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1968,
        1008
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "0466bf25-ee51-482b-a226-a0dee3511649",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1536,
        992
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "9b1764ad-f323-4be1-be99-0797c8ba49e9",
      "name": "Calendar AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -1536,
        592
      ]
    },
    {
      "id": "0593ac7a-7567-4f42-94e7-c351eef59c18",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3872,
        400
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "88c06826-0a94-45a2-b010-de8695f692e2",
      "name": "REDIS - DEBOUNCE - SET",
      "type": "n8n-nodes-base.redis",
      "position": [
        -3648,
        816
      ]
    },
    {
      "id": "36c490df-bcfd-4897-af47-612df539f9f4",
      "name": "REDIS - DEBOUNCE - GET",
      "type": "n8n-nodes-base.redis",
      "position": [
        -3248,
        608
      ]
    },
    {
      "id": "46f2d7e9-5c4a-4932-a55f-5aa6abfb1692",
      "name": "REDIS - DEBOUNCE - DELETE",
      "type": "n8n-nodes-base.redis",
      "position": [
        -2608,
        592
      ]
    },
    {
      "id": "ae124435-e897-4e8e-b2e6-bbcceb779984",
      "name": "OBJECT MSG - CONCATENATE",
      "type": "n8n-nodes-base.code",
      "position": [
        -2368,
        592
      ]
    },
    {
      "id": "fa108825-510b-4f59-9312-174c9cbb575c",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1136,
        992
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "50f2a522-9045-4a71-aa3d-798671f12a22",
      "name": "VARIABLES - CONFIG",
      "type": "n8n-nodes-base.set",
      "position": [
        -6096,
        832
      ]
    },
    {
      "id": "9dd231ab-69f5-4d83-bae9-690df2bff84e",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        -1440,
        1408
      ]
    },
    {
      "id": "8964028b-5a70-4cec-b6ff-de5885b1795f",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -1888,
        1360
      ]
    },
    {
      "id": "96e7b5d2-18bb-4c65-a273-75242e459369",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        0
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "23f8bcdb-09ed-45a9-bb2f-8d0fd0eadfba",
      "name": "Check Schedule",
      "type": "n8n-nodes-base.googleCalendarTool",
      "position": [
        -1024,
        1376
      ]
    },
    {
      "id": "24bd37b6-3c65-47f6-89bb-9ef998124708",
      "name": "Create Appointment",
      "type": "n8n-nodes-base.googleCalendarTool",
      "position": [
        -784,
        1376
      ]
    },
    {
      "id": "e9fb0248-41e1-47d7-a51b-c78caab54a91",
      "name": "Cancel Appointment",
      "type": "n8n-nodes-base.googleCalendarTool",
      "position": [
        -560,
        1376
      ]
    },
    {
      "id": "a652287f-27f4-4673-84bf-6d0f0d9645e0",
      "name": "HAS TIME PASSED?",
      "type": "n8n-nodes-base.switch",
      "position": [
        -2992,
        608
      ]
    },
    {
      "id": "2b21a949-087c-4759-82e4-c86451bbfea9",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -6256,
        496
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "b6e51873-b127-4c1f-b1f3-cac0e9525280",
      "name": "CHECK CHANNEL",
      "type": "n8n-nodes-base.switch",
      "position": [
        -288,
        592
      ]
    },
    {
      "id": "145ba1db-34ee-4df9-9c9d-2eb7ad13485c",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        624
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "74c811f7-24e8-4a87-a7d7-c0301cccc97f",
      "name": "LOOP MESSAGE - WHATSAPP",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        512,
        208
      ]
    },
    {
      "id": "c4a183a3-c4ae-4ff3-9d57-d0be1c3e3177",
      "name": "LOOP MESSAGE - TELEGRAM",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        432,
        816
      ]
    },
    {
      "id": "ffed1611-b581-4a4b-bd5c-4e710b6becf2",
      "name": "TELEGRAM - CHANNEL",
      "type": "n8n-nodes-base.set",
      "position": [
        -6976,
        752
      ]
    },
    {
      "id": "12b1f056-0f03-4fae-a256-af5c0390a6b8",
      "name": "WHATSAPP - CHANNEL",
      "type": "n8n-nodes-base.set",
      "position": [
        -6976,
        1024
      ]
    },
    {
      "id": "34b59610-2c11-4d58-bbbd-ab0a8e08be64",
      "name": "CHANNEL",
      "type": "n8n-nodes-base.set",
      "position": [
        -6576,
        848
      ]
    },
    {
      "id": "6bd1994f-b2cb-4ec7-8aa7-03a37d464d00",
      "name": "CHECK CHANNEL1",
      "type": "n8n-nodes-base.switch",
      "position": [
        -5232,
        832
      ]
    },
    {
      "id": "9519dbee-1d01-4a6c-9d98-e28e3395cfbb",
      "name": "OBJECT MSG - WHASTAPP",
      "type": "n8n-nodes-base.code",
      "position": [
        -4656,
        656
      ]
    },
    {
      "id": "6369872e-db24-4786-a7b0-c1305a7fcfcf",
      "name": "OBJECT MSG - TELEGRAM",
      "type": "n8n-nodes-base.code",
      "position": [
        -4656,
        1008
      ]
    },
    {
      "id": "8d4501e4-8241-489b-8174-170b5da0381d",
      "name": "OBJECT MSG",
      "type": "n8n-nodes-base.set",
      "position": [
        -4208,
        816
      ]
    },
    {
      "id": "d4d23cc2-a221-40bd-880e-2e85d3fa7c5a",
      "name": "SEND MESSAGE WHATSAPP",
      "type": "n8n-nodes-evolution-api.evolutionApi",
      "position": [
        896,
        352
      ]
    },
    {
      "id": "84940cb4-4d47-4216-8305-0403a783a2f6",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -5360,
        384
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "f722cdf0-919b-4754-9405-5821bf3d283d",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -7424,
        656
      ]
    },
    {
      "id": "9fb7c23a-2a88-4042-9c37-069124b0af8c",
      "name": "SEND MESSAGE TELEGRAM",
      "type": "n8n-nodes-base.telegram",
      "position": [
        896,
        960
      ]
    },
    {
      "id": "372a5ae7-fe85-40ca-b934-94ff60f209d8",
      "name": "DATE NOW",
      "type": "n8n-nodes-base.dateTime",
      "position": [
        -5728,
        832
      ]
    },
    {
      "id": "3a469582-df78-4d2e-8375-51ad31c573d3",
      "name": "WAIT TIME - 5 SECONDS DEBOUNCE",
      "type": "n8n-nodes-base.wait",
      "position": [
        -2784,
        832
      ]
    },
    {
      "id": "82d92672-cba5-4af6-b562-7b33f2666451",
      "name": "SPLIT USER MESSAGE (INPUT)",
      "type": "n8n-nodes-base.set",
      "position": [
        -832,
        592
      ]
    },
    {
      "id": "87a94d07-4f1f-4e15-8d64-61e71f0134f3",
      "name": "MESSAGES INTO JSON ARRAY",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        -576,
        592
      ]
    },
    {
      "id": "09cc9e41-8c9c-4162-af83-eba446279a3c",
      "name": "on new message (Evolution)",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -7424,
        1056
      ]
    },
    {
      "id": "7dcff3d5-7e0b-423d-8de4-b48c5f9238bd",
      "name": "IF EXIST MESSAGE",
      "type": "n8n-nodes-base.if",
      "position": [
        640,
        912
      ]
    }
  ],
  "connections": {
    "CHANNEL": {
      "main": [
        [
          {
            "node": "VARIABLES - CONFIG",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "DATE NOW": {
      "main": [
        [
          {
            "node": "CHECK CHANNEL1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OBJECT MSG": {
      "main": [
        [
          {
            "node": "REDIS - DEBOUNCE - SET",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "CHECK CHANNEL": {
      "main": [
        [
          {
            "node": "LOOP MESSAGE - WHATSAPP",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "LOOP MESSAGE - TELEGRAM",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "Calendar AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "CHECK CHANNEL1": {
      "main": [
        [
          {
            "node": "OBJECT MSG - WHASTAPP",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "OBJECT MSG - TELEGRAM",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Schedule": {
      "ai_tool": [
        [
          {
            "node": "Calendar AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "HAS TIME PASSED?": {
      "main": [
        [
          {
            "node": "REDIS - DEBOUNCE - DELETE",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "WAIT TIME - 5 SECONDS DEBOUNCE",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF EXIST MESSAGE": {
      "main": [
        [
          {
            "node": "SEND MESSAGE TELEGRAM",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "LOOP MESSAGE - TELEGRAM",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "TELEGRAM - CHANNEL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calendar AI Agent": {
      "main": [
        [
          {
            "node": "SPLIT USER MESSAGE (INPUT)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Calendar AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Cancel Appointment": {
      "ai_tool": [
        [
          {
            "node": "Calendar AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Create Appointment": {
      "ai_tool": [
        [
          {
            "node": "Calendar AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "TELEGRAM - CHANNEL": {
      "main": [
        [
          {
            "node": "CHANNEL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "VARIABLES - CONFIG": {
      "main": [
        [
          {
            "node": "DATE NOW",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "WHATSAPP - CHANNEL": {
      "main": [
        [
          {
            "node": "CHANNEL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OBJECT MSG - TELEGRAM": {
      "main": [
        [
          {
            "node": "OBJECT MSG",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OBJECT MSG - WHASTAPP": {
      "main": [
        [
          {
            "node": "OBJECT MSG",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SEND MESSAGE TELEGRAM": {
      "main": [
        [
          {
            "node": "LOOP MESSAGE - TELEGRAM",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SEND MESSAGE WHATSAPP": {
      "main": [
        [
          {
            "node": "LOOP MESSAGE - WHATSAPP",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "REDIS - DEBOUNCE - GET": {
      "main": [
        [
          {
            "node": "HAS TIME PASSED?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "REDIS - DEBOUNCE - SET": {
      "main": [
        [
          {
            "node": "REDIS - DEBOUNCE - GET",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "LOOP MESSAGE - TELEGRAM": {
      "main": [
        [],
        [
          {
            "node": "IF EXIST MESSAGE",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "LOOP MESSAGE - WHATSAPP": {
      "main": [
        [],
        [
          {
            "node": "SEND MESSAGE WHATSAPP",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "MESSAGES INTO JSON ARRAY": {
      "main": [
        [
          {
            "node": "CHECK CHANNEL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OBJECT MSG - CONCATENATE": {
      "main": [
        [
          {
            "node": "Calendar AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "REDIS - DEBOUNCE - DELETE": {
      "main": [
        [
          {
            "node": "OBJECT MSG - CONCATENATE",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SPLIT USER MESSAGE (INPUT)": {
      "main": [
        [
          {
            "node": "MESSAGES INTO JSON ARRAY",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "on new message (Evolution)": {
      "main": [
        [
          {
            "node": "WHATSAPP - CHANNEL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "WAIT TIME - 5 SECONDS DEBOUNCE": {
      "main": [
        [
          {
            "node": "REDIS - DEBOUNCE - GET",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}