Asistente de búsqueda de Gmail AI en Telegram (impulsado por Gemini)
Este es unOther, AIflujo de automatización del dominio deautomatización que contiene 19 nodos.Utiliza principalmente nodos como Set, Gmail, Telegram, Agent, TelegramTrigger, combinando tecnología de inteligencia artificial para lograr automatización inteligente. Asistente de búsqueda de Gmail en Telegram (impulsado por Gemini)
- •Cuenta de Google y credenciales de API de Gmail
- •Bot Token de Telegram
- •Clave de API de Google Gemini
Nodos utilizados (19)
Categoría
{
"meta": {
"instanceId": "d04643ba872bb0fb252ed2c8197858d58cc47dd3c15ff6d08b19addd679e927b",
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "78a9a2ba-dfbd-4b29-abb0-0d8e50fca199",
"name": "Cadena Básica de LLM",
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"maxTries": 2,
"position": [
60,
260
],
"parameters": {
"text": "=Convert this email search request into a valid Gmail search query. Output ONLY JSON with:\n1. \"search\": The complete Gmail query using operators (from:, subject:, after:, etc.)\n2. \"metadata\": Extracted components for reference\n\nRules:\n- Use exact Gmail search syntax\n- Convert dates to YYYY/MM/DD or newer_than/older_than\n- Group related terms with (parentheses)\n- Prioritize exact matches with \"quotes\"\n- Include multiple variations of keywords (e.g., invoice/invoices)\n\nExample Output:\n```json\n{\n \"search\": \"from:amazon AND (invoice OR invoices) AND after:2024/06/01\",\n \"metadata\": {\n \"senders\": [\"amazon\"],\n \"keywords\": [\"invoice\", \"invoices\"],\n \"timeFilters\": {\"after\": \"2024/06/01\"}\n }\n}\n\nUser Input: {{ $('User Request - Telegram Trigger').item.json.message.text }}",
"promptType": "define",
"hasOutputParser": true
},
"executeOnce": false,
"retryOnFail": true,
"typeVersion": 1.6,
"alwaysOutputData": false
},
{
"id": "967d4a5f-f911-4c1d-b9ee-36f7edddac96",
"name": "Google Gemini Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
160,
600
],
"parameters": {
"options": {},
"modelName": "models/gemini-2.0-flash"
},
"credentials": {
"googlePalmApi": {
"id": "LnJ23V279k2RRO8R",
"name": "Google Gemini(PaLM) Api account"
}
},
"typeVersion": 1
},
{
"id": "e5b584a1-c153-46bc-adb3-00a6e355ba99",
"name": "Google Gemini Chat Model1",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
980,
480
],
"parameters": {
"options": {},
"modelName": "models/gemini-2.0-flash"
},
"credentials": {
"googlePalmApi": {
"id": "LnJ23V279k2RRO8R",
"name": "Google Gemini(PaLM) Api account"
}
},
"typeVersion": 1
},
{
"id": "7cd5d1d5-a75f-43d6-9e68-2212396394df",
"name": "Cadena Básica de LLM1",
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"position": [
1020,
260
],
"parameters": {
"text": "=Convert this email data into a well-formatted Telegram message with these sections:\n1. 📅 Date (DD/MM/YYYY format)\n2. 👤 Sender (extract name & email)\n3. 📌 Subject\n4. ✂️ Preview (full snippet)\n\nRules:\n- Use emojis for visual separation\n- Keep entire message under 400 characters\n- Format dates as \"09/06/2025\"\n- Extract names from \"From\" field (remove quotes/email)\n- Full snippets that conveys the full summarised email (max 4 lines)\n\nExample Output:\n📅Date: 09/06/2025 \n👤Sender: elad malka (example@gmail.com)\n📌Subject Line: Share request for \"Acuity to Sheets\" \n✂️Snippet: Requesting access to spreadsheet: Acuity to Sheets \n\nEmail Data: \ndate: {{ $json.Date }}\nfrom: {{ $json.From }}\nsubject: {{ $json.Subject }}\nsender: {{ $json.snippet }}",
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 1.6
},
{
"id": "30113c5d-07b9-4015-ab26-9a69fc874038",
"name": "Agente de IA",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
-500,
260
],
"parameters": {
"text": "=Analyze the user's request (User request:{{ $json.message.text }} ) about fetching Gmail emails and output a JSON with:\n1. `sender` (name or email, if specified).\n2. `keywords` (list of words/phrases to search for).\n3. `afterDate` (ISO format: YYYY-MM-DD, ONLY if user specifies \"after [date]\" or \"since [date]\").\n4. `beforeDate` (ISO format: YYYY-MM-DD, ONLY if user specifies \"before [date]\" or \"until [date]\").\n\nRules:\n- Convert relative dates (e.g., \"since Monday\") to ISO format using TODAY as reference.\n- For ambiguous dates (e.g., \"last week\"), use the afterDate (calculated from present date to last 7 days).\n- Strictly return ONLY valid JSON.\n\nExamples:\n\nUser Input: \"Get emails from Amazon after 2024-06-10 about returns\"\nOutput:\n```json\n{\n \"sender\": \"Amazon\",\n \"keywords\": [\"returns\"],\n \"afterDate\": \"2024-06-10\"\n} ",
"options": {},
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 1.9
},
{
"id": "ed601ecc-c4c0-4de1-9e3a-cb398ffe35c8",
"name": "Google Gemini Chat Model2",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
-460,
600
],
"parameters": {
"options": {},
"modelName": "models/gemini-2.0-flash"
},
"credentials": {
"googlePalmApi": {
"id": "LnJ23V279k2RRO8R",
"name": "Google Gemini(PaLM) Api account"
}
},
"typeVersion": 1
},
{
"id": "5c577624-52e0-4a17-8604-80e2cd4b77de",
"name": "Analizador de Salida Estructurada",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
-200,
600
],
"parameters": {
"jsonSchemaExample": "{\n \"sender\": \"Amazon\",\n \"keywords\": [\"returns\"],\n \"afterDate\": \"2024-06-10\",\n \"beforeDate\": \"2024-06-30\"\n} "
},
"typeVersion": 1.2
},
{
"id": "371362b5-44c3-490a-bea9-a5e1d0246fd9",
"name": "Analizador de Salida Estructurada1",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
420,
600
],
"parameters": {
"jsonSchemaExample": "{\n \"search\": \"from:amazon AND (invoice OR invoices) AND after:2024/06/01\",\n \"metadata\": {\n \"senders\": [\"amazon\"],\n \"keywords\": [\"invoice\", \"invoices\"],\n \"timeFilters\": {\"after\": \"2024/06/01\"}\n }\n}"
},
"typeVersion": 1.2
},
{
"id": "2e2dc24c-f458-4339-86bf-6501e84c4ea3",
"name": "Analizador de Salida Estructurada2",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
1220,
500
],
"parameters": {
"jsonSchemaExample": "{\n\t\"text\": \"📅Date: 09/06/2025\\n👤Sender: elad malka (drive-shares-dm-noreply@google.com)\\n📌Subject: Share request for \"\n}"
},
"typeVersion": 1.2
},
{
"id": "c2aa8043-0df7-48fe-87eb-f6bcdc09a6f9",
"name": "Nota Adhesiva",
"type": "n8n-nodes-base.stickyNote",
"position": [
-960,
-20
],
"parameters": {
"width": 360,
"height": 480,
"content": "## 1. Telegram Bot (API)\n1. Create a bot using Bot_Father on telegram by sending a message to @BotFather.\n\n2. Send a command /newbot in the message.\n\n3. Choose username and then copy the api.\n\n4. Create Telegram credential here in n8n. By inputting the api token in access token and base url (https://api.telegram.org).\n\n5. Hit Save.\n"
},
"typeVersion": 1
},
{
"id": "eb75fe77-953b-4c81-8d42-79b70171b947",
"name": "Nota Adhesiva1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-580,
500
],
"parameters": {
"width": 340,
"height": 260,
"content": "Replace the API with your own API of Gemini or choose an OpenAi node if you want to use openai model. (depends on your choice)."
},
"typeVersion": 1
},
{
"id": "faca346a-8a08-49d2-902d-a29cfb366228",
"name": "Nota Adhesiva2",
"type": "n8n-nodes-base.stickyNote",
"position": [
40,
500
],
"parameters": {
"width": 340,
"height": 260,
"content": "Replace the API with your own API of Gemini or choose an OpenAi node if you want to use openai model. (depends on your choice)."
},
"typeVersion": 1
},
{
"id": "4067630a-3888-42f9-ad7e-e01f87d6430e",
"name": "Nota Adhesiva3",
"type": "n8n-nodes-base.stickyNote",
"position": [
440,
-80
],
"parameters": {
"width": 320,
"height": 520,
"content": "## 2. Connecting Your Gmail Account.\n\n1. Connect your Gmail account – Choose the account you want to retrieve emails from.\n\n2. Set the email limit – Enter the number of emails you want to fetch, or check \"Return all\" to retrieve every email matching your request.\n\n3. Select read status – Choose whether to fetch unread or read emails."
},
"typeVersion": 1
},
{
"id": "be41decd-60dc-4055-acc7-9ffc8201c7a3",
"name": "Nota Adhesiva4",
"type": "n8n-nodes-base.stickyNote",
"position": [
1400,
20
],
"parameters": {
"width": 340,
"height": 420,
"content": "## 3. Chat ID.\n\n1. Get the Chat ID – Copy the output from the first Telegram trigger node, then pass it to an AI model to extract the Chat ID.\n\n2. Use the Chat ID – Once identified, simply drag and drop the Chat ID value into the field.\n\n"
},
"typeVersion": 1
},
{
"id": "d3371952-c3aa-4cd9-ab08-594b4760ad48",
"name": "Solicitud de Usuario - Activador Telegram",
"type": "n8n-nodes-base.telegramTrigger",
"position": [
-800,
260
],
"webhookId": "6eae6ee1-b07e-4b7b-af8f-a79a6755fd93",
"parameters": {
"updates": [
"message"
],
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "m3VuvOq8aZdBV0My",
"name": "Telegram account (AigmailAssitant)"
}
},
"typeVersion": 1.2
},
{
"id": "683f78bd-1ac4-4b51-90ed-17f0675bc1cb",
"name": "Establecer Parámetros desde la Solicitud del Usuario (para obtener correos)",
"type": "n8n-nodes-base.set",
"position": [
-140,
260
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "93d9bf21-89b5-4544-80db-ed0cc875cb5c",
"name": "Sender",
"type": "string",
"value": "={{ $json.output.sender }}"
},
{
"id": "933fae65-1251-4995-be9a-03691e30d1c7",
"name": "Keywords/Prompt/Criteria",
"type": "string",
"value": "={{ $json.output.keywords }}"
},
{
"id": "bf4c646a-5b8e-49a3-a1a2-68836c731404",
"name": "afterDate",
"type": "string",
"value": "={{ $json.output.afterDate }}"
},
{
"id": "2a91fd77-77e9-4c3f-8f30-17a97fb9871d",
"name": "beforeDate",
"type": "string",
"value": "={{ $json.output.beforeDate }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "fb2cb2c8-59e9-40e6-abe0-447335e499fb",
"name": "Obtener Correo(s) Solicitado(s)",
"type": "n8n-nodes-base.gmail",
"position": [
540,
260
],
"webhookId": "ac0ae124-5b2e-473c-9716-473110d3c121",
"parameters": {
"limit": 10,
"filters": {
"q": "={{ $json.output.search }}",
"sender": "={{ $('Set Parameters From User Request (for fetching emails)').item.json.Sender }}",
"readStatus": "unread",
"receivedAfter": "={{ $('Set Parameters From User Request (for fetching emails)').item.json.afterDate }}",
"receivedBefore": "={{ $('Set Parameters From User Request (for fetching emails)').item.json.beforeDate }}"
},
"operation": "getAll"
},
"credentials": {
"gmailOAuth2": {
"id": "tuAn4zK9wTO9JZvR",
"name": "Gmail account"
}
},
"typeVersion": 2.1
},
{
"id": "4b229ce7-c941-4d6c-a999-26054468490c",
"name": "Establecer Parámetros para la Respuesta",
"type": "n8n-nodes-base.set",
"position": [
840,
260
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "7e8b9cac-da96-4568-b520-8f64bed8b35b",
"name": "Date",
"type": "string",
"value": "={{ new Date(Number($json.internalDate)).toISOString() }}"
},
{
"id": "6a422a1c-395c-4759-b642-40b33295b8d1",
"name": "From",
"type": "string",
"value": "={{ $json.From }}"
},
{
"id": "85b67fb6-f4ed-4672-becd-43aa682c5cdf",
"name": "Subject",
"type": "string",
"value": "={{ $json.Subject }}"
},
{
"id": "9b4fa0e0-da5a-4c3a-a049-ec1c2ac9c600",
"name": "snippet",
"type": "string",
"value": "={{ $json.snippet }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "e7501362-37d8-4a05-919a-72ad419ee59a",
"name": "Enviar (correos solicitados) vía Telegram",
"type": "n8n-nodes-base.telegram",
"position": [
1500,
260
],
"webhookId": "aad6a23e-6d2a-4a74-b1ec-addc668033e1",
"parameters": {
"text": "={{ $json.output.text }}",
"chatId": "={{ $('User Request - Telegram Trigger').item.json.message.chat.id }}",
"additionalFields": {
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {
"id": "m3VuvOq8aZdBV0My",
"name": "Telegram account (AigmailAssitant)"
}
},
"typeVersion": 1.2
}
],
"pinData": {
"User Request - Telegram Trigger": [
{
"message": {
"chat": {
"id": 6305257849,
"type": "private",
"username": "ToooooopGG",
"last_name": "Tate",
"first_name": "Andrew"
},
"date": 1750328451,
"from": {
"id": 6305257849,
"is_bot": false,
"username": "ToooooopGG",
"last_name": "Tate",
"first_name": "Andrew",
"language_code": "en"
},
"text": "Hey get me summary of all the emails by elevenlabs",
"message_id": 15
},
"update_id": 216173590
}
]
},
"connections": {
"30113c5d-07b9-4015-ab26-9a69fc874038": {
"main": [
[
{
"node": "683f78bd-1ac4-4b51-90ed-17f0675bc1cb",
"type": "main",
"index": 0
}
]
]
},
"78a9a2ba-dfbd-4b29-abb0-0d8e50fca199": {
"main": [
[
{
"node": "fb2cb2c8-59e9-40e6-abe0-447335e499fb",
"type": "main",
"index": 0
}
]
]
},
"7cd5d1d5-a75f-43d6-9e68-2212396394df": {
"main": [
[
{
"node": "e7501362-37d8-4a05-919a-72ad419ee59a",
"type": "main",
"index": 0
}
]
]
},
"fb2cb2c8-59e9-40e6-abe0-447335e499fb": {
"main": [
[
{
"node": "4b229ce7-c941-4d6c-a999-26054468490c",
"type": "main",
"index": 0
}
]
]
},
"967d4a5f-f911-4c1d-b9ee-36f7edddac96": {
"ai_languageModel": [
[
{
"node": "78a9a2ba-dfbd-4b29-abb0-0d8e50fca199",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"5c577624-52e0-4a17-8604-80e2cd4b77de": {
"ai_outputParser": [
[
{
"node": "30113c5d-07b9-4015-ab26-9a69fc874038",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"e5b584a1-c153-46bc-adb3-00a6e355ba99": {
"ai_languageModel": [
[
{
"node": "7cd5d1d5-a75f-43d6-9e68-2212396394df",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"ed601ecc-c4c0-4de1-9e3a-cb398ffe35c8": {
"ai_languageModel": [
[
{
"node": "30113c5d-07b9-4015-ab26-9a69fc874038",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"371362b5-44c3-490a-bea9-a5e1d0246fd9": {
"ai_outputParser": [
[
{
"node": "78a9a2ba-dfbd-4b29-abb0-0d8e50fca199",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"2e2dc24c-f458-4339-86bf-6501e84c4ea3": {
"ai_outputParser": [
[
{
"node": "7cd5d1d5-a75f-43d6-9e68-2212396394df",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"4b229ce7-c941-4d6c-a999-26054468490c": {
"main": [
[
{
"node": "7cd5d1d5-a75f-43d6-9e68-2212396394df",
"type": "main",
"index": 0
}
]
]
},
"d3371952-c3aa-4cd9-ab08-594b4760ad48": {
"main": [
[
{
"node": "30113c5d-07b9-4015-ab26-9a69fc874038",
"type": "main",
"index": 0
}
]
]
},
"683f78bd-1ac4-4b51-90ed-17f0675bc1cb": {
"main": [
[
{
"node": "78a9a2ba-dfbd-4b29-abb0-0d8e50fca199",
"type": "main",
"index": 0
}
]
]
}
}
}¿Cómo usar este flujo de trabajo?
Copie el código de configuración JSON de arriba, cree un nuevo flujo de trabajo en su instancia de n8n y seleccione "Importar desde JSON", pegue la configuración y luego modifique la configuración de credenciales según sea necesario.
¿En qué escenarios es adecuado este flujo de trabajo?
Avanzado - Otros, Inteligencia Artificial
¿Es de pago?
Este flujo de trabajo es completamente gratuito, puede importarlo y usarlo directamente. Sin embargo, tenga en cuenta que los servicios de terceros utilizados en el flujo de trabajo (como la API de OpenAI) pueden requerir un pago por su cuenta.
Flujos de trabajo relacionados recomendados
Malik Hashir
@malikxCompartir este flujo de trabajo