n8n

How to Generate Telegram Image Content?

Turn Telegram chats into fast AI content production. Team members type a request in Telegram, get a helpful AI reply, and when they ask for an image, an AI image is created and sent back in the same chat. It fits marketing and social teams that need quick mockups, post ideas, and visual drafts without waiting on a designer.

Here is how it runs. A Telegram event starts the flow when a user sends a message. An AI Agent powered by GPT reads the text, remembers the last 10 messages for context, and decides if it should generate an image. If yes, it calls a Dall E 3 tool that triggers an HTTP request to the OpenAI Images API with the user prompt and returns a 1024x1024 image URL. The photo is then sent back through Telegram. Text replies are cleaned to avoid HTML issues in Telegram so messages do not break.

Set up needs a Telegram bot token and an OpenAI API key. Connect both credentials in n8n Cloud and activate the workflow so Telegram events are received. Expect faster content creation and fewer back and forth steps. Use it for campaign drafts, ad concepts, and quick visuals during client chats.

What are the key features?

  • Telegram event trigger listens for new messages and starts the flow
  • GPT chat model with memory keeps the last 10 messages for context
  • AI Agent decides when to create an image and when to just reply with text
  • Dall E 3 tool calls a linked path that generates images from the user prompt
  • HTTP request to OpenAI Images API returns a 1024x1024 image URL
  • Telegram sendPhoto posts the generated image back to the same chat
  • Output is sanitized to prevent broken HTML in Telegram messages

What are the benefits?

  • Reduce manual image requests from 30 minutes to under 1 minute
  • Streamline Telegram content requests by up to 80% with one chat flow
  • Eliminate HTML formatting errors in messages for reliable delivery
  • Handle many chat requests at once without extra staff
  • Connect Telegram and OpenAI in one clear process

How do you set it up?

  1. Import the template into n8n: Create a new workflow in n8n > Click the three dots menu > Select 'Import from File' > Choose the downloaded JSON file.
  2. You'll need accounts with Telegram and OpenAI. See the Tools Required section above for links to create accounts with these services.
  3. Create a Telegram bot with BotFather and copy the bot token. In the n8n credentials manager, create a new Telegram credential and paste the token. Save it with a clear name.
  4. In your OpenAI account, create an API key on the API keys page. In n8n credentials, create a new OpenAI credential and paste the key. Use a clear name so you can find it later.
  5. Open the Telegram Trigger node in the workflow and select your Telegram credential. Keep the update type set to message. Save changes.
  6. Open the AI Agent node and confirm the Chat Model is selected and linked. Keep the memory window at 10 unless you need longer context.
  7. Check the Dall E 3 Tool and the Execute Workflow Trigger path. Confirm the HTTP Request node points to the OpenAI Images API and uses the model dall-e-3 and the prompt from the query field.
  8. Open the Telegram send nodes and confirm the chatId expressions match the trigger message fields. Keep parse mode set to HTML.
  9. Activate the workflow in n8n Cloud so Telegram events are received. Send a normal message to the bot and confirm you get an AI reply.
  10. Test an image request like Draw a neon robot on a skateboard. You should receive an image in the chat. If no image arrives, open the execution log and check the HTTP Request status and OpenAI errors.
  11. If messages fail to send or look broken, verify the Correct errors node is connected and running. If the trigger does not fire, check the bot token and that the workflow is active.

Tools Required

$24 / mo or $20 / mo billed annually to use n8n in the cloud. However, the local or self-hosted n8n Community Edition is free.

OpenAI

Sign up

Pay-as-you-go: GPT-5 at $1.25 per 1M input tokens and $10 per 1M output tokens

Telegram

Sign up

Free: $0, Telegram Bot API usage is free for developers

Similar Templates

Join Futurise to access 1,200+ automation templates

Get instant access to ready-made automation workflows for n8n, Make.com, AI agents, and more. Download, customise, and deploy in minutes.