This workflow creates a Telegram bot handling text, voice, and image messages using OpenAI for processing. Key nodes include Telegram Webhook Trigger (receives messages), Validate Webhook Payload (checks message validity), Extract User Data (collects user info), Message Type Router (directs text/voice/image), Text Message Classifier (categorizes text as task/question/other), Transcribe Voice Message (converts audio to text), Analyze Image Content (describes images), and response nodes (Task Response Handler, Voice Message Response, Image Analysis Response). Error handlers (Webhook Error Handler, Text Validation Error, Voice Validation Error, Image Analysis Error) ensure robust processing.\n\nSetup Requirements and Configuration: Install n8n from n8n.io for self-hosting or sign up at cloud.n8n.io. Obtain a Telegram Bot token from BotFather on Telegram and an OpenAI API key from platform.openai.com. Import the JSON workflow in n8n. Configure Telegram Webhook Trigger with a unique path (e.g., 'telegram-bot') and set it as a public URL in n8n settings. Add Telegram and OpenAI credentials in nodes like Text Classification Model, Transcribe Voice Message, and Analyze Image Content under ‘Credentials.’ Set environment variables TELEGRAM_AUTHORIZED_USERS (comma-separated user IDs), TELEGRAM_ALLOW_ALL_USERS, and ENABLE_RATE_LIMITING. Ensure n8n has internet access for Telegram and OpenAI API calls.\n\nTesting and Deployment Steps: Activate the workflow to generate the webhook URL. Register it with Telegram using /setWebhook via BotFather. Send test text (“Create task: Buy groceries”), voice, or image messages to the bot. Validate outputs in Task Response Handler, Voice Message Response, or Image Analysis Response via Telegram. Check n8n logs for errors like ‘Invalid Telegram token,’ ‘OpenAI API key missing,’ or ‘Webhook payload invalid.’ Webhook Error Handler returns HTTP 400 for invalid payloads. Verify text classification (task vs. question), voice transcription accuracy, and image analysis relevance. Test error cases: send an oversized image (>20MB) or empty text to trigger error handlers. Debug using logs for credential or rate-limiting issues. Adjust TELEGRAM_AUTHORIZED_USERS to restrict access.
$6.99
Workflow steps: 37
Integrated apps: webhook, if, set