This workflow corresponds to n8n.io template #17871 — we link there as the canonical source.
This workflow follows the Chat Trigger → 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": "ky9cPwJ6pl5YxwbH",
"meta": {
"templateCredsSetupCompleted": true
},
"name": "Agnes Ai",
"tags": [],
"nodes": [
{
"id": "74a41d1e-6dae-43f2-b98a-3b87f01cabdd",
"name": "When chat message received",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"position": [
-144,
80
],
"parameters": {
"options": {
"responseMode": "responseNodes"
}
},
"typeVersion": 1.4
},
{
"id": "fb5be729-1675-4f85-99e5-4c3133a55d8d",
"name": "Wait",
"type": "n8n-nodes-base.wait",
"position": [
1104,
-144
],
"parameters": {
"amount": 30
},
"typeVersion": 1.1
},
{
"id": "0e26593f-3acd-4c65-9a3b-1e712bdba6ce",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-944,
-256
],
"parameters": {
"width": 672,
"height": 736,
"content": "# Chat, image, and video reply assistant with Agnes AI and Telegram\n\n# How it works\n\n* Receives a prompt from the **n8n Chat**.\n* Uses keywords to determine the requested output:\n\n * **Text** \u2192 returns an AI-generated response in the n8n Chat.\n * **Image** \u2192 generates an image with Agnes AI and uploads it to ImageKit.\n * **Video** \u2192 generates a video with Agnes AI and sends it to Telegram.\n* Returns the result through the corresponding channel.\n\n# Setup\n\n**Agnes AI**\n\n* Add your Agnes AI HTTP Bearer Auth credential.\n* Select it in the Agnes AI HTTP Request nodes.\n\n**Telegram**\n\n* Add your Telegram API credential.\n* Set your target Telegram chat ID.\n\n**ImageKit**\n\n* Add your ImageKit credentials.\n* Update the `Authorization` header in the ImageKit upload request.\n\n# Customize\n\n* Update the **Switch** node keywords to change how prompts are routed between text, image, and video generation."
},
"typeVersion": 1
},
{
"id": "8b074395-98f1-46aa-b169-771dfb818dc5",
"name": "Agnes Image",
"type": "n8n-nodes-base.httpRequest",
"position": [
768,
272
],
"parameters": {
"url": "https://apihub.agnes-ai.com/v1/images/generations",
"method": "POST",
"options": {},
"jsonBody": "={\n \"model\": \"agnes-image-2.1-flash\",\n \"prompt\": \"{{ $json.chatInput }}\",\n \"size\": \"1K\",\n \"ratio\": \"9:16\",\n \"extra_body\": {\n \"response_format\": \"url\"\n }\n}",
"sendBody": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "httpBearerAuth"
},
"credentials": {
"httpBearerAuth": {
"name": "<your credential>"
},
"httpHeaderAuth": {
"name": "<your credential>"
}
},
"typeVersion": 4.4
},
{
"id": "b92787a6-1437-4672-bf36-64d72003d306",
"name": "Agnes Text",
"type": "n8n-nodes-base.httpRequest",
"position": [
768,
64
],
"parameters": {
"url": "https://apihub.agnes-ai.com/v1/chat/completions",
"method": "POST",
"options": {},
"jsonBody": "={\n \"model\": \"agnes-2.0-flash\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"{{ $json.chatInput }}\"\n }\n ]\n}",
"sendBody": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "httpBearerAuth"
},
"credentials": {
"httpBearerAuth": {
"name": "<your credential>"
},
"httpHeaderAuth": {
"name": "<your credential>"
}
},
"typeVersion": 4.4
},
{
"id": "75a7b0e9-3225-4dfe-8697-536352dca49c",
"name": "Agnes Video",
"type": "n8n-nodes-base.httpRequest",
"position": [
432,
-160
],
"parameters": {
"url": "https://apihub.agnes-ai.com/v1/videos",
"method": "POST",
"options": {},
"jsonBody": "={\n \"model\": \"agnes-video-v2.0\",\n \"prompt\": \"{{ $json.chatInput }}\"\n}",
"sendBody": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "httpBearerAuth"
},
"credentials": {
"httpBearerAuth": {
"name": "<your credential>"
}
},
"typeVersion": 4.4
},
{
"id": "ce163533-c4a6-4fc2-814e-b03ec26a5d1d",
"name": "Get video file",
"type": "n8n-nodes-base.httpRequest",
"position": [
1424,
-304
],
"parameters": {
"url": "={{ $('HTTP Request Video').item.json.url }}",
"options": {
"response": {
"response": {
"responseFormat": "file"
}
}
}
},
"typeVersion": 4.4
},
{
"id": "bca1182b-8b4d-4a15-afda-c740360c1b4f",
"name": "HTTP Request Video",
"type": "n8n-nodes-base.httpRequest",
"position": [
656,
-160
],
"parameters": {
"url": "=https://apihub.agnes-ai.com/agnesapi?video_id={{ $('Agnes Video').item.json.video_id }}",
"options": {},
"authentication": "genericCredentialType",
"genericAuthType": "httpBearerAuth"
},
"credentials": {
"httpBearerAuth": {
"name": "<your credential>"
}
},
"typeVersion": 4.4
},
{
"id": "b08289d7-97a2-41bd-a986-a02a7860ff05",
"name": "Save photo to ImageKit",
"type": "n8n-nodes-base.httpRequest",
"onError": "continueErrorOutput",
"position": [
1456,
272
],
"parameters": {
"url": "https://upload.imagekit.io/api/v1/files/upload",
"method": "POST",
"options": {},
"sendBody": true,
"contentType": "multipart-form-data",
"sendHeaders": true,
"bodyParameters": {
"parameters": [
{
"name": "fileName",
"value": "image.jpg"
},
{
"name": "file",
"value": "={{ $json.data[0].url }}"
}
]
},
"headerParameters": {
"parameters": [
{
"name": "Authorization",
"value": "=Basic {{ 'private_n4GxZOm0rIX4L/SqshkUjzNRILo=:'.base64Encode() }}"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "791b2dd7-bf2d-4c65-ac25-f278292a5b9f",
"name": "Switch Output",
"type": "n8n-nodes-base.switch",
"position": [
96,
64
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "text",
"conditions": {
"options": {
"version": 3,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "fbe3160a-6dba-4558-bf79-01729b405536",
"operator": {
"type": "string",
"operation": "notRegex"
},
"leftValue": "={{ $json.chatInput }}",
"rightValue": "immagine|foto|image|photo|video"
}
]
},
"renameOutput": true
},
{
"outputKey": "image",
"conditions": {
"options": {
"version": 3,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "44c8fcf9-346f-4475-80df-694450774fb2",
"operator": {
"type": "string",
"operation": "regex"
},
"leftValue": "={{ $json.chatInput }}",
"rightValue": "immagine|foto|image|photo"
}
]
},
"renameOutput": true
},
{
"outputKey": "video",
"conditions": {
"options": {
"version": 3,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "b52649cd-5aa3-4e0c-abe4-5b71f023333f",
"operator": {
"type": "string",
"operation": "regex"
},
"leftValue": "={{ $json.chatInput }}",
"rightValue": "video"
}
]
},
"renameOutput": true
}
]
},
"options": {}
},
"typeVersion": 3.4
},
{
"id": "f15ecc4e-3eba-45fe-8a44-92a8a294ba70",
"name": "Respond to Chat",
"type": "@n8n/n8n-nodes-langchain.chat",
"position": [
1456,
64
],
"parameters": {
"message": "={{ $json.choices[0].message.content }}",
"options": {}
},
"typeVersion": 1.3
},
{
"id": "9717b6e0-46a4-4e7a-af6c-aff1bda77e49",
"name": "If status is completed",
"type": "n8n-nodes-base.if",
"position": [
880,
-160
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 3,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "b7b650ed-3711-4c45-9ed5-76fb98638f1c",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.status }}",
"rightValue": "completed"
}
]
}
},
"typeVersion": 2.3
},
{
"id": "e40630f1-bb6d-431b-9c31-071749b27201",
"name": "Send video to Telegram",
"type": "n8n-nodes-base.telegram",
"position": [
1664,
-304
],
"parameters": {
"chatId": "123456789",
"operation": "sendVideo",
"binaryData": true,
"additionalFields": {
"caption": "Ti piace?"
}
},
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "11e0775d-9321-46af-8125-62fbf2b39f82",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-192,
0
],
"parameters": {
"color": "#FFFFFF",
"width": 464,
"height": 320,
"content": "# 1. GET INPUT"
},
"typeVersion": 1
},
{
"id": "36a0a88e-2821-4429-8fd7-aede07eed1aa",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
352,
-288
],
"parameters": {
"color": "#FFFFFF",
"width": 944,
"height": 768,
"content": "# 2. PROCESS INPUT WITH AGNES API"
},
"typeVersion": 1
},
{
"id": "51493c2c-b261-4c26-8603-f0d243508e18",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
1360,
-384
],
"parameters": {
"color": "#FFFFFF",
"width": 496,
"height": 864,
"content": "# 3. RETURN OUTPUT"
},
"typeVersion": 1
}
],
"active": true,
"settings": {
"binaryMode": "separate",
"availableInMCP": false,
"executionOrder": "v1"
},
"versionId": "d5138a7f-8c5d-4580-aee2-83340a435fa2",
"nodeGroups": [],
"connections": {
"Wait": {
"main": [
[
{
"node": "HTTP Request Video",
"type": "main",
"index": 0
}
]
]
},
"Agnes Text": {
"main": [
[
{
"node": "Respond to Chat",
"type": "main",
"index": 0
}
]
]
},
"Agnes Image": {
"main": [
[
{
"node": "Save photo to ImageKit",
"type": "main",
"index": 0
}
]
]
},
"Agnes Video": {
"main": [
[
{
"node": "HTTP Request Video",
"type": "main",
"index": 0
}
]
]
},
"Switch Output": {
"main": [
[
{
"node": "Agnes Text",
"type": "main",
"index": 0
}
],
[
{
"node": "Agnes Image",
"type": "main",
"index": 0
}
],
[
{
"node": "Agnes Video",
"type": "main",
"index": 0
}
]
]
},
"Get video file": {
"main": [
[
{
"node": "Send video to Telegram",
"type": "main",
"index": 0
}
]
]
},
"Respond to Chat": {
"main": [
[]
]
},
"HTTP Request Video": {
"main": [
[
{
"node": "If status is completed",
"type": "main",
"index": 0
}
]
]
},
"If status is completed": {
"main": [
[
{
"node": "Get video file",
"type": "main",
"index": 0
}
],
[
{
"node": "Wait",
"type": "main",
"index": 0
}
]
]
},
"When chat message received": {
"main": [
[
{
"node": "Switch Output",
"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.
httpBearerAuthhttpHeaderAuthtelegramApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This workflow receives a chat message, routes it to Agnes AI to generate either a text response, an image, or a video, uploads generated images to ImageKit, and sends completed videos to a Telegram chat. Receives an incoming chat message and reads the user’s prompt. Routes the…
Source: https://n8n.io/workflows/17871/ — 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.
Template was created in n8n v1.90.2 Execute Sub-workflow Trigger node Chat Trigger node Redis node Postgres node Telegram node HTTP Request node If node, Code node, Edit Fields (Set) Execute Sub-workf
Menu-Handler. Uses telegramTrigger, chatTrigger, executeWorkflowTrigger, chainLlm. Event-driven trigger; 28 nodes.
Menu-Handler. Uses telegramTrigger, chatTrigger, executeWorkflowTrigger, chainLlm. Event-driven trigger; 28 nodes.
Trigger. Uses telegramTrigger, chatTrigger, slackTrigger, telegram. Event-driven trigger; 13 nodes.
End-to-End Video Creation from user idea or transcript AI-Powered Scriptwriting using LLMs (e.g., DeepSeek via OpenRouter) Voiceover Generation with customizable TTS voices Image Scene Generation usin