Automate Telegram Messaging with n8n: Text, Audio & Image Bot

This n8n workflow automates handling Telegram messages including text, audio, and images by using Telegram Webhooks and AI-powered classifiers. It solves the problem of manual message processing and enables automatic task creation and message responses.
telegram
webhook
lmChatOpenAi
+8
Workflow Identifier: 2005
NODES in Use: if, telegram, stickyNote, webhook, httpRequest, set, switch, lmChatOpenAi, convertToFile, extractFromFile, textClassifier

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

Visit through Desktop for Best experience

What This Automation Does

This workflow watches Telegram messages and handles text, audio, and image inputs automatically.
It sorts messages by type, transcribes voice notes with AI, classifies texts as tasks or simple chats, and analyzes image content.
The program replies in Telegram based on message type and classification.
This helps users save time and answer messages faster without missing important tasks.


Tools and Services Used

  • Telegram Bot API: Receives user messages.
  • n8n: Automates workflow orchestration.
  • OpenAI API: Transcribes audio to text and classifies messages.
  • HTTPS Webhook Endpoint: Receives Telegram updates securely.

Beginner Step-by-Step: How to Use This Workflow in n8n

Import Workflow

  1. Download the workflow file using the Download button on this page.
  2. Open n8n editor and choose the “Import from File” option.
  3. Select the downloaded workflow file and load it.

Setup Credentials and Configurations

  1. Add Telegram Bot API credentials inside the relevant nodes.
  2. Enter OpenAI API Key in all nodes that require AI services.
  3. Update any user IDs, chat IDs, emails, or paths as needed in the validation and messaging nodes.

Test Workflow

  1. Send sample messages (text, audio, image) from authorized Telegram users.
  2. Check that transcriptions and classifications happen correctly.
  3. Confirm Telegram replies are sent as expected.

Activate for Production

  1. Make the Webhook node active in n8n.
  2. Run the workflow and monitor logs for errors.
  3. Ensure the webhook URL is set correctly in Telegram Bot API.

For reliable uptime, consider self-host n8n on a server.


Inputs → Processing Steps → Outputs

Inputs

  • Incoming Telegram messages containing text, voice audio, or images.

Processing Steps

  • Validation: Checks if the sender is in allowed user list.
  • Routing: Switches message flow based on message type (text, audio, or image).
  • Audio Handling: Downloads voice note, transcribes speech to text via OpenAI, then classifies text as task or general.
  • Text Handling: Extracts message text, classifies it similarly.
  • Image Handling: Downloads image file, converts it to base64, analyzes image content with OpenAI.
  • Unknown Messages: Detects unsupported types and sends generic reply.

Outputs

  • Telegram reply messages confirming tasks or providing feedback.
  • Classifications stored or sent for further action.

Edge Cases and Failures

  • Webhook not receiving updates: Verify webhook URL uses HTTPS and Telegram returns ok: true.
  • Messages from unauthorized users get blocked by validation.
  • Audio transcription can fail if voice file is not properly downloaded or binary property is wrong.
  • Unknown message types trigger generic error replies.

Customization Ideas

  • Change validation list for allowed users by editing the Set node “Validation”.
  • Add handling for other message types like videos or documents by expanding Switch node “Message Router”.
  • Tune OpenAI node parameters like model or prompt for improved accuracy.
  • Personalize Telegram replies by editing message text in nodes like “Text Task Message”.
  • Add logging nodes to save processed data to a database or spreadsheet.

Pre-Production Checklist

  • Confirm that Telegram bot token is correct and active.
  • Test that webhook URLs respond properly on HTTPS.
  • Send test messages of all supported types from authorized users.
  • Check AI classification and transcription outputs.
  • Verify replies are sent correctly according to message type.

Deployment Guide

Turn on the Webhook node to activate.
Keep an eye on workflow error logs.
Use self-host n8n on a server for constant uptime.
Regularly review logs to improve classification and validation.


Summary

✓ Saves hours of manually sorting Telegram messages.
✓ Automatically transcribes voice notes and classifies message intent.
✓ Replies instantly with task confirmations or feedback.
✓ Supports text, audio, and image message types.
✓ Improves team productivity and customer response speed.


https://api.telegram.org/bot{token}/setWebhook?url={your-webhook-URL}

Use above URL in HTTP Request nodes “Set Webhook Test URL” and “Set Webhook Production URL” replacing {token} and {your-webhook-URL} accordingly.


Frequently Asked Questions

The current workflow does not handle video messages. You can add video support by extending the message router conditions and processing nodes.
Update the “Validation” set node in n8n with the new users’ first names, last names, and user IDs.
Audio transcription fails if the voice file is not downloaded correctly or if the binary property in the OpenAI node is not set to the audio data.
Yes, transcription and image analysis use OpenAI API credits. Monitor usage and adjust as needed.

Promoted by BULDRR AI

Related Workflows

Automate Viral UGC Video Creation Using n8n + Degaus (Beginner-Friendly Guide)

Learn how to automate viral UGC video creation using n8n, AI prompts, and Degaus. This beginner-friendly guide shows how to import, configure, and run the workflow without technical complexity.
Form Trigger
Google Sheets
Gmail
+37
Free

AI SEO Blog Writer Automation Workflows in n8n

A complete beginner guide to building an AI SEO blog writer automation using n8n.
AI Agent
Google Sheets
httpRequest
+5
Free

Automate CrowdStrike Alerts with VirusTotal, Jira & Slack

This workflow automates processing of CrowdStrike detections by enriching threat data via VirusTotal, creating Jira tickets for incident tracking, and notifying teams on Slack for quick response. Save hours daily by transforming complex threat data into actionable alerts effortlessly.
scheduleTrigger
httpRequest
jira
+5
Free

Automate Telegram Invoices to Notion with AI Summaries & Reports

Save hours on financial tracking by automating invoice extraction from Telegram photos to Notion using Google Gemini AI. This workflow extracts data, records transactions, and generates detailed spending reports with charts sent on schedule via Telegram.
lmChatGoogleGemini
telegramTrigger
notion
+9
Free

Automate Email Replies with n8n and AI-Powered Summarization

Save hours managing your inbox with this n8n workflow that uses IMAP email triggers, AI summarization, and vector search to draft concise replies requiring minimal review. Automate business email processing efficiently with AI guidance and Gmail integration.
emailReadImap
vectorStoreQdrant
emailSend
+12
Free

Automate Email Campaigns Using n8n with Gmail & Google Sheets

This n8n workflow automates personalized email outreach campaigns by integrating Gmail and Google Sheets, saving hours of manual follow-up work and reducing errors in email sequences. It ensures timely follow-ups based on previous email interactions, optimizing communication efficiency.
googleSheets
gmail
code
+5
Free