{
  "id": "j2cXjrAKmMW32GkS",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Google Event Generator",
  "tags": [],
  "nodes": [
    {
      "id": "36eca77f-0591-4569-84af-dfdf3b4684a9",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        0,
        0
      ],
      "parameters": {
        "public": true,
        "options": {
          "responseMode": "responseNodes"
        },
        "initialMessages": "Hey bestieeeee, what can I schedule for you?"
      },
      "typeVersion": 1.3
    },
    {
      "id": "987900f2-9d37-484f-b0ef-8ec50f2a9df6",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        208,
        0
      ],
      "parameters": {
        "options": {
          "systemMessage": "=You are a scheduling agent inside an n8n workflow.\n\nNow (ISO8601): {{ $now.toISO() }}\nDefault timezone: Asia/Manila\n\nYour ONLY job is to create Google Calendar events by CALLING the attached tool.\nDo NOT return JSON to the user. Always call the tool.\n\nRequired fields:\n- summary (title) \u2192 MUST NOT be empty\n- description (optional)\n- start.dateTime (ISO8601 with offset, e.g. 2025-08-24T10:00:00+08:00)\n- end.dateTime (ISO8601 with offset)\n- timeZone (IANA string, e.g. \"Asia/Manila\")\n- location (optional)\n- attendees (array of { \"email\": \"user@example.com\" })\n\nTitle handling rules:\n- If the user gives a clear title (\u201cStandup\u201d, \u201cDentist\u201d), use it directly.\n- If the user does not give a title, infer a concise one from context. \n  Examples:\n  - \u201cLunch with John\u201d if user said \u201cschedule lunch with John tomorrow\u201d\n  - \u201cDentist\u201d if user said \u201cdentist appointment next Wed\u201d\n  - \u201cMeeting\u201d if nothing else is obvious\n- NEVER leave `summary` blank.\n\nTime handling rules:\n- Resolve relative times (\u201ctomorrow 10am\u201d, \u201cnext Wed 3\u20134:30pm\u201d) against Now and the default timezone.\n- If duration is given, compute end = start + duration.\n- If no end/duration given, default to 60 minutes.\n\nInteraction rules:\n- If either title or time is too ambiguous, ask ONE clarification question and wait.\n- Otherwise, immediately call the Calendar tool with the required fields.\n\nOutput policy:\n- Do not output JSON.\n- After the tool runs, summarize the booked event in one sentence (e.g., \u201cBooked Dentist on Sept 3, 2:00\u20132:30 PM Asia/Manila\u201d).\n"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "9c13d9b1-3e7a-4298-8527-310e7e804566",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        96,
        224
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "3bc6de4c-18e8-48f8-91ef-dc737eac3a6e",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        256,
        224
      ],
      "parameters": {
        "contextWindowLength": 10
      },
      "typeVersion": 1.3
    },
    {
      "id": "dcd82d7c-ad23-48c8-9e01-db1907a87bdd",
      "name": "Respond to Chat",
      "type": "@n8n/n8n-nodes-langchain.chat",
      "disabled": true,
      "position": [
        560,
        0
      ],
      "parameters": {
        "message": "Your event has been created!",
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "85d389c8-cd55-455c-9457-107ad084e254",
      "name": "Create an event in Google Calendar",
      "type": "n8n-nodes-base.googleCalendarTool",
      "position": [
        448,
        224
      ],
      "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": ""
        },
        "additionalFields": {
          "summary": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Summary', ``, 'string') }}"
        },
        "useDefaultReminders": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Use_Default_Reminders', ``, 'boolean') }}"
      },
      "credentials": {
        "googleCalendarOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "2d8ec69d-9949-44bf-aa9b-dd7483e63058",
  "connections": {
    "AI Agent": {
      "main": [
        [
          {
            "node": "Respond to Chat",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create an event in Google Calendar": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  }
}