{
  "id": "REDACTED",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "AI Appointment Scheduler via Telegram & Google Calendar",
  "tags": [],
  "nodes": [
    {
      "id": "d1451463-041d-4a8a-86b9-5084197aa58b",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        220,
        0
      ],
      "parameters": {
        "text": "={{ $json.message.text }}",
        "options": {
          "systemMessage": "=You are a helpful appointment scheduling assistant. You will receive requests from user to set up appointments. Your job is to use the Calendar tool to create an event.\n\n#Rule\n1. When exact date or time is specified e.g \"create an event for next Tuesday\" always refer to the current time reference, which is: {{ $now }}\n2. Always assume time is ing GMT+08 (SGT).\n3. Unless specified, assume event duration will be 1 hour."
        },
        "promptType": "define"
      },
      "typeVersion": 1.9
    },
    {
      "id": "228e4c9c-7b0f-4204-9faa-965ca90dc939",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        220,
        200
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "40e58cd2-ff6a-4747-9d98-71ddcd162473",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        380,
        200
      ],
      "parameters": {
        "sessionKey": "={{ $json.message.chat.id }}",
        "sessionIdType": "customKey"
      },
      "typeVersion": 1.3
    },
    {
      "id": "6f9cea9d-f8a0-4694-ba88-912580937e95",
      "name": "Google Calendar1",
      "type": "n8n-nodes-base.googleCalendarTool",
      "position": [
        640,
        200
      ],
      "parameters": {
        "end": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('End', ``, 'string') }}",
        "start": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Start', ``, 'string') }}",
        "calendar": {
          "__rl": true,
          "mode": "list",
          "value": "user@example.com",
          "cachedResultName": "user@example.com"
        },
        "additionalFields": {
          "summary": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Summary', ``, 'string') }}",
          "attendees": [
            "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('attendees0_Attendees', ``, 'string') }}"
          ]
        },
        "useDefaultReminders": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Use_Default_Reminders', ``, 'boolean') }}"
      },
      "credentials": {
        "googleCalendarOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "d54d3061-1645-4d87-9b0a-afbbf5be38f4",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -60,
        0
      ],
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "628eb6da-2f55-42bc-af24-3d5102d39c08",
      "name": "Telegram",
      "type": "n8n-nodes-base.telegram",
      "position": [
        640,
        -100
      ],
      "parameters": {
        "text": "={{ $json.output }}",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "06fa63b4-929f-4eda-95d8-33d64d01c404",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -160,
        -60
      ],
      "parameters": {
        "width": 300,
        "height": 260,
        "content": "Telegram Message Received Trigger"
      },
      "typeVersion": 1
    },
    {
      "id": "1df632ea-a2aa-4b5a-a145-35d92c0d47be",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        160,
        -160
      ],
      "parameters": {
        "color": 3,
        "width": 400,
        "height": 540,
        "content": "Telegram Message Received Trigger"
      },
      "typeVersion": 1
    },
    {
      "id": "1b60fdf1-425d-4b42-96b7-bef114660e46",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        580,
        -160
      ],
      "parameters": {
        "color": 4,
        "height": 260,
        "content": "Telegram Response"
      },
      "typeVersion": 1
    },
    {
      "id": "8ffa2de3-cdbf-44d4-8416-3754eb7b6810",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        580,
        120
      ],
      "parameters": {
        "color": 6,
        "height": 260,
        "content": "Calendar Tool"
      },
      "typeVersion": 1
    },
    {
      "id": "099f1140-1744-4ff7-bd12-00b441b861e1",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -640,
        -320
      ],
      "parameters": {
        "width": 440,
        "height": 880,
        "content": "\ud83d\udd27 How It Works\nTelegram Trigger \u2013 Listens for incoming messages from users via your Telegram bot.\n\nAI Agent \u2013 Processes the message to determine the user's intent (booking or canceling) and extracts necessary details like date, time, and participant names.\n\nGoogle Calendar Node \u2013 Depending on the intent:\n\nBooking: Creates a new event in Google Calendar with the extracted details.\n\nCanceling: Searches for the specified event and deletes it from the calendar.\n\nTelegram Node \u2013 Sends a confirmation message back to the user, informing them of the successful booking or cancellation.\n\n\ud83e\udde0 Why This is Useful\nManaging appointments can be time-consuming. This workflow automates the process, allowing users to schedule or cancel meetings effortlessly through a simple chat interface. It's ideal for:\n\nSolopreneurs managing their own schedules.\n\nSmall businesses coordinating meetings with clients.\n\nAnyone looking to streamline their appointment management process.\n\n\ud83e\ude9c Setup Instructions\nSet Up Telegram Bot:\n\nCreate a new bot using BotFather on Telegram.\nObtain the API token and set up the Telegram Trigger node in n8n with this token.\n\nOpenAI Platform API required for OpenAI Chat Model\n\nConnect to Google Calendar\n\nFor the full video tutorial, watch here:\nhttps://youtu.be/GzWO7_1lyI8"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "REDACTED",
  "connections": {
    "AI Agent": {
      "main": [
        [
          {
            "node": "Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Google Calendar1": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  }
}