{
  "name": "Personal Assistant Demo",
  "nodes": [
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.1,
      "position": [
        140,
        0
      ],
      "id": "ef1e5500-281e-4513-8553-40bf9d680f37",
      "name": "When chat message received",
      "webhookId": "b7800285-d29b-4b30-bffb-7572320cc2de"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        180,
        280
      ],
      "id": "3173bc73-f246-4d13-8245-1544bbf9647c",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "id": "MzIepidaRw9ZqcPB",
          "name": "OpenAi account Credentials"
        }
      }
    },
    {
      "parameters": {
        "documentId": {
          "__rl": true,
          "value": "1xdAtUAGCcSbkQl2GLY-7OxU8EGAFNo26JKdaxAYxLH0",
          "mode": "list",
          "cachedResultName": "CRM Data",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1xdAtUAGCcSbkQl2GLY-7OxU8EGAFNo26JKdaxAYxLH0/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "Contacts",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1xdAtUAGCcSbkQl2GLY-7OxU8EGAFNo26JKdaxAYxLH0/edit#gid=0"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheetsTool",
      "typeVersion": 4.6,
      "position": [
        340,
        280
      ],
      "id": "51f95a21-9fa9-4fa1-b3f6-cfff51cd3766",
      "name": "Get Contact Details",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "ESD8JJHqd8A9NlNx",
          "name": "Google Sheets account (Kris)"
        }
      }
    },
    {
      "parameters": {
        "calendar": {
          "__rl": true,
          "value": "kris@r3d.ai",
          "mode": "list",
          "cachedResultName": "kris@r3d.ai"
        },
        "start": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Start', ``, 'string') }}",
        "end": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('End', ``, 'string') }}",
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.googleCalendarTool",
      "typeVersion": 1.3,
      "position": [
        600,
        280
      ],
      "id": "acd504ce-f1f2-41d8-8aed-6fdd31074ae7",
      "name": "Create Calendar Meeting",
      "credentials": {
        "googleCalendarOAuth2Api": {
          "id": "g0JMbHIyYamfgiiM",
          "name": "KT Google Calendar account"
        }
      }
    },
    {
      "parameters": {
        "operation": "getAll",
        "calendar": {
          "__rl": true,
          "value": "kris@r3d.ai",
          "mode": "list",
          "cachedResultName": "kris@r3d.ai"
        },
        "limit": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Limit', ``, 'number') }}",
        "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": [
        480,
        280
      ],
      "id": "2c5756ed-68ad-48e0-b64e-45fb80811dbe",
      "name": "Get Calendar",
      "credentials": {
        "googleCalendarOAuth2Api": {
          "id": "g0JMbHIyYamfgiiM",
          "name": "KT Google Calendar account"
        }
      }
    },
    {
      "parameters": {
        "sendTo": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('To', ``, 'string') }}",
        "subject": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Subject', ``, 'string') }}",
        "emailType": "text",
        "message": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message', ``, 'string') }}",
        "options": {
          "appendAttribution": false
        }
      },
      "type": "n8n-nodes-base.gmailTool",
      "typeVersion": 2.1,
      "position": [
        740,
        280
      ],
      "id": "475a015e-4fb3-4533-a859-6fe41ed32d77",
      "name": "Send Email",
      "webhookId": "b43582e4-e894-434b-80f4-f24e7fdce118",
      "credentials": {
        "gmailOAuth2": {
          "id": "xmp6P6qtAw4JgOCe",
          "name": "Gmail account"
        }
      }
    },
    {
      "parameters": {
        "options": {
          "systemMessage": "You are a smart AI Personal Assistant with access to Google Sheets, Calendar, and Gmail.\nJust follow the steps and do not ask me for confirmation.\n\nYour current time reference is:\n🕒 {{ $now.toISO() }}\nUse this as the basis to interpret any relative time expressions (e.g. “tomorrow at 1pm” or “next Tuesday”).\n\nIf the User doesn't specify a duration, assume 1 hour.  (You do not need to confirm with the User, just go book it).\n\nWhen handling user requests, follow this logical step-by-step process:\n\nGet Contact Details:\n\nSearch the Google Sheet to find the person’s name, email, and other relevant info.\n\nCheck Calendar Availability:\n\nAccess the calendar to check both the user’s and the contact’s availability (if shared or provided).\n\nCreate Calendar Meeting:\n\nGenerate a meeting invite with the appropriate date, time, location (or link), and title.\n\nSend Email Confirmation:\n\nEmail the contact confirming the meeting details, and optionally send a copy to the user and always sign off as Best Regards, Kris\n\nAlways confirm each step before proceeding.\nIf any required data is missing (e.g. contact email or calendar access), ask the user before continuing."
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2,
      "position": [
        360,
        0
      ],
      "id": "5c84ffda-7e60-44b4-aef6-9d34c876a9cb",
      "name": "AI Personal Assistant"
    }
  ],
  "pinData": {},
  "connections": {
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Personal Assistant",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Personal Assistant",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Get Contact Details": {
      "ai_tool": [
        [
          {
            "node": "AI Personal Assistant",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Create Calendar Meeting": {
      "ai_tool": [
        [
          {
            "node": "AI Personal Assistant",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get Calendar": {
      "ai_tool": [
        [
          {
            "node": "AI Personal Assistant",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Send Email": {
      "ai_tool": [
        [
          {
            "node": "AI Personal Assistant",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "62ad9186-8072-4072-bc47-da8f93c315ff",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "4aabc0aa2e160dafa4f9d9bcedde563b5af29598cd16960f637ae2fb99aea720"
  },
  "id": "wJ4PxDZQMr6tvSti",
  "tags": []
}