This workflow corresponds to n8n.io template #11451 — we link there as the canonical source.
This workflow follows the Chainllm → Telegram 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 →
{
"meta": {
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "0cd3a6d7-6e8e-43d6-975d-18549c8e6e9d",
"name": "Get PDF Data",
"type": "n8n-nodes-base.set",
"position": [
352,
-176
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "cab388e8-37e9-4a98-b663-680bb6f4b8b2",
"name": "text",
"type": "string",
"value": "={{ $json.text }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "282fc6aa-c906-4191-a8dd-59357ee2a6e3",
"name": "Extract PDF Data",
"type": "n8n-nodes-base.extractFromFile",
"position": [
160,
-176
],
"parameters": {
"options": {},
"operation": "pdf"
},
"typeVersion": 1
},
{
"id": "ac1f29c1-98b2-4170-ae50-1e6738b41931",
"name": "Data Parser & Cleaner",
"type": "n8n-nodes-base.code",
"position": [
544,
-176
],
"parameters": {
"jsCode": "/**\n * This function removes all newline characters (\"\\n\") from a given string.\n * In the context of your n8n workflow, you can use this in a \"Code\" node\n * to clean up the PDF text content before passing it to the AI Agent.\n *\n * @param {string} text The input string that may contain newline characters.\n * @returns {string} The processed string with all newline characters removed.\n */\nfunction removeNewlines(text) {\n if (typeof text !== 'string') {\n // Return an empty string or handle the error as appropriate for your workflow\n console.error(\"Input must be a string.\");\n return \"\";\n }\n // The .replace() method with a regular expression /g ensures all occurrences are replaced.\n return text.replace(/\\n/g, ' ');\n}\n\n// Example usage based on the text you provided:\n// In your n8n \"Code\" node, you would get the input from the previous node.\n// For example: const a_variable_from_another_node = \"your text here\";\nconst inputText = $input.first().json.text;\nconst cleanedText = removeNewlines(inputText);\nconsole.log(\"Original Text:\");\nconsole.log(inputText);\nconsole.log(\"\\\\n------------------\\\\n\");\nconsole.log(\"Cleaned Text:\");\nconsole.log(cleanedText);\n\n// To use this in n8n, you'd typically return the result like this:\nreturn { cleanedText: cleanedText };\n"
},
"typeVersion": 2
},
{
"id": "c10225ce-b103-481a-b775-0c88c2a44d34",
"name": "Is PDF File",
"type": "n8n-nodes-base.if",
"position": [
-112,
-272
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "776994e7-59b0-49d3-8d86-4bb342574a41",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ $('Telegram Trigger').item.json.message.document.mime_type === 'application/pdf'}}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "cc27f96f-2167-4c01-be32-a2dbf4abc764",
"name": "No Operation, do nothing",
"type": "n8n-nodes-base.noOp",
"position": [
-112,
-48
],
"parameters": {},
"typeVersion": 1
},
{
"id": "224456cf-cb49-4870-aa50-792d874dd9ce",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-352,
-352
],
"parameters": {
"width": 432,
"height": 464,
"content": "## Receive and Filter"
},
"typeVersion": 1
},
{
"id": "8ff09bd8-8e1f-4bca-b3a9-178ba9aab036",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
112,
-288
],
"parameters": {
"width": 592,
"height": 288,
"content": "## Extract and Clean\nConverts binary PDF data into clean, plain text."
},
"typeVersion": 1
},
{
"id": "04b4da9f-1c3e-40db-b762-fabe7ee1563c",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
736,
-320
],
"parameters": {
"width": 304,
"height": 400,
"content": "## Summarizing\nGenerates a structured summary using AI"
},
"typeVersion": 1
},
{
"id": "62d113e0-d279-4c28-a91f-8707d6ec99ef",
"name": "Basic LLM Chain",
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"position": [
784,
-224
],
"parameters": {
"text": "={{$json.cleanedText}}",
"batching": {},
"messages": {
"messageValues": [
{
"message": "### ROLE & PERSONA You are an Expert Research Analyst and Senior Technical Communicator. Your goal is to synthesize complex documents into high-value, actionable insights. You possess deep knowledge across business, technology, and academic domains. Your tone is professional, objective, and concise.\n\n### TASK You will receive the text content of a PDF file. Your objective is to analyze the content and generate a structured summary optimized for a Telegram messaging interface.\n\n### ANALYSIS RULES\n1. **Identify the Core Value:** Determine the primary argument, result, or purpose of the document immediately.\n2. **Filter Noise:** Ignore introductory fluff, legal disclaimers, or generic pleasantries. Focus on facts, data, and conclusions.\n3. **Think Step-by-Step:** Before generating the output, internalize the logical flow of the document to ensure the summary follows a coherent narrative.\n4. **Accuracy:** Strictly adhere to the provided text. Do not hallucinate or invent outside information.\n\n### OUTPUT FORMAT (TELEGRAM OPTIMIZED) You must output the summary using the following Markdown structure exactly. Do not use Markdown features that Telegram does not support (like tables).\n**Title:** [Insert Document Title/Subject]\n**Type:** [e.g., Financial Report, Academic Paper, Legal Contract]\n\n**Exec Summary** [A 1-2 sentence high-level overview of what this document is and why it matters.]\n\n**Key Insights**\n\u2022 [Insight 1: Strong fact or data point]\n\u2022 [Insight 2: Critical finding or argument]\n\u2022 [Insight 3: Critical finding or argument] \n\n**Actionable Takeaways**\n\u2022 [What should the reader do with this info?]\n\u2022 [Implication or next step]\n\n**Rating:** [1-10 Relevance Score based on content density]"
}
]
},
"promptType": "define"
},
"typeVersion": 1.7
},
{
"id": "9d5f909e-7f1c-4884-a21f-c581eee92c36",
"name": "Telegram Trigger",
"type": "n8n-nodes-base.telegramTrigger",
"position": [
-288,
-272
],
"parameters": {
"updates": [
"message"
],
"additionalFields": {
"download": true
}
},
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "db7fc6d0-da27-44ff-93b4-6675191cadd3",
"name": "Groq Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatGroq",
"position": [
848,
-64
],
"parameters": {
"model": "openai/gpt-oss-20b",
"options": {}
},
"credentials": {
"groqApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "c56853a9-ae32-4242-be49-5fe97d66c0e7",
"name": "Send a text message",
"type": "n8n-nodes-base.telegram",
"position": [
1152,
-160
],
"parameters": {
"text": "={{ $json.text }}",
"chatId": "={{ $('Is PDF File').item.json.message.chat.id }}",
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "bb869178-6ea3-481e-b14b-3716abb12e9f",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
1072,
-256
],
"parameters": {
"width": 256,
"height": 272,
"content": "## Response\nSends the insight back to the user."
},
"typeVersion": 1
},
{
"id": "9f6fb78d-7d8b-4cc4-8432-ffb74c49b616",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-400,
-432
],
"parameters": {
"color": 7,
"width": 1776,
"height": 976,
"content": "## AI-Powered Document Summarization With Telegram \u232f\u2332"
},
"typeVersion": 1
},
{
"id": "68d198ca-58bb-43a6-b2bd-47891785a00c",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"position": [
-352,
176
],
"parameters": {
"color": 5,
"width": 832,
"height": 336,
"content": "## How it works\nThis workflow turns your Telegram bot into a personal document analyst. When you upload a PDF file to the chat, n8n automatically intercepts the document and extracts and cleans the raw text to ensure high-quality results. This data is then passed to a Large Language Model (LLM). The LLM acts as an expert analyst, reviewing the content and generating a structured summary with key insights and actionable takeaways. Finally, the summary is formatted and sent back to you in the Telegram chat.\n\n## Setup steps\n- Telegram: create a new bot using @BotFather on Telegram. Copy the HTTP API Token and add it to the credentials in the Telegram Trigger and Telegram nodes.\n- Groq AI: Get a free API key from the Groq Cloud console. Add this key to the credentials in the Groq Chat Model node.\n- Activate: Save the workflow and toggle the \"Active\" switch to on.\n- Test: Open your bot in Telegram and upload a PDF file to receive your summary."
},
"typeVersion": 1
},
{
"id": "4a38d3e9-02fe-45b6-b801-b273991f2833",
"name": "Sticky Note6",
"type": "n8n-nodes-base.stickyNote",
"position": [
544,
176
],
"parameters": {
"width": 784,
"height": 336,
"content": "## Quick Demo\n- Open your bot on Telegram.\n- Drag and drop a financial report or academic paper (PDF) into the chat.\n- Wait 5-10 seconds.\n- Receive a formatted \"Executive Summary\" with bulleted insights.\n\n## Perfect For\n- Summarizing long contracts or legal docs.\n- Quickly reviewing academic papers on the go.\n- Extracting action items from meeting minutes or reports."
},
"typeVersion": 1
}
],
"connections": {
"Is PDF File": {
"main": [
[
{
"node": "Extract PDF Data",
"type": "main",
"index": 0
}
],
[
{
"node": "No Operation, do nothing",
"type": "main",
"index": 0
}
]
]
},
"Get PDF Data": {
"main": [
[
{
"node": "Data Parser & Cleaner",
"type": "main",
"index": 0
}
]
]
},
"Basic LLM Chain": {
"main": [
[
{
"node": "Send a text message",
"type": "main",
"index": 0
}
]
]
},
"Groq Chat Model": {
"ai_languageModel": [
[
{
"node": "Basic LLM Chain",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Extract PDF Data": {
"main": [
[
{
"node": "Get PDF Data",
"type": "main",
"index": 0
}
]
]
},
"Telegram Trigger": {
"main": [
[
{
"node": "Is PDF File",
"type": "main",
"index": 0
}
]
]
},
"Data Parser & Cleaner": {
"main": [
[
{
"node": "Basic LLM Chain",
"type": "main",
"index": 0
}
]
]
}
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
groqApitelegramApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
9 nodes: Lightweight, efficient (no loops). Key Steps: Triggers on Telegram messages - downloads files. Sub-workflow splits text/files. (Optional but recommended) IF node checks MIME type/extension for PDFs. Extracts text via "Extract From File" node. AI writes summary. Responds…
Source: https://n8n.io/workflows/11451/ — 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.
Text Fixer. Uses telegramTrigger, chainLlm, lmChatGroq, telegram. Event-driven trigger; 4 nodes.
This comprehensive N8N automation template revolutionizes content creation by delivering a complete end-to-end solution for AI-powered blog generation. Transform simple ideas into fully SEO-optimized,
Telegram Code. Uses lmChatOpenAi, outputParserAutofixing, outputParserStructured, telegramTrigger. Event-driven trigger; 43 nodes.
Telegram Code. Uses lmChatOpenAi, outputParserAutofixing, outputParserStructured, telegramTrigger. Event-driven trigger; 43 nodes.
Transcript. Uses httpRequest, telegram, telegramTrigger, readWriteFile. Event-driven trigger; 37 nodes.