{
  "updatedAt": "2025-10-07T19:58:53.000Z",
  "createdAt": "2025-10-02T09:10:18.946Z",
  "id": "ItaZuQMgqnRqTLmS",
  "name": "AI Concierge",
  "active": false,
  "isArchived": false,
  "nodes": [
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.output }}",
                    "rightValue": "Order Status",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "id": "c142d8a4-7867-46f1-b2f8-6a7a88ebb187"
                  }
                ],
                "combinator": "and"
              }
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "a3920af5-345d-4816-a768-44755bd7ac9e",
                    "leftValue": "={{ $json.output }}",
                    "rightValue": "Schedule Call",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              }
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.3,
      "position": [
        480,
        -64
      ],
      "id": "11d6a98e-f74c-400d-8e3c-ed43f35cd59e",
      "name": "Switch"
    },
    {
      "parameters": {
        "jsCode": "return [{\n  order_id: \"12345\",\n  status: \"In transit\",\n  eta: \"Tomorrow, 5 PM\"\n}];\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        720,
        -80
      ],
      "id": "596b99c8-8562-4a38-863d-21b34ba830ed",
      "name": "Code in JavaScript"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "017ff799-14ea-48e1-a92b-f815fb475caf",
              "name": "=order",
              "value": "=Your order #{{$json[\"order_id\"]}} is {{$json[\"status\"]}}. Expected delivery: {{$json[\"eta\"]}}.",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        928,
        -80
      ],
      "id": "ffcad022-9a82-4dc9-8081-4d7c1a6f4cc4",
      "name": "Edit Fields"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "typeVersion": 1,
      "position": [
        160,
        112
      ],
      "id": "61aaedb1-0593-42b9-98df-e234c99dbd65",
      "name": "Google Gemini Chat Model",
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.message.text }}",
        "options": {
          "systemMessage": "You are an intent classifier.\nClassify the message into one of two categories:\n- Order Status\n- Schedule Call\nRespond with only the classification.\nMessage: {{ $json.body.message }}\n"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2.2,
      "position": [
        208,
        -80
      ],
      "id": "8adcc188-f158-468c-9eae-a06468676844",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $('Telegram Trigger').item.json.message.text }}",
        "options": {
          "systemMessage": "=time now is : {{ $now }}\n# Overview\nYou are a calendar assistant. Your responsibilities include:\n- Creating, getting, updating, and deleting events in the user's calendar.\n- Finding or suggesting appropriate titles for meetings or events.\n- Identifying available time slots by analyzing existing events.\n\nYou can reason over event data that has already been provided to you.  \nYou should **never say you cannot fulfill a request** if you have enough data to calculate or suggest something.\n\n---\n\n## Calendar Management Tools \u2736\u2736\n\n\n- **Create Event with Attendee** \u2192 Use this when an event includes one or more participants.  \n- **Create Event** \u2192 Use this for solo events.  \n- **Get Events** \u2192 Fetch calendar schedules when requested, or when you need event data to reason about.  \n- **Update Event** \u2192 To update an event, you must first use **Get Events** to obtain its ID.  \n- **Delete Event** \u2192 To delete an event, you must first use **Get Events** to obtain its ID.  \n\nIf a duration for an event isn\u2019t specified, assume it will be **one hour**.\n\n---\n\n## Availability Reasoning\nIf you receive a list of events (with start and end times):\n- Sort them chronologically.\n- Determine the gaps between them.\n- Each gap represents a **free slot**.\n- Return your answer in **valid JSON** format.\n\nIf no events are provided, use the **Get Events** tool to fetch them first.  \nIf no free slots exist, return an empty list of available slots.\n## Final Notes \nHere is the current date/time: {{ $now }}\nUse this structure for responses:\n\n```json\n{\n  \"status\": \"success\",\n  \"available_slots\": [\n    { \"start\": \"2025-10-02T09:00\", \"end\": \"2025-10-02T10:30\" },\n    { \"start\": \"2025-10-02T12:00\", \"end\": \"2025-10-02T14:00\" }\n  ]\n}"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2.2,
      "position": [
        736,
        144
      ],
      "id": "8ce361f0-8621-40ff-9727-dc5a86942e2f",
      "name": "AI Agent1"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "typeVersion": 1,
      "position": [
        720,
        352
      ],
      "id": "3c2509e3-8a8f-4d4d-bd32-f65893916467",
      "name": "Google Gemini Chat Model1",
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.telegramTrigger",
      "typeVersion": 1.2,
      "position": [
        544,
        144
      ],
      "id": "be563ba4-7e7b-4dd5-a3a4-934fe1a1405b",
      "name": "Telegram Trigger",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "chatId": "={{ $('Telegram Trigger').item.json.message.from.id }}",
        "text": "={{ $json.order }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        1216,
        -80
      ],
      "id": "8bec50ba-2661-422c-bb3d-45a92ae22791",
      "name": "Send a text message",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "chatId": "={{ $('Telegram Trigger').item.json.message.from.id }}",
        "text": "={{ $json.output }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        1168,
        128
      ],
      "id": "749dee28-d85a-469d-a895-8c8e37e739f8",
      "name": "Send a text message1",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "calendar": {
          "__rl": true,
          "value": "abdellahkrimo13@gmail.com",
          "mode": "list",
          "cachedResultName": "abdellahkrimo13@gmail.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": [
        768,
        480
      ],
      "id": "9521a832-4f81-49ca-8c4f-aa7836c04721",
      "name": "Create an event in Google Calendar",
      "credentials": {
        "googleCalendarOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "update",
        "calendar": {
          "__rl": true,
          "value": "abdellahkrimo13@gmail.com",
          "mode": "list",
          "cachedResultName": "abdellahkrimo13@gmail.com"
        },
        "eventId": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Event_ID', ``, 'string') }}",
        "useDefaultReminders": "={{ true }}",
        "updateFields": {
          "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": [
        928,
        480
      ],
      "id": "10e36d25-98f8-4723-b9e7-71bf60c1bbae",
      "name": "Update an event in Google Calendar",
      "credentials": {
        "googleCalendarOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "delete",
        "calendar": {
          "__rl": true,
          "value": "abdellahkrimo13@gmail.com",
          "mode": "list",
          "cachedResultName": "abdellahkrimo13@gmail.com"
        },
        "eventId": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Event_ID', ``, 'string') }}",
        "options": {
          "sendUpdates": "all"
        }
      },
      "type": "n8n-nodes-base.googleCalendarTool",
      "typeVersion": 1.3,
      "position": [
        1280,
        480
      ],
      "id": "7787b1ff-0821-4645-b2de-aea10c4cd03b",
      "name": "Delete an event in Google Calendar",
      "credentials": {
        "googleCalendarOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "getAll",
        "calendar": {
          "__rl": true,
          "value": "abdellahkrimo13@gmail.com",
          "mode": "list",
          "cachedResultName": "abdellahkrimo13@gmail.com"
        },
        "returnAll": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Return_All', ``, 'boolean') }}",
        "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": [
        1104,
        480
      ],
      "id": "0a380512-1d01-4408-ab94-7e00aa9238e8",
      "name": "Get many events in Google Calendar",
      "credentials": {
        "googleCalendarOAuth2Api": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "Switch": {
      "main": [
        [],
        []
      ]
    },
    "Code in JavaScript": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Send a text message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent1": {
      "main": [
        [
          {
            "node": "Send a text message1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "AI Agent1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create an event in Google Calendar": {
      "ai_tool": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Update an event in Google Calendar": {
      "ai_tool": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Delete an event in Google Calendar": {
      "ai_tool": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get many events in Google Calendar": {
      "ai_tool": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1",
    "timezone": "Africa/Casablanca",
    "callerPolicy": "workflowsFromSameOwner"
  },
  "staticData": null,
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "versionId": "572e970f-397f-403b-8ffd-7ce54f3a6f9a",
  "activeVersionId": null,
  "triggerCount": 1,
  "shared": [
    {
      "updatedAt": "2025-10-02T09:10:18.954Z",
      "createdAt": "2025-10-02T09:10:18.954Z",
      "role": "workflow:owner",
      "workflowId": "ItaZuQMgqnRqTLmS",
      "projectId": "HHopAZ4lOFgjhBzT"
    }
  ],
  "activeVersion": null,
  "tags": []
}