This workflow corresponds to n8n.io template #7002 — we link there as the canonical source.
This workflow follows the Googlegemini → HTTP Request 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 →
{
"id": "aYqynTzFxEsi2N2G",
"meta": {
"templateCredsSetupCompleted": true
},
"name": "Daily Digest Generator for Telegram Groups with Gemini 2.5 Flash'",
"tags": [],
"nodes": [
{
"id": "c030f858-da5d-42da-bd36-565ecfb53564",
"name": "Filter & Format Messages",
"type": "n8n-nodes-base.code",
"position": [
960,
352
],
"parameters": {
"jsCode": "// Get the raw data from the HTTP Request\nconst data = $input.item.json;\n\n// Get the timestamp for 24 hours ago\nconst twentyFourHoursAgo = Date.now() - (24 * 60 * 60 * 1000);\n\n// Filter messages to only include those from the last 24 hours\n// and format them into a clean transcript.\nconst transcript = data.result\n .filter(update => {\n // Ensure the message exists and has a date\n if (!update.message || !update.message.date) {\n return false;\n }\n // Telegram's date is in seconds, convert to milliseconds\n const messageDate = update.message.date * 1000;\n return messageDate > twentyFourHoursAgo && update.message.text;\n })\n .map(update => {\n const user = update.message.from.first_name || 'Unknown User';\n const text = update.message.text;\n return `${user}: ${text}`;\n })\n .join('\\n');\n\n// Return the final transcript. If it's empty, return a message.\nif (transcript.length === 0) {\n return [{ json: { transcript: \"No new messages in the last 24 hours.\" } }];\n}\n\nreturn [{ json: { transcript: transcript } }];\n"
},
"typeVersion": 2
},
{
"id": "53d75f00-fd71-4dba-b3e0-311e79e2380c",
"name": "Generate Summary with Gemini",
"type": "@n8n/n8n-nodes-langchain.googleGemini",
"position": [
1152,
576
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "models/gemini-1.5-flash-latest",
"cachedResultName": "models/gemini-1.5-flash-latest"
},
"options": {},
"messages": {
"values": [
{
"content": "=Analyze the following Telegram chat transcript. If the transcript says there were no new messages, just write \"No digest to generate today.\" Otherwise, create a \"Daily Digest\" with the following sections in well-formatted markdown:\n\n### \ud83c\udf1f Top Conversation Topics\n- *Provide a bulleted list of the main topics.*\n\n### \ud83d\udd17 Key Links Shared\n- *List any important links that were shared. If none, write \"No links were shared.\"*\n\n### \u2753 Unanswered Questions\n- *List any questions that were asked but not answered. If none, write \"All questions seem to be answered.\"*\n\n### \ud83d\ude0a Overall Sentiment\n- *A one or two-word summary of the chat's mood.*\n\nHere is the transcript:\n{{ $('Filter & Format Messages').item.json.transcript }}"
}
]
}
},
"typeVersion": 1
},
{
"id": "6750fc24-176c-43f6-a2ea-4c941035e1cd",
"name": "Post Digest to Telegram",
"type": "n8n-nodes-base.telegram",
"position": [
1808,
544
],
"parameters": {
"text": "={{ $json.text }}",
"chatId": "<YOUR_GROUP_CHAT_ID_HERE>",
"additionalFields": {
"parse_mode": "MarkdownV2"
}
},
"typeVersion": 1.2
},
{
"id": "c8e8cc23-6199-4574-b4a9-37db99330d15",
"name": "Sanitize AI Output",
"type": "n8n-nodes-base.code",
"position": [
1568,
592
],
"parameters": {
"jsCode": "const escapeMarkdownV2 = (text) => {\n return text\n .replace(/_/g, '\\\\_')\n .replace(/\\*/g, '\\\\*')\n .replace(/\\[/g, '\\\\[')\n .replace(/\\]/g, '\\\\]')\n .replace(/\\(/g, '\\\\(')\n .replace(/\\)/g, '\\\\)')\n .replace(/~/g, '\\\\~')\n .replace(/`/g, '\\\\`')\n .replace(/>/g, '\\\\>')\n .replace(/#/g, '\\\\#')\n .replace(/\\+/g, '\\\\+')\n .replace(/-/g, '\\\\-')\n .replace(/=/g, '\\\\=')\n .replace(/\\|/g, '\\\\|')\n .replace(/{/g, '\\\\{')\n .replace(/}/g, '\\\\}')\n .replace(/\\./g, '\\\\.')\n .replace(/!/g, '\\\\!');\n};\nreturn {\n json: {\n text: escapeMarkdownV2($('Generate Summary with Gemini').first().json.content.parts[0].text)\n }\n}\n"
},
"typeVersion": 2
},
{
"id": "b90e08e8-002e-4d88-b162-bd37baea7754",
"name": "Get Telegram Updates",
"type": "n8n-nodes-base.httpRequest",
"position": [
736,
544
],
"parameters": {
"url": "https://api.telegram.org/bot<YOUR_TELEGRAM_TOKEN_HERE>/getUpdates",
"options": {
"timeout": 3000
}
},
"typeVersion": 4.2
},
{
"id": "c22e5b35-28a7-4c23-a685-4026b619e548",
"name": "Run Daily",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
480,
400
],
"parameters": {
"rule": {
"interval": [
{}
]
}
},
"typeVersion": 1.2
},
{
"id": "65f917d8-4a4a-4a68-8f5b-f7289a22fd18",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
672,
704
],
"parameters": {
"height": 144,
"content": "This node fetches all new messages for the bot. The URL must contain the secret bot token. REMINDER: Bot privacy mode must be turned OFF in BotFather for this to work."
},
"typeVersion": 1
},
{
"id": "1d4348b0-a596-4a8c-8c3c-0d5cac0457ad",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
896,
192
],
"parameters": {
"color": 5,
"content": "This code takes the raw data from Telegram and does two things: 1. Filters out everything except text messages from groups. 2. Formats the messages into a clean User: message list for the AI"
},
"typeVersion": 1
},
{
"id": "af2bd58b-61d8-49fc-9354-e44632e587c5",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
1168,
416
],
"parameters": {
"color": 4,
"height": 368,
"content": "This is the AI brain. It sends the chat transcript to Google's Gemini model and asks it to create a summary with specific sections like 'Top Topics' and 'Unanswered Questions'."
},
"typeVersion": 1
},
{
"id": "acbd1771-1521-4c1f-bad6-c7e73c72ef69",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
1504,
720
],
"parameters": {
"color": 3,
"height": 256,
"content": "\"CRITICAL: This node cleans the AI's summary before sending it to Telegram. It escapes special characters like _ or * to prevent the final message from failing due to formatting errors.\""
},
"typeVersion": 1
},
{
"id": "d5ee8e3c-347c-4d2c-beab-a3ceb3984cb3",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
1760,
352
],
"parameters": {
"content": "Sends the final, cleaned-up summary. The 'Chat ID' is set dynamically from the previous nodes, so it always sends the summary to the correct group"
},
"typeVersion": 1
},
{
"id": "93290b2d-0547-4831-8cd7-7a534e2f344f",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"position": [
416,
240
],
"parameters": {
"color": 7,
"content": "Runs once every 24 hours. Adjust schedule to match desired summary frequency (e.g., daily, weekly)."
},
"typeVersion": 1
},
{
"id": "2578206c-2003-43dc-9851-1504ddac06ee",
"name": "Sticky Note6",
"type": "n8n-nodes-base.stickyNote",
"position": [
-96,
16
],
"parameters": {
"color": 2,
"width": 368,
"height": 1232,
"content": "This workflow acts as an AI assistant for your Telegram groups, automatically creating a \"Daily Digest\" of all conversations so you can catch up without scrolling through hundreds of messages.\n\nIt's perfect for community managers, project teams, or groups of friends who want to stay updated without the noise.\n\nHow it works\nThis workflow runs on a simple, high-level process:\n\nFetches Messages: Once every 24 hours, it automatically fetches all new messages from any group your bot is a member of.\n\nGenerates AI Summary: It sends the chat transcript to Google's Gemini 1.5 Flash AI, which intelligently creates a structured summary including key topics, shared links, and unanswered questions.\n\nPosts the Digest: The clean, formatted summary is posted back into the correct Telegram group for everyone to see.\n\nFor more detailed explanations of each specific node, please refer to the sticky notes included on the workflow canvas.\n\nSet up steps\nSetup should take about 5-10 minutes.\n\nPrerequisites\nTelegram Bot Token: You can get this by talking to the @BotFather on Telegram.\n\nGoogle Gemini API Key: You can get a free API key from the Google AI Studio.\n\nConfiguration\nAdd Credentials & Token\n\nIn the Get Telegram Updates node, paste your Telegram bot token into the URL.\n\nIn the Generate Summary with Gemini and Post Digest to Telegram nodes, select your Google Gemini and Telegram credentials from the dropdown menus.\n\nConfigure Your Telegram Bot\n\nUsing @BotFather in Telegram, make sure Group Privacy Mode is turned OFF for your bot. This is required for the bot to read messages.\n\nAdd your bot as a member to any group you want it to summarize.\n\nActivate the Workflow\n\nIn the n8n editor, click the \"Inactive\" toggle at the top of the screen to set the workflow to Active."
},
"typeVersion": 1
}
],
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "5f4eb6b6-5da5-4836-a711-d05dc028e312",
"connections": {
"Run Daily": {
"main": [
[
{
"node": "Get Telegram Updates",
"type": "main",
"index": 0
}
]
]
},
"Sanitize AI Output": {
"main": [
[
{
"node": "Post Digest to Telegram",
"type": "main",
"index": 0
}
]
]
},
"Get Telegram Updates": {
"main": [
[
{
"node": "Filter & Format Messages",
"type": "main",
"index": 0
}
]
]
},
"Filter & Format Messages": {
"main": [
[
{
"node": "Generate Summary with Gemini",
"type": "main",
"index": 0
}
]
]
},
"Generate Summary with Gemini": {
"main": [
[
{
"node": "Sanitize AI Output",
"type": "main",
"index": 0
}
]
]
}
}
}
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This workflow acts as an AI assistant for your Telegram groups, automatically creating a "Daily Digest" of all conversations so you can catch up without scrolling through hundreds of messages.
Source: https://n8n.io/workflows/7002/ — 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.
AI Institutional Stock Valuation Engine with Risk Scoring & Scenario Targets
Overview This is a production-grade, fully automated stock analysis system built entirely in n8n. It combines institutional-level financial analysis, dual AI model consensus, and a self-improving back
A professional AI equity analysis automation built on n8n that transforms structured financial data and real-time news into disciplined, risk-adjusted price targets and actionable BUY/HOLD/SELL signal
This workflow creates a daily “n8n News Radar” briefing: Pulls the latest n8n ecosystem updates from Blog, Community, GitHub Releases, and Reddit. Filters to the last 24 hours + keyword relevance. Use
Start your day with a personalized news podcast delivered directly to your Telegram. This workflow helps you stay informed without scrolling through endless feeds. It automatically collects news from