Telegram Messaging Agent for Text/Audio/Images n8n Workflow Template

n8n workflow template · 29 nodes · Telegram

Telegram Messaging Agent for Text/Audio/Images is a free n8n workflow template that starts when its webhook receives an HTTP request and works with Telegram and OpenAI. It has 29 nodes, 6 of them AI nodes (OpenAI Chat Model, OpenAI and Text Classifier). To run it, you add your own credentials for OpenAI API and Telegram Bot API.

At a glance

Trigger
Webhook (Listen for Telegram Events)
Nodes
29
Apps
Telegram and OpenAI
AI nodes
6
Credentials
2 types
Category
Chatbots and messaging

Apps and integrations

  • Telegram
  • OpenAI

Node types used

  • If
  • Telegram
  • Webhook
  • HTTP Request
  • Edit Fields (Set)
  • OpenAI Chat Model
  • OpenAI
  • Convert to File
  • Extract from File
  • Text Classifier
  • Switch

How it works

The text below comes from the sticky notes inside the workflow. We removed links, code samples and anything that looks like a key or token.

Telegram Webhook Tools

Setting your Telegram Bot WebHook the Easy Way

Receive Telegram Message with Webhook

Set Webhook for Testing

Set Webhook for Production

Setup notes

The text below comes from the sticky notes inside the workflow. We removed links, code samples and anything that looks like a key or token.

How to set up a Telegram Bot WebHook

WebHook Setup Process

Basic Concept A WebHook allows your Telegram bot to automatically receive updates instead of manually polling the Bot API.

Setup Method To set a WebHook, make a GET request using this URL format

  • my_bot_token: Your bot token from BotFather
  • url_to_send_updates_to: Your HTTPS endpoint that handles bot updates

Verification To verify the WebHook setup, use

A successful response looks like

This method provides a simple and efficient way to handle Telegram bot updates automatically through webhooks rather than manual polling.

Nodes in this workflow

The 29 nodes in file order (sticky notes excluded). Branches and connections determine execution order in n8n:

  1. Check User & Chat ID (If)
  2. Error message (Telegram)
  3. Listen for Telegram Events (Webhook)
  4. Set Webhook Test URL (HTTP Request)
  5. Get Telegram Webhook Info (HTTP Request)
  6. Image Schema (Edit Fields (Set))
  7. gpt-4o-mini (OpenAI Chat Model)
  8. Get Audio File (Telegram)
  9. Get Image (Telegram)
  10. Analyze Image (OpenAI)
  11. Transcribe Recording (OpenAI)
  12. gpt-4o-mini1 (OpenAI Chat Model)
  13. Test Webhook Status (Telegram)
  14. Production Webhook Status (Telegram)
  15. Set Webhook Production URL (HTTP Request)
  16. Edit Fields (Edit Fields (Set))
  17. Audio Task Message (Telegram)
  18. Audio Other Message (Telegram)
  19. Text Task Message (Telegram)
  20. Text Other Message (Telegram)
  21. Image Message (Telegram)
  22. Convert to Image File (Convert to File)
  23. Extract from File to Base64 (Extract from File)
  24. Text Classifier Audio (Text Classifier)
  25. Text Classifier (Text Classifier)
  26. Telegram Token & Webhooks (Edit Fields (Set))
  27. Get Webhook Status (Telegram)
  28. Validation (Edit Fields (Set))
  29. Message Router (Switch)

Credentials you need

  • OpenAI API – used by Analyze Image, Transcribe Recording, gpt-4o-mini and gpt-4o-mini1
  • Telegram Bot API – used by Audio Other Message, Audio Task Message, Error message and Get Audio File and others

Configure your own credentials after importing. Create each credential in n8n, then select it in the node.

How to import into n8n

  1. Download the JSON file with the button above.
  2. In n8n, open a new workflow, select the ... menu and choose Import from File. You can also paste the JSON straight into the editor canvas.
  3. Open each node that shows a warning and select or create its credential.
  4. Read the notes on the canvas, test the workflow with sample data, then activate it.

Do you need somewhere to run it? Read our guide to self-hosted n8n.

Need this customised?

We can adapt this workflow to your apps, data and process, then deploy and support it.

Contact Us