- Why does the availability check indicate that I’m free at a specific date and time immediately after creating an event in that exact slot?
- Could there be a synchronization or caching issue causing the system to overlook the newly created event?
- Is there a potential misconfiguration in my workflow or API settings (using a Telegram trigger, an AI agent, and two separate Google Calendar tools) that might lead to this inconsistency?
- What steps can I take to ensure that the availability check accurately reflects the recently created event?
Here is the workflow
please help
{
“nodes”: [
{
“parameters”: {
“promptType”: “define”,
“text”: “={{ $json.message.text }}”,
“options”: {
“systemMessage”: “=# Tu es un assistant dédié à la gestion d’agenda.\n\n## Contexte\n- Nous sommes le {{$json["currentDate"]}}.\n- Le message de l’utilisateur est : {{ $json.message.text }}\n\n## Outils disponibles\n1. Google_Calendar_Availability \n - Pour consulter les événements de l’agenda et vérifier les disponibilités.\n2. Google_Calendar_Events \n - Pour créer des événements dans l’agenda.\n\n## Règles\n\n### 1. Création d’événement\n- Lorsque l’utilisateur demande de créer un événement, utilise Google_Calendar_Events.\n- Fournis obligatoirement :\n - La date\n - L’heure de début\n - L’heure de fin (si l’utilisateur ne précise pas, considère 1 heure par défaut)\n - Le titre (summary)\n - La description\n- Le champ summary doit inclure le titre exact fourni par l’utilisateur (ou un titre par défaut, par ex. “Événement”).\n\n### 2. Consultation d’événement (vérification de disponibilité)\n- Lorsque l’utilisateur souhaite vérifier sa disponibilité, utilise Google_Calendar_Availability pour interroger l’agenda.\n- Ne l’utilise pas pour créer un événement.\n\n### 3. Calcul de la date\n- Ignore toute autre source de date.\n- Si l’utilisateur mentionne une date relative (ex. “vendredi prochain”), calcule la date à partir de {{$json["currentDate"]}}.\n- Si le jour mentionné est déjà passé ou correspond à aujourd’hui, bascule sur le même jour de la semaine suivante.\n- Ne propose jamais de date différente de celle calculée selon ces règles.\n\n### 4. Titre (summary)\n- Ne crée jamais d’événement sans titre. \n- Le titre (summary) doit inclure la date et l’horaire.\n\n### 5. Sortie JSON stricte\n- Lorsque tu appelles Google_Calendar_Events pour créer un événement, renvoie uniquement du JSON valide (sans texte additionnel, sans Markdown).\n- Idem pour Google_Calendar_Availability : renvoie seulement la structure JSON attendue.\n\n—\n”
}
},
“type”: “@n8n/n8n-nodes-langchain.agent”,
“typeVersion”: 1.7,
“position”: [
1720,
320
],
“id”: “f1d8dd19-54bd-4e09-b61b-226315f1573b”,
“name”: “AI Agent”
},
{
“parameters”: {
“updates”: [
“message”
],
“additionalFields”: {}
},
“type”: “n8n-nodes-base.telegramTrigger”,
“typeVersion”: 1.1,
“position”: [
1280,
320
],
“id”: “6eeed94b-6d2a-4572-a24d-cf74cab346c8”,
“name”: “Telegram Message”,
“webhookId”: “969fe005-abe4-470f-88ea-f323f1135e82”,
“credentials”: {
“telegramApi”: {
“id”: “hjpttljMqWaVLeha”,
“name”: “Telegram account”
}
}
},
{
“parameters”: {
“jsCode”: “// On récupère tous les items reçus en entrée\nconst items = $input.all();\n\n// Pour chacun, on définit un nouveau champ "currentDate"\nfor (const item of items) {\n // On génère la date du jour\n const now = new Date();\n\n // Récupération du jour, du mois et de l’année avec un format à deux chiffres pour le jour et le mois\n const day = String(now.getDate()).padStart(2, ‘0’);\n const month = String(now.getMonth() + 1).padStart(2, ‘0’);\n const year = now.getFullYear();\n\n // Formatage en JJ-MM-AAAA\n const formattedDate = `${day}-${month}-${year}`;\n\n // On assigne la date formatée au champ "currentDate"\n item.json.currentDate = formattedDate;\n}\n\n// On renvoie tous les items, chacun ayant maintenant item.json.currentDate\nreturn items;”
},
“type”: “n8n-nodes-base.code”,
“typeVersion”: 2,
“position”: [
1500,
320
],
“id”: “1cc5ff2f-be82-4cf6-a563-b94331030858”,
“name”: “Current_Date”
},
{
“parameters”: {
“options”: {}
},
“type”: “@n8n/n8n-nodes-langchain.lmChatOpenRouter”,
“typeVersion”: 1,
“position”: [
1580,
600
],
“id”: “1b824df2-6706-46fc-9856-377bcf896f03”,
“name”: “OpenRouter Chat Model”,
“credentials”: {
“openRouterApi”: {
“id”: “JNG6vMIUc6SlgvzY”,
“name”: “OpenRouter account”
}
}
},
{
“parameters”: {
“sessionIdType”: “customKey”,
“sessionKey”: “={{ $json.update_id }}”,
“contextWindowLength”: 10
},
“type”: “@n8n/n8n-nodes-langchain.memoryBufferWindow”,
“typeVersion”: 1.3,
“position”: [
1720,
600
],
“id”: “c1dd22f4-892f-465b-b145-70e76856b806”,
“name”: “Simple Memory”
},
{
“parameters”: {
“chatId”: “={{ $(‘Telegram Message’).item.json.message.chat.id }}”,
“text”: “={{ $json.output }}”,
“additionalFields”: {
“appendAttribution”: false
}
},
“type”: “n8n-nodes-base.telegram”,
“typeVersion”: 1.2,
“position”: [
2080,
320
],
“id”: “d8555a00-9c5f-4a16-ba38-37a86be3ecb9”,
“name”: “Telegram”,
“webhookId”: “5c73bf3b-ef90-4075-b63c-86c4bfd2379b”,
“credentials”: {
“telegramApi”: {
“id”: “hjpttljMqWaVLeha”,
“name”: “Telegram account”
}
}
},
{
“parameters”: {
“resource”: “calendar”,
“calendar”: {
“__rl”: true,
“value”: “57190c329700ce4e213a1d7aa8d1dd4b0545c1b5242812b57c7820976a675668@group.calendar.google.com”,
“mode”: “list”,
“cachedResultName”: “Général”
},
“timeMin”: “={{ /n8n-auto-generated-fromAI-override/ $fromAI(‘Start_Time’, ``, ‘string’) }}”,
“timeMax”: “={{ /n8n-auto-generated-fromAI-override/ $fromAI(‘End_Time’, ``, ‘string’) }}”,
“options”: {
“outputFormat”: “availability”,
“timezone”: {
“__rl”: true,
“value”: “Europe/Paris”,
“mode”: “list”,
“cachedResultName”: “Europe/Paris”
}
}
},
“type”: “n8n-nodes-base.googleCalendarTool”,
“typeVersion”: 1.3,
“position”: [
2240,
600
],
“id”: “df7db254-f657-4d12-bac5-f4ae9b253f93”,
“name”: “Google_Calendar_Availability”,
“credentials”: {
“googleCalendarOAuth2Api”: {
“id”: “lPXu7sq0mHsiLUAc”,
“name”: “Google Calendar account 2”
}
}
},
{
“parameters”: {
“calendar”: {
“__rl”: true,
“value”: “57190c329700ce4e213a1d7aa8d1dd4b0545c1b5242812b57c7820976a675668@group.calendar.google.com”,
“mode”: “list”,
“cachedResultName”: “Général”
},
“start”: “={{ /n8n-auto-generated-fromAI-override/ $fromAI(‘Start’, ``, ‘string’) }}”,
“end”: “={{ /n8n-auto-generated-fromAI-override/ $fromAI(‘End’, ``, ‘string’) }}”,
“useDefaultReminders”: “={{ /n8n-auto-generated-fromAI-override/ $fromAI(‘Use_Default_Reminders’, ``, ‘boolean’) }}”,
“additionalFields”: {
“description”: “={{ /n8n-auto-generated-fromAI-override/ $fromAI(‘Description’, ``, ‘string’) }}”,
“showMeAs”: “opaque”,
“summary”: “={{ /n8n-auto-generated-fromAI-override/ $fromAI(‘Summary’, ``, ‘string’) }}”
}
},
“type”: “n8n-nodes-base.googleCalendarTool”,
“typeVersion”: 1.3,
“position”: [
2040,
600
],
“id”: “2147adb6-6bd2-4018-8b73-4f2c3f9fbf41”,
“name”: “Google_Calendar_Events”,
“credentials”: {
“googleCalendarOAuth2Api”: {
“id”: “lPXu7sq0mHsiLUAc”,
“name”: “Google Calendar account 2”
}
}
}
],
“connections”: {
“AI Agent”: {
“main”: [
[
{
“node”: “Telegram”,
“type”: “main”,
“index”: 0
}
]
]
},
“Telegram Message”: {
“main”: [
[
{
“node”: “Current_Date”,
“type”: “main”,
“index”: 0
}
]
]
},
“Current_Date”: {
“main”: [
[
{
“node”: “AI Agent”,
“type”: “main”,
“index”: 0
}
]
]
},
“OpenRouter Chat Model”: {
“ai_languageModel”: [
[
{
“node”: “AI Agent”,
“type”: “ai_languageModel”,
“index”: 0
}
]
]
},
“Simple Memory”: {
“ai_memory”: [
[
{
“node”: “AI Agent”,
“type”: “ai_memory”,
“index”: 0
}
]
]
},
“Google_Calendar_Availability”: {
“ai_tool”: [
[
{
“node”: “AI Agent”,
“type”: “ai_tool”,
“index”: 0
}
]
]
},
“Google_Calendar_Events”: {
“ai_tool”: [
[
{
“node”: “AI Agent”,
“type”: “ai_tool”,
“index”: 0
}
]
]
}
},
“pinData”: {},
“meta”: {
“templateCredsSetupCompleted”: true,
“instanceId”: “5f4b6adcc32bdda4009cb0297e0e49d68df6d6d50886acf2b5cb773f6eeac789”
}
}