This workflow corresponds to n8n.io template #6497 — we link there as the canonical source.
This workflow follows the HTTP Request → 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": "8a8e1283-b1fe-483f-b172-f1c3fdabdd5b",
"name": "Send Final URL to User via Telegram",
"type": "n8n-nodes-base.telegram",
"position": [
7020,
1360
],
"parameters": {},
"typeVersion": 1.2
},
{
"id": "73e9ecf0-1742-432b-947b-ea6dc34d8a6a",
"name": "Generate Public URL for Final Image",
"type": "n8n-nodes-base.set",
"position": [
6700,
1360
],
"parameters": {},
"typeVersion": 3.4
},
{
"id": "b799251c-e1b5-4a05-a2d4-bdf3842c4078",
"name": "Upload Final Photo to S1",
"type": "n8n-nodes-base.awsS3",
"position": [
6420,
1360
],
"parameters": {},
"typeVersion": 2,
"alwaysOutputData": true
},
{
"id": "d8460dfb-4e56-4b01-97ae-77121153d492",
"name": "Download Final Photo from LightX",
"type": "n8n-nodes-base.httpRequest",
"position": [
6160,
1360
],
"parameters": {},
"typeVersion": 4.2
},
{
"id": "56c60dcc-bc47-42b6-8c00-2c928dd4f2a2",
"name": "Generate Output Filename (.jpeg) Final",
"type": "n8n-nodes-base.set",
"position": [
5880,
1360
],
"parameters": {},
"typeVersion": 3.4,
"alwaysOutputData": true
},
{
"id": "b414d721-a525-4c2b-b477-acae8829cc70",
"name": "Check If Expansion Is Complete",
"type": "n8n-nodes-base.if",
"position": [
5580,
1380
],
"parameters": {},
"typeVersion": 2.2
},
{
"id": "8a9c6a71-c853-4fca-a739-0879334e6eb6",
"name": "Check LightX Expansion Status",
"type": "n8n-nodes-base.httpRequest",
"position": [
5300,
1380
],
"parameters": {},
"typeVersion": 4.2
},
{
"id": "b74d9156-9d1e-4cf5-ac2b-ea4e393493ac",
"name": "Wait Before Checking Status Again",
"type": "n8n-nodes-base.wait",
"position": [
5040,
1380
],
"parameters": {},
"typeVersion": 1.1
},
{
"id": "1044f07f-d67f-4e7a-9388-c18cbd531fd7",
"name": "Iterate Until Expansion is Ready",
"type": "n8n-nodes-base.splitInBatches",
"position": [
4720,
1360
],
"parameters": {},
"typeVersion": 3
},
{
"id": "c6135ac6-81bf-4766-b41f-e51cb9a3dbd9",
"name": "Request AI Expansion from LightX",
"type": "n8n-nodes-base.httpRequest",
"position": [
4440,
1360
],
"parameters": {},
"typeVersion": 4.2
},
{
"id": "ab1e6bc5-6e39-460b-9e47-426dfaf1cacd",
"name": "Upload File to LightX via PUT",
"type": "n8n-nodes-base.httpRequest",
"position": [
4140,
1360
],
"parameters": {},
"typeVersion": 4.2,
"alwaysOutputData": true
},
{
"id": "2de2fb28-540d-49f2-932e-dc15b7eea761",
"name": "Merge Data for Upload",
"type": "n8n-nodes-base.merge",
"position": [
3900,
1360
],
"parameters": {},
"executeOnce": true,
"typeVersion": 3.2
},
{
"id": "6766cd63-f5b7-40b3-9b3c-20536bb52860",
"name": "Extract Upload Link from LightX Response",
"type": "n8n-nodes-base.set",
"position": [
3600,
1620
],
"parameters": {},
"typeVersion": 3.4
},
{
"id": "29edec28-e19f-49fd-ab0c-15b640f37dd8",
"name": "Request Upload Link from LightX",
"type": "n8n-nodes-base.httpRequest",
"position": [
3360,
1620
],
"parameters": {},
"typeVersion": 4.2
},
{
"id": "c2f43734-60bd-4bee-8fb0-1278dba1180d",
"name": "Get File Size (in Bytes)",
"type": "n8n-nodes-base.code",
"position": [
3000,
1620
],
"parameters": {},
"typeVersion": 2
},
{
"id": "c03a9108-b536-4880-8f5e-fea7ef043c67",
"name": "Calculate Padding for 3:2 Ratio",
"type": "n8n-nodes-base.code",
"position": [
3200,
1440
],
"parameters": {},
"executeOnce": true,
"typeVersion": 2
},
{
"id": "87dd82ab-bfdc-432f-8858-d9e6feb27d4f",
"name": "Download Upscaled Image from Replicate1",
"type": "n8n-nodes-base.httpRequest",
"position": [
2500,
1360
],
"parameters": {},
"retryOnFail": true,
"typeVersion": 4.2,
"alwaysOutputData": true,
"waitBetweenTries": 5000
},
{
"id": "20dfe756-c783-47dc-8803-27850bf957ea",
"name": "Wait After Upscale",
"type": "n8n-nodes-base.wait",
"position": [
2260,
1360
],
"parameters": {},
"typeVersion": 1.1
},
{
"id": "e0de18f5-3837-403e-b88e-87a7a1ec03e5",
"name": "AI Upscale Image via Replicate",
"type": "n8n-nodes-base.httpRequest",
"position": [
2000,
1360
],
"parameters": {},
"typeVersion": 4.2
},
{
"id": "9a3de094-e126-40c9-b7d3-0d9b28dae2d7",
"name": "Generate Output File Name (.png)",
"type": "n8n-nodes-base.set",
"position": [
1640,
1360
],
"parameters": {},
"typeVersion": 3.4
},
{
"id": "e4e3cb8e-dc22-422d-80b7-e585f7e72a74",
"name": "Set Input URL for AI Model",
"type": "n8n-nodes-base.set",
"position": [
1400,
1360
],
"parameters": {},
"typeVersion": 3.4
},
{
"id": "ac74321c-5569-49b9-9948-587827c1a4f8",
"name": "Generate Public URL for Original Image",
"type": "n8n-nodes-base.set",
"position": [
1160,
1600
],
"parameters": {},
"typeVersion": 3.4
},
{
"id": "090f94e3-d0d5-4f23-8d42-a6e55150fc7c",
"name": "Upload Original Photo to S1",
"type": "n8n-nodes-base.awsS3",
"position": [
960,
1600
],
"parameters": {},
"typeVersion": 2,
"alwaysOutputData": true
},
{
"id": "ef3d4a29-7a2f-48ee-af8e-32c79ef2ca57",
"name": "Generate Input File Name (.jpeg)",
"type": "n8n-nodes-base.set",
"position": [
760,
1600
],
"parameters": {},
"typeVersion": 3.4,
"alwaysOutputData": true
},
{
"id": "43297a9f-88b3-41d0-8d3c-810def8d6396",
"name": "Check If Photo Exists1",
"type": "n8n-nodes-base.if",
"position": [
520,
1360
],
"parameters": {},
"typeVersion": 2.2
},
{
"id": "d1ce51dd-fb1c-48be-ab61-fd757d43a65a",
"name": "Sticky Note Links1",
"type": "n8n-nodes-base.stickyNote",
"position": [
1320,
1160
],
"parameters": {
"content": ""
},
"typeVersion": 1
},
{
"id": "9ea2c1a9-cfb1-4f86-ab72-6edec5cc9aa3",
"name": "Sticky Note Result1",
"type": "n8n-nodes-base.stickyNote",
"position": [
6080,
1160
],
"parameters": {
"content": ""
},
"typeVersion": 1
},
{
"id": "af097ef7-aa9a-4bc0-9506-ca0f49852536",
"name": "Sticky Note Loop1",
"type": "n8n-nodes-base.stickyNote",
"position": [
4940,
1240
],
"parameters": {
"content": ""
},
"typeVersion": 1
},
{
"id": "3d395361-bf6c-4b9c-abc2-2d9a3380c5a7",
"name": "Sticky Note Expand Process1",
"type": "n8n-nodes-base.stickyNote",
"position": [
2980,
1260
],
"parameters": {
"content": ""
},
"typeVersion": 1
},
{
"id": "35ef0300-cd70-4cc4-aa63-ceccf71055e2",
"name": "Sticky Note Upscale1",
"type": "n8n-nodes-base.stickyNote",
"position": [
1800,
1160
],
"parameters": {
"content": ""
},
"typeVersion": 1
},
{
"id": "57fb8639-b837-42e1-a00d-7e023e62afa4",
"name": "Sticky Note Photo Upload1",
"type": "n8n-nodes-base.stickyNote",
"position": [
760,
1420
],
"parameters": {
"content": ""
},
"typeVersion": 1
},
{
"id": "3b8d5b0d-a6d6-41ae-a982-b4f13b946292",
"name": "Sticky Note If1",
"type": "n8n-nodes-base.stickyNote",
"position": [
480,
1100
],
"parameters": {
"content": ""
},
"typeVersion": 1
},
{
"id": "4c837519-3a40-4a15-a23f-0c902fb31643",
"name": "Sticky Note Trigger1",
"type": "n8n-nodes-base.stickyNote",
"position": [
100,
1160
],
"parameters": {
"content": ""
},
"typeVersion": 1
},
{
"id": "d85ba121-ed4c-4f90-a519-56f34be50ee9",
"name": "Sticky Note Main1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-440,
1040
],
"parameters": {
"content": ""
},
"typeVersion": 1
},
{
"id": "13499aea-d3a7-485f-80af-c6fb11415f01",
"name": "Telegram Trigger1",
"type": "n8n-nodes-base.telegramTrigger",
"position": [
280,
1360
],
"parameters": {},
"typeVersion": 1.2
}
],
"connections": {
"Telegram Trigger1": {
"main": [
[
{
"node": "Check If Photo Exists1",
"type": "main",
"index": 0
}
]
]
},
"Wait After Upscale": {
"main": [
[
{
"node": "Download Upscaled Image from Replicate1",
"type": "main",
"index": 0
}
]
]
},
"Merge Data for Upload": {
"main": [
[
{
"node": "Upload File to LightX via PUT",
"type": "main",
"index": 0
}
]
]
},
"Check If Photo Exists1": {
"main": [
[
{
"node": "Set Input URL for AI Model",
"type": "main",
"index": 0
}
],
[
{
"node": "Generate Input File Name (.jpeg)",
"type": "main",
"index": 0
}
]
]
},
"Get File Size (in Bytes)": {
"main": [
[
{
"node": "Request Upload Link from LightX",
"type": "main",
"index": 0
}
]
]
},
"Upload Final Photo to S1": {
"main": [
[
{
"node": "Generate Public URL for Final Image",
"type": "main",
"index": 0
}
]
]
},
"Set Input URL for AI Model": {
"main": [
[
{
"node": "Generate Output File Name (.png)",
"type": "main",
"index": 0
}
]
]
},
"Upload Original Photo to S1": {
"main": [
[
{
"node": "Generate Public URL for Original Image",
"type": "main",
"index": 0
}
]
]
},
"Check LightX Expansion Status": {
"main": [
[
{
"node": "Check If Expansion Is Complete",
"type": "main",
"index": 0
}
]
]
},
"Upload File to LightX via PUT": {
"main": [
[
{
"node": "Request AI Expansion from LightX",
"type": "main",
"index": 0
}
]
]
},
"AI Upscale Image via Replicate": {
"main": [
[
{
"node": "Wait After Upscale",
"type": "main",
"index": 0
}
]
]
},
"Check If Expansion Is Complete": {
"main": [
[
{
"node": "Generate Output Filename (.jpeg) Final",
"type": "main",
"index": 0
}
],
[
{
"node": "Iterate Until Expansion is Ready",
"type": "main",
"index": 0
}
]
]
},
"Calculate Padding for 3:2 Ratio": {
"main": [
[
{
"node": "Merge Data for Upload",
"type": "main",
"index": 1
}
]
]
},
"Request Upload Link from LightX": {
"main": [
[
{
"node": "Extract Upload Link from LightX Response",
"type": "main",
"index": 0
}
]
]
},
"Download Final Photo from LightX": {
"main": [
[
{
"node": "Upload Final Photo to S1",
"type": "main",
"index": 0
}
]
]
},
"Generate Input File Name (.jpeg)": {
"main": [
[
{
"node": "Upload Original Photo to S1",
"type": "main",
"index": 0
}
]
]
},
"Generate Output File Name (.png)": {
"main": [
[
{
"node": "AI Upscale Image via Replicate",
"type": "main",
"index": 0
}
]
]
},
"Iterate Until Expansion is Ready": {
"main": [
[],
[
{
"node": "Wait Before Checking Status Again",
"type": "main",
"index": 0
}
]
]
},
"Request AI Expansion from LightX": {
"main": [
[
{
"node": "Iterate Until Expansion is Ready",
"type": "main",
"index": 0
}
]
]
},
"Wait Before Checking Status Again": {
"main": [
[
{
"node": "Check LightX Expansion Status",
"type": "main",
"index": 0
}
]
]
},
"Generate Public URL for Final Image": {
"main": [
[
{
"node": "Send Final URL to User via Telegram",
"type": "main",
"index": 0
}
]
]
},
"Generate Output Filename (.jpeg) Final": {
"main": [
[
{
"node": "Download Final Photo from LightX",
"type": "main",
"index": 0
}
]
]
},
"Generate Public URL for Original Image": {
"main": [
[
{
"node": "Set Input URL for AI Model",
"type": "main",
"index": 0
}
]
]
},
"Download Upscaled Image from Replicate1": {
"main": [
[
{
"node": "Calculate Padding for 3:2 Ratio",
"type": "main",
"index": 0
},
{
"node": "Get File Size (in Bytes)",
"type": "main",
"index": 0
},
{
"node": "Merge Data for Upload",
"type": "main",
"index": 0
}
]
]
},
"Extract Upload Link from LightX Response": {
"main": [
[
{
"node": "Merge Data for Upload",
"type": "main",
"index": 2
}
]
]
}
}
}
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This n8n workflow turns your Telegram bot into a powerful AI photo enhancer! Whether users send a photo or a link, it processes the image by: 📥 Receiving the input (photo or link) 🧠 Upscaling quality using Replicate's CodeFormer 📐 Analyzing image dimensions and calculating…
Source: https://n8n.io/workflows/6497/ — 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.
TextMain. Uses telegramTrigger, stopAndError, telegram, httpRequest. Event-driven trigger; 56 nodes.
Pede Ai. Uses httpRequest, telegram, postgres, telegramTrigger. Event-driven trigger; 53 nodes.
📄 Documentation: Notion Guide
Telegram Wait. Uses stickyNote, httpRequest, redis, noOp. Event-driven trigger; 36 nodes.
This workflow provides a complete solution for handling Telegram Stars payments, invoicing and refunds using n8n. It automates the process of sending invoices, managing pre-checkout approvals, recordi