{
  "name": "Calendar Booking Agent",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "f27a668f-31c3-4391-bf76-00518c5383a2",
        "responseMode": "responseNode",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2.1,
      "position": [
        0,
        0
      ],
      "id": "ce88ebe5-60e9-4a85-8292-0dacbe42014d",
      "name": "Webhook",
      "webhookId": "f27a668f-31c3-4391-bf76-00518c5383a2"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=Service: {{ $json.body.service }}\nDate: {{ $json.body.date }}\nTime: {{ $json.body.time }}\nName: {{ $json.body.name }}",
        "options": {
          "systemMessage": "=You are a booking ai agent - you are in AEDT timezone.\n\nYour job is to make bookings on google calendar.\n\nYou must first check the availabilities at that time\n\nif available create a calendar event with the service and name at the requested time and date.\n\nif not, return 2 other available times near to the requested date.\n\nToday's date is  {{ DateTime.now().setZone('Australia/Sydney') }}"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3,
      "position": [
        208,
        0
      ],
      "id": "304a43ab-94c9-4782-9219-ee0472acfc3d",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "builtInTools": {},
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.3,
      "position": [
        80,
        208
      ],
      "id": "5813208a-fcde-43a4-9267-2c9bf0903603",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "id": "EaHAE2NZa2gYhEPa",
          "name": "OpenAi account"
        }
      }
    },
    {
      "parameters": {
        "operation": "getAll",
        "calendar": {
          "__rl": true,
          "value": "kris@kristorrington.com",
          "mode": "list",
          "cachedResultName": "kris@kristorrington.com"
        },
        "timeMin": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('After', ``, 'string') }}",
        "timeMax": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Before', ``, 'string') }}",
        "options": {}
      },
      "type": "n8n-nodes-base.googleCalendarTool",
      "typeVersion": 1.3,
      "position": [
        272,
        208
      ],
      "id": "87a98a35-e18c-4540-8c5d-561f577829ad",
      "name": "Get many events in Google Calendar",
      "credentials": {
        "googleCalendarOAuth2Api": {
          "id": "pXOHCxjtp0SJlQU5",
          "name": "Google Calendar account"
        }
      }
    },
    {
      "parameters": {
        "calendar": {
          "__rl": true,
          "value": "kris@kristorrington.com",
          "mode": "list",
          "cachedResultName": "kris@kristorrington.com"
        },
        "start": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Start', ``, 'string') }}",
        "end": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('End', ``, 'string') }}",
        "additionalFields": {
          "description": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Description', ``, 'string') }}",
          "summary": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Summary', ``, 'string') }}"
        }
      },
      "type": "n8n-nodes-base.googleCalendarTool",
      "typeVersion": 1.3,
      "position": [
        464,
        208
      ],
      "id": "0f8878fc-b244-4942-a06d-5d6e6bc630c9",
      "name": "Create an event in Google Calendar",
      "credentials": {
        "googleCalendarOAuth2Api": {
          "id": "pXOHCxjtp0SJlQU5",
          "name": "Google Calendar account"
        }
      }
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.4,
      "position": [
        560,
        0
      ],
      "id": "ae2c71df-2b80-48ba-a2b4-e7125b40b6d0",
      "name": "Respond to Webhook"
    }
  ],
  "pinData": {},
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Get many events in Google Calendar": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Create an event in Google Calendar": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "cf6725e8-524a-4f1a-ba5e-6f2c5d4a90b6",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "7425b88d6f52190dec1f6e67c1b6cffa1a87557717f26de52e85eaddcf276948"
  },
  "id": "PKAiq4vFhXJs9dr0",
  "tags": []
}