Automate Telegram Image Replies with OpenAI and n8n

This workflow automates sending AI-generated images back to Telegram users who send messages, saving time on manual replies and enhancing user interaction through instant, intelligent visual responses.
telegramTrigger
openAi
telegram
+2
Workflow Identifier: 1778
NODES in Use: Telegram Trigger, OpenAI, Merge, Aggregate, Telegram

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 listens for new Telegram messages and uses them to create AI-generated pictures automatically.
It solves the problem of spending too much time replying with images manually.
When a user sends a text, the workflow makes a matching image and sends it back right away.

The result is instant, personalized picture replies that keep the chat active.


Who Should Use This Workflow

This is perfect for Telegram group managers or community admins who want to save time.
People who want fast, automatic image replies without searching or delays will find it useful.


Tools and Services Used

  • Telegram Bot API: Receives user messages.
  • OpenAI Image Generation API: Creates images from text prompts.
  • n8n Workflow Automation Platform: Connects Telegram with OpenAI to automate image replies.

How the Workflow Works

Input

  • New text messages sent to Telegram bot by users.

Processing Steps

  1. Telegram Trigger starts when a new message arrives.
  2. OpenAI node receives the text prompt to generate an image.
  3. Merge node combines Telegram user data with the image response.
  4. Aggregate node ensures the image binary data is kept intact.
  5. Telegram node sends the generated image back to the original sender.

Output

  • Telegram user receives an AI-created image reply fast.

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

Import the Workflow

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

Configure Credentials

  1. Add Telegram bot credentials with API keys and permissions.
  2. Add OpenAI API Key with image generation access.

Adjust Parameters If Needed

  1. Update chat IDs, email, channel names, or database details if used.
  2. Check the OpenAI prompt expression for correctness:
    = {{$json.message.text}}

Test and Activate

  1. Run the workflow in test mode by sending a message to the Telegram bot.
  2. Verify an AI-generated image returns quickly.
  3. Activate the workflow to make it work 24/7.
  4. Monitor logs for errors or failed calls.

For self hosting options, consider checking self-host n8n resources.


Inputs, Processing, and Outputs

Inputs

  • Telegram Bot receives text messages from users in real time.

Processing

  • OpenAI takes message text and generates related images.
  • Merge node aligns user info and AI results.
  • Aggregate node safely keeps image data in workflow.

Outputs

  • Telegram Bot sends AI image back to the user’s chat.

Common Failures and Troubleshooting

No Image Generated or Empty OpenAI Response

Cause: Wrong prompt mapping or wrong OpenAI resource setting.

Fix: Check the OpenAI node uses this expression:

= {{$json.message.text}}

And ensure resource is set to “image”.

Telegram Message Not Sent or Wrong Chat ID

Cause: Chat ID is hardcoded or mapped incorrectly.

Fix: Use expression:

= {{$json.data[1].message.from.id}}

To dynamically pick user’s chat ID.


Customization Ideas

  • Change OpenAI prompt to add descriptive words, for example: “Draw a beautiful …” before passing user text.
  • Add a filter node to let only specific keyword messages generate images.
  • Change Telegram node operation to send videos or documents with proper binary data.
  • Add captions to images using Telegram additional fields.
  • Log messages and image links into a database or Google Sheets for tracking.

Pre-Production Checklist

  • Make sure Telegram bot API credentials have rights to read and send messages.
  • Verify the OpenAI API key works and has access to create images.
  • Send test messages to confirm webhook triggers the flow.
  • Confirm Merge node combines Telegram and OpenAI data correctly.
  • Check that binary image data is included and sent by the Telegram node.

Deployment Guide

Activate the workflow after confirming tests.
Watch the execution logs to catch errors.

To support scale, set alerts for failures.
Monitor OpenAI API usage to stay within limits.

For hosting on a private server, see self-host n8n.


Summary

✓ Automatically create AI images from Telegram messages.
✓ Save time by removing manual image searches.
✓ Give quick, tailored replies to users.
✓ Keep Telegram groups more lively and engaged.
✓ Easy to run with Telegram Trigger and OpenAI nodes in n8n.


Frequently Asked Questions

It starts the workflow when a new message is received by the Telegram bot.
It uses the text from the message as a prompt and calls the image generation API to make a picture.
It combines Telegram user info with the AI-generated image data for sending the correct reply.
Check that the OpenAI node prompt uses the exact expression and that the resource is set to create images.

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