This workflow follows the Agent → Google Gemini Embeddings recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"name": "Gmail Telegram AI Automation",
"nodes": [
{
"parameters": {
"jsCode": "// UNIVERSAL MERGE FUNCTION\n// Input: multiple items (any shape)\n// Output: ONE item with merged fields\n\nconst items = $input.all();\n\nconst merged = {};\n\nfor (const item of items) {\n if (item.json && typeof item.json === 'object') {\n Object.assign(merged, item.json);\n }\n}\n\nreturn [\n {\n json: merged\n }\n];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1376,
-128
],
"id": "46ff388c-fc70-4fc9-81ce-0c3999fddc94",
"name": "1"
},
{
"parameters": {
"jsCode": "// ONE-SHOT: extract meeting slot + build RFC3339 datetime strings\n// INPUT: clean_body\n// OUTPUT: calendar_ready + startDateTime + endDateTime (RFC3339)\n\nconst text = ($json.clean_body || \"\").toLowerCase();\nconst timeZone = \"Asia/Kolkata\";\nconst tzOffset = \"+05:30\";\n\n// ---- SLOT DEFINITIONS (first match wins) ----\nconst slots = [\n {\n day: 2, // Tuesday\n dayName: \"Tuesday\",\n dayRe: /tuesday/,\n timeRe: /after\\s*2\\s*pm/,\n start: \"14:00\",\n end: \"15:00\",\n },\n {\n day: 4, // Thursday\n dayName: \"Thursday\",\n dayRe: /thursday/,\n timeRe: /before\\s*4\\s*pm/,\n start: \"15:00\",\n end: \"16:00\",\n },\n];\n\nlet slot = null;\nfor (const s of slots) {\n if (s.dayRe.test(text) && s.timeRe.test(text)) {\n slot = s;\n break;\n }\n}\n\n// ---- NO SLOT FOUND ----\nif (!slot) {\n return [{\n json: {\n ...$json,\n calendar_ready: false,\n status: \"Needs Clarification\",\n reason: \"No valid meeting slot found\",\n }\n }];\n}\n\n// ---- FIND NEXT WEEKDAY DATE ----\nconst now = new Date();\nconst today = now.getDay(); // 0=Sun ... 6=Sat\nlet diff = (slot.day - today + 7) % 7;\nif (diff === 0) diff = 7; // always future\n\nconst meetingDate = new Date(now);\nmeetingDate.setDate(now.getDate() + diff);\n\n// YYYY-MM-DD\nconst yyyy = meetingDate.getFullYear();\nconst mm = String(meetingDate.getMonth() + 1).padStart(2, \"0\");\nconst dd = String(meetingDate.getDate()).padStart(2, \"0\");\nconst dateStr = `${yyyy}-${mm}-${dd}`;\n\n// ---- RFC3339 DATETIMES ----\nconst startDateTime = `${dateStr}T${slot.start}:00${tzOffset}`;\nconst endDateTime = `${dateStr}T${slot.end}:00${tzOffset}`;\n\nreturn [{\n json: {\n ...$json,\n calendar_ready: true,\n status: \"Ready to Schedule\",\n startDateTime,\n endDateTime,\n timeZone,\n }\n}];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1600,
-128
],
"id": "41271af3-2ff3-4bf7-ad46-ea6f363fcad7",
"name": "2"
},
{
"parameters": {
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
},
"filters": {}
},
"type": "n8n-nodes-base.gmailTrigger",
"typeVersion": 1.3,
"position": [
32,
-368
],
"id": "77bab0f2-4b45-4134-8880-7b21e2fa2b9a",
"name": "Gmail Trigger"
},
{
"parameters": {
"promptType": "define",
"text": "=Classify the email into exactly ONE category.\n\nCategories:\nmeeting_request\ntask_request\nfollow_up\ninformation\nspam\n\nReturn ONLY valid JSON in this exact format:\n{ \"category\": \"<one category>\" }\n{{ $json.clean_body }}",
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 3.1,
"position": [
784,
-448
],
"id": "a8132751-8a9b-444a-8cc7-3b6865ebdf05",
"name": "AI Agent"
},
{
"parameters": {
"jsCode": "function cleanEmail(text) {\n if (!text) return \"\";\n\n // Remove quoted replies\n text = text.split(/On .* wrote:/i)[0];\n\n // Remove common signature separators\n text = text.split(/--\\s*\\n/)[0];\n\n // Remove mobile signatures\n text = text.replace(/Sent from my.*$/i, \"\");\n\n // Trim excessive whitespace\n return text.trim().slice(0, 2000); // hard cap for AI\n}\n\nconst results = [];\n\nfor (const item of $input.all()) {\n const email = item.json;\n\n results.push({\n json: {\n from: email.from || email.headers?.from || \"\",\n subject: email.subject || \"\",\n clean_body: cleanEmail(\n email.textPlain || email.snippet || \"\"\n ),\n received_at: new Date(Number(email.internalDate)).toISOString(),\n thread_id: email.threadId || \"\"\n }\n });\n}\n\nreturn results;"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
256,
-368
],
"id": "1e77486a-b39e-4b32-9b02-1fbe5bbe4e80",
"name": "Code in JavaScript"
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "b2478495-db0a-463f-90f0-e0954f25bed2",
"leftValue": "={{ $json.clean_body }}",
"rightValue": "\"access to your Google Account\" \"security alert\" \"new sign-in\" \"didn't allow\" \"verify your account\"",
"operator": {
"type": "string",
"operation": "contains"
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.3,
"position": [
480,
-368
],
"id": "0a1848ae-9695-4069-bd34-e69213b586ee",
"name": "If"
},
{
"parameters": {},
"type": "n8n-nodes-base.noOp",
"typeVersion": 1,
"position": [
768,
-656
],
"id": "206da784-958a-4810-8b89-97bf4827b4f3",
"name": "No Operation, do nothing"
},
{
"parameters": {
"jsCode": "return [{\n json: JSON.parse($json.output)\n}];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1152,
-608
],
"id": "2a7f3961-0d14-4019-bd05-7ee3682b5e06",
"name": "Code in JavaScript1"
},
{
"parameters": {
"rules": {
"values": [
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"leftValue": "={{ $json.category }}",
"rightValue": "meeting_request",
"operator": {
"type": "string",
"operation": "equals"
},
"id": "4e6d0404-cc03-4b09-ae37-9bd0c15cb67f"
}
],
"combinator": "and"
}
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "4bde3985-1608-46bb-b355-c072d839341f",
"leftValue": "={{ $json.category }}",
"rightValue": "task_request",
"operator": {
"type": "string",
"operation": "equals"
}
}
],
"combinator": "and"
}
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "528fd487-bae6-4f17-a7f8-2037a665ad4a",
"leftValue": "={{ $json.category }}",
"rightValue": "follow_up",
"operator": {
"type": "string",
"operation": "equals"
}
}
],
"combinator": "and"
}
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "a2f92843-0bdc-46b1-949b-56d27f89e259",
"leftValue": "={{ $json.category }}",
"rightValue": "information",
"operator": {
"type": "string",
"operation": "equals"
}
}
],
"combinator": "and"
}
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "60376705-ca88-4cef-aa1c-e893987b0115",
"leftValue": "={{ $json.category }}",
"rightValue": "spam",
"operator": {
"type": "string",
"operation": "equals"
}
}
],
"combinator": "and"
}
}
]
},
"options": {}
},
"type": "n8n-nodes-base.switch",
"typeVersion": 3.4,
"position": [
1344,
-480
],
"id": "2bf6925e-d664-4d6d-a016-65d3eb0ebf50",
"name": "Switch"
},
{
"parameters": {
"operation": "append",
"documentId": {
"__rl": true,
"value": "YOUR_GOOGLE_SHEET_ID",
"mode": "id",
"cachedResultName": "Email Automation Log"
},
"sheetName": {
"__rl": true,
"value": "Sheet1",
"mode": "name",
"cachedResultName": "Sheet1"
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"Category": "={{ $json.category }}",
"From": "={{ $('If').item.json.from }}",
"Subject": "={{ $('If').item.json.subject }}",
"Received Date": "={{ $('If').item.json.received_at }}",
"Snippet": "={{ $('If').item.json.clean_body }}",
"Email Link": "={{ $json.email_link }}",
"Status": "={{ $json.status }}"
},
"matchingColumns": [],
"schema": [
{
"id": "Received Date",
"displayName": "Received Date",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "From",
"displayName": "From",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Subject",
"displayName": "Subject",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Category",
"displayName": "Category",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Snippet",
"displayName": "Snippet",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Status",
"displayName": "Status",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Email Link",
"displayName": "Email Link",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
}
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {}
},
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.7,
"position": [
1744,
-608
],
"id": "98bfe3a0-11b7-47d5-9bab-5cc6526fa5f2",
"name": "Append row in sheet"
},
{
"parameters": {
"jsCode": "return [{\n json: {\n received_date: new Date().toISOString(),\n from: $json.from || $json.From,\n subject: $json.subject || $json.Subject,\n category: \"meeting_request\",\n status: \"Needs Scheduling\",\n snippet: $json.clean_body || $json.snippet,\n email_link: $json.messageLink || \"\"\n }\n}];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1552,
-432
],
"id": "759a2471-a02a-40fe-9220-2a8a4fbc814a",
"name": "meeting_request branch"
},
{
"parameters": {},
"type": "n8n-nodes-base.merge",
"typeVersion": 3.2,
"position": [
1152,
-128
],
"id": "c31a1f96-988b-4b8d-95f6-571bfd73c15a",
"name": "Merge"
},
{
"parameters": {
"calendar": {
"__rl": true,
"value": "primary",
"mode": "id",
"cachedResultName": "primary"
},
"start": "={{ $json.startDateTime }}",
"end": "={{ $json.endDateTime }}",
"additionalFields": {}
},
"type": "n8n-nodes-base.googleCalendar",
"typeVersion": 1.3,
"position": [
1824,
-128
],
"id": "4c8d4f87-ccb9-4c07-bed1-ff2221e85894",
"name": "Create an event"
},
{
"parameters": {
"updates": [
"message"
],
"additionalFields": {}
},
"type": "n8n-nodes-base.telegramTrigger",
"typeVersion": 1.2,
"position": [
528,
304
],
"id": "90fc7dc3-3f85-4c65-b60c-1e0944997042",
"name": "Telegram Trigger"
},
{
"parameters": {
"descriptionType": "manual",
"toolDescription": "Consume the Gmail API to get the last emails",
"operation": "getAll",
"limit": "={{ $fromAI(\"limit\", \"The maximal number of mails to receive.\", \"number\") }}",
"filters": {
"q": "in:inbox"
}
},
"id": "541b3476-9908-4f30-9b0d-481403daace3",
"name": "Get last emails",
"type": "n8n-nodes-base.gmailTool",
"position": [
96,
976
],
"typeVersion": 2.1
},
{
"parameters": {
"descriptionType": "manual",
"toolDescription": "Consume Google Calendar API to receive a list of calendar events between \"start\" and \"end\". Make sure to pass datetime.",
"operation": "getAll",
"calendar": {
"__rl": true,
"value": "primary",
"mode": "id",
"cachedResultName": "primary"
},
"limit": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Limit', `the amount of event`, 'number') }}",
"timeMin": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('After', `start date in format \"2017-07-01T13:00:00+02:00\"`, 'string') }}",
"timeMax": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Before', `end date in format \"2017-07-01T13:00:00+02:00\"`, 'string') }}",
"options": {}
},
"id": "91d0db3c-5c42-49df-ab71-a30990190843",
"name": "Get calendar events",
"type": "n8n-nodes-base.googleCalendarTool",
"position": [
944,
1024
],
"typeVersion": 1.3
},
{
"parameters": {
"descriptionType": "manual",
"toolDescription": "Call the Gmail API to delete an email. Always request the email message id before calling this tool.",
"operation": "delete",
"messageId": "={{ $fromAI('Message_ID', ``, 'string') }}"
},
"id": "2bd01289-78ce-4b86-8afa-95c2c8589898",
"name": "Delete an email",
"type": "n8n-nodes-base.gmailTool",
"position": [
448,
992
],
"typeVersion": 2.1
},
{
"parameters": {
"descriptionType": "manual",
"toolDescription": "Call Gmail API to create a Draft message as Reply To an existing email or email thread. Pass the correct Thread-Id of the message. To get the Thread ID call the Get Email Tool before.",
"resource": "draft",
"subject": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Subject', ``, 'string') }}",
"message": "={{ $fromAI('Message', `The Text that should be send in reply`, 'string') }}",
"options": {
"threadId": "={{ $fromAI('thread-ID', `The ID of the thread. Need to be received from the Email Tool Response. Use the exact ID and better call the Get Email Tool again`, 'string') }}",
"sendTo": "={{ $fromAI('To_Email', `The email adress of the sender`, 'string') }}"
}
},
"id": "fcf80dc1-b57e-46a9-88e5-20e920681e82",
"name": "Create an Email Draft as response to a thread",
"type": "n8n-nodes-base.gmailTool",
"position": [
128,
1136
],
"typeVersion": 2.1
},
{
"parameters": {
"descriptionType": "manual",
"toolDescription": "Call Gmail API to create a New outgoing Draft message.",
"resource": "draft",
"subject": "={{ $fromAI('Subject', ``, 'string') }}",
"message": "={{ $fromAI('Message', `The Text that should be send in reply`, 'string') }}",
"options": {
"sendTo": "={{ $fromAI('To_Email', `The email adress of the sender`, 'string') }}"
}
},
"id": "cd0e43bf-16be-4cff-86da-ab21fd49d80a",
"name": "Create an New Email Draft",
"type": "n8n-nodes-base.gmailTool",
"position": [
288,
976
],
"typeVersion": 2.1
},
{
"parameters": {
"content": "## Email Access Tools",
"height": 460,
"width": 520
},
"id": "01a0caf1-1e84-4b2d-ae05-509be83f251b",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
48,
880
],
"typeVersion": 1
},
{
"parameters": {
"content": "## Calender Access Tools",
"height": 460,
"width": 520,
"color": 6
},
"id": "12525aa6-77ae-4489-93f1-34ccaa907972",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
832,
880
],
"typeVersion": 1
},
{
"parameters": {
"descriptionType": "manual",
"toolDescription": "Consume Google Calendar API to add a new event or meeting to the calender",
"calendar": {
"__rl": true,
"value": "primary",
"mode": "id",
"cachedResultName": "primary"
},
"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') }}"
}
},
"id": "4e370b74-0314-431e-8d09-078958d41d14",
"name": "Add an calender entry",
"type": "n8n-nodes-base.googleCalendarTool",
"position": [
1136,
1024
],
"typeVersion": 1.3
},
{
"parameters": {
"content": "## Knowlede about past email conversations",
"height": 620,
"width": 520,
"color": 5
},
"id": "647919d7-5d8b-48c5-ba04-13bed089dbe9",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
1600,
688
],
"typeVersion": 1
},
{
"parameters": {
"descriptionType": "manual",
"toolDescription": "Consume the Gmail API to receive an email by message-id",
"operation": "get",
"messageId": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message_ID', ``, 'string') }}"
},
"id": "ca0c9608-2bc6-4919-b79f-fd5d3f6efd1c",
"name": "Get an email by MessageID",
"type": "n8n-nodes-base.gmailTool",
"position": [
352,
1152
],
"typeVersion": 2.1
},
{
"parameters": {
"description": "Can answer questions and do research in previous email conversations. Use this tool whenever you need more context about past conversations to an email. \nFor better retrieval and more context always pass the email-adresses to the query!\n"
},
"id": "55ee7247-3387-4c8d-8932-63838295c709",
"name": "Research context and infos in previous conversations",
"type": "@n8n/n8n-nodes-langchain.toolVectorStore",
"position": [
1744,
752
],
"typeVersion": 1.1
},
{
"parameters": {
"promptType": "define",
"text": "={{ $json.message.text }}",
"options": {
"systemMessage": "=# AI Assistant - Gmail Inbox & Calendar\n\n## Role\nYou are the workflow owner's AI assistant for Gmail and Google Calendar management.\nYou help review inbox items, draft replies, summarize context, and manage calendar actions.\n\n## Time & Context\n- Today is {{ $now }}\n- Use the workflow owner's configured timezone.\n- Calendar tools may require UTC or RFC3339 timestamps; convert times carefully before execution and display them clearly.\n\n## Scope\nYou can:\n- Analyze emails and calendar data\n- Detect meeting requests, tasks, follow-ups, information, and spam\n- Draft professional email replies\n- Propose calendar events and available slots\n- Check calendar availability and conflicts\n- Create, update, or delete calendar events only after authorization\n\n## Operating Model\n\n### Phase 1 - Propose\nWhen the user asks for an action:\n- Extract all required details\n- Ask concise follow-up questions if required fields are missing\n- If all required fields are present, summarize the proposed action and ask for confirmation\n- Do not execute tools in this phase\n\n### Phase 2 - Execute\nIf the user clearly confirms, and all required fields are already known:\n- Immediately execute the relevant tool\n- Do not ask further questions\n- Do not re-summarize before acting\n- Treat the confirmation as final authorization\n\n## Calendar Rules\n- Required fields: title, start time, and end time\n- Check for conflicts unless explicitly told not to\n- Use the primary calendar unless the user specifies another calendar\n\n## Email Rules\n- Preserve and show MessageID when handling emails\n- Draft replies must be friendly, professional, and concise\n- Never send or draft emails without explicit confirmation\n\n## Output Rules\n- Never claim an event was created unless the calendar tool executed successfully\n- If execution succeeds, confirm with title, date, and time\n- If not executed, say Ready to create or Waiting for confirmation\n\n## Failure Safety\nIf confirmation is unclear, do not execute. Ask one short clarification question."
}
},
"id": "7e6a0e6a-934d-482b-9ee0-c5124389492a",
"name": "EMail Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
864,
320
],
"typeVersion": 1.7
},
{
"parameters": {},
"id": "7a8fa932-6e04-40e7-a710-86d26b93de18",
"name": "Threads History Vector Store",
"type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
"position": [
1680,
960
],
"typeVersion": 1.1
},
{
"parameters": {
"descriptionType": "manual",
"toolDescription": "Formats the date in the name of the day of the week. Always use this before you output weekdays.",
"operation": "formatDate",
"date": "={{ $fromAI('Date', ``, 'string') }}",
"format": "custom",
"customFormat": "EEEE dd MM ",
"outputFieldName": "=formattedDate",
"options": {}
},
"id": "1d561dfb-d604-4187-9b91-d95671b37b92",
"name": "Determine the name of the day of the week",
"type": "n8n-nodes-base.dateTimeTool",
"position": [
1024,
1184
],
"typeVersion": 2
},
{
"parameters": {
"chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
"text": "={{ $json.output }}",
"additionalFields": {}
},
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.2,
"position": [
1264,
288
],
"id": "97fdcb1b-e5b6-4e78-85db-aa36355a721d",
"name": "Send a text message"
},
{
"parameters": {
"sessionIdType": "customKey",
"sessionKey": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
"contextWindowLength": 10
},
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"typeVersion": 1.3,
"position": [
880,
528
],
"id": "e64118a3-fc35-4bf9-8aab-8f6c70d8c800",
"name": "Simple Memory"
},
{
"parameters": {
"content": "Email Classification on Google Sheet\n",
"height": 464,
"width": 880
},
"type": "n8n-nodes-base.stickyNote",
"position": [
1104,
-688
],
"typeVersion": 1,
"id": "34a7fba0-d07b-4d4c-a279-813d95b250c5",
"name": "Sticky Note"
},
{
"parameters": {
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"typeVersion": 1,
"position": [
688,
544
],
"id": "a571cc32-a29f-4866-b686-483f3ca8d97d",
"name": "Google Gemini Chat Model"
},
{
"parameters": {},
"type": "@n8n/n8n-nodes-langchain.embeddingsGoogleGemini",
"typeVersion": 1,
"position": [
1680,
1184
],
"id": "6e5f1ad9-0ffb-49c8-8db3-3fddef629cac",
"name": "Embeddings Google Gemini"
},
{
"parameters": {
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"typeVersion": 1,
"position": [
2016,
992
],
"id": "12314cb9-f3ff-4113-9f2f-dd73c5546a85",
"name": "Google Gemini Chat Model1"
},
{
"parameters": {
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"typeVersion": 1,
"position": [
768,
-160
],
"id": "d3b391da-a4d1-4d2c-aa94-63e6538670a6",
"name": "Google Gemini Chat Model2"
}
],
"connections": {
"1": {
"main": [
[
{
"node": "2",
"type": "main",
"index": 0
}
]
]
},
"2": {
"main": [
[
{
"node": "Create an event",
"type": "main",
"index": 0
}
]
]
},
"Gmail Trigger": {
"main": [
[
{
"node": "Code in JavaScript",
"type": "main",
"index": 0
}
]
]
},
"Code in JavaScript": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
},
"If": {
"main": [
[
{
"node": "No Operation, do nothing",
"type": "main",
"index": 0
}
],
[
{
"node": "AI Agent",
"type": "main",
"index": 0
},
{
"node": "Merge",
"type": "main",
"index": 1
}
]
]
},
"AI Agent": {
"main": [
[
{
"node": "Code in JavaScript1",
"type": "main",
"index": 0
}
]
]
},
"Code in JavaScript1": {
"main": [
[
{
"node": "Switch",
"type": "main",
"index": 0
},
{
"node": "Append row in sheet",
"type": "main",
"index": 0
}
]
]
},
"Switch": {
"main": [
[
{
"node": "meeting_request branch",
"type": "main",
"index": 0
},
{
"node": "Merge",
"type": "main",
"index": 0
}
],
[
{
"node": "meeting_request branch",
"type": "main",
"index": 0
}
],
[
{
"node": "meeting_request branch",
"type": "main",
"index": 0
}
],
[
{
"node": "meeting_request branch",
"type": "main",
"index": 0
}
],
[
{
"node": "meeting_request branch",
"type": "main",
"index": 0
}
]
]
},
"Append row in sheet": {
"main": [
[]
]
},
"meeting_request branch": {
"main": [
[
{
"node": "Append row in sheet",
"type": "main",
"index": 0
}
]
]
},
"Merge": {
"main": [
[
{
"node": "1",
"type": "main",
"index": 0
}
]
]
},
"Get last emails": {
"ai_tool": [
[
{
"node": "EMail Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Get calendar events": {
"ai_tool": [
[
{
"node": "EMail Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Delete an email": {
"ai_tool": [
[
{
"node": "EMail Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Create an Email Draft as response to a thread": {
"ai_tool": [
[
{
"node": "EMail Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Create an New Email Draft": {
"ai_tool": [
[
{
"node": "EMail Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Add an calender entry": {
"ai_tool": [
[
{
"node": "EMail Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Get an email by MessageID": {
"ai_tool": [
[
{
"node": "EMail Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Research context and infos in previous conversations": {
"ai_tool": [
[
{
"node": "EMail Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Threads History Vector Store": {
"ai_vectorStore": [
[
{
"node": "Research context and infos in previous conversations",
"type": "ai_vectorStore",
"index": 0
}
]
]
},
"Determine the name of the day of the week": {
"ai_tool": [
[
{
"node": "EMail Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Telegram Trigger": {
"main": [
[
{
"node": "EMail Agent",
"type": "main",
"index": 0
}
]
]
},
"EMail Agent": {
"main": [
[
{
"node": "Send a text message",
"type": "main",
"index": 0
}
]
]
},
"Simple Memory": {
"ai_memory": [
[
{
"node": "EMail Agent",
"type": "ai_memory",
"index": 0
}
]
]
},
"Google Gemini Chat Model": {
"ai_languageModel": [
[
{
"node": "EMail Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Embeddings Google Gemini": {
"ai_embedding": [
[
{
"node": "Threads History Vector Store",
"type": "ai_embedding",
"index": 0
}
]
]
},
"Google Gemini Chat Model1": {
"ai_languageModel": [
[
{
"node": "Research context and infos in previous conversations",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Google Gemini Chat Model2": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1",
"binaryMode": "separate",
"availableInMCP": false
},
"meta": {
"templateCredsSetupCompleted": false
},
"tags": []
}
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Gmail Telegram AI Automation. Uses gmailTrigger, agent, googleSheets, googleCalendar. Event-driven trigger; 35 nodes.
Source: https://github.com/Acnologia7021/gmail-telegram-ai-automation/blob/main/workflows/gmail-telegram-ai-automation.json — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
A lightweight, self-hosted AI assistant built entirely in n8n. Multi-channel messaging (Telegram, WhatsApp, Gmail), persistent memory, task management, and autonomous work — all in a single visual wor
This workflow implements an advanced AI automation agent (OpenClaw Agent) that interacts with users through Telegram and integrates multiple AI models, external tools, and cloud services to automate c
Alfred (funcional). Uses gmailTool, googleCalendarTool, gmail, embeddingsOpenAi. Event-driven trigger; 83 nodes.
This comprehensive workflow bundle is designed as a powerful starter kit, enabling you to build a multi-functional AI assistant on Telegram. It seamlessly integrates AI-powered voice interactions, an
Agent IA Projet Client. Uses executeWorkflowTrigger, lmChatOpenAi, toolWorkflow, vectorStoreQdrant. Event-driven trigger; 79 nodes.