n8n

How to Generate Telegram Images for Customer Engagement?

Turn your Telegram chat into a smart assistant that answers questions and creates images on request. It sends friendly text replies and can deliver Dall E 3 images right in the conversation. Ideal for marketing teams running communities or campaigns on Telegram.

New messages trigger an app event from Telegram. An AI agent powered by GPT 4o reads the text and keeps a short memory per user so the chat stays on topic. When someone asks for a picture, the agent calls the Dall E 3 image API and passes the image URL to a Telegram sender that returns the file. If no picture is needed, it posts a clear text reply. All replies use the original chat id, so each person gets the right response.

You only need a Telegram bot token and an OpenAI API key to run it. After connecting both tools, test by messaging your bot, then ask it to draw a design or mockup. Expect faster replies, less manual design work, and more engagement, such as product mockups, event flyers, and social posts created in under a minute.

What are the key features?

  • Telegram trigger listens for new updates and routes messages into the flow.
  • GPT 4o chat model generates friendly text replies with temperature 0.7 and light frequency control.
  • Per user memory stores the last 10 messages using the chat id as the session key.
  • AI agent decides when to generate an image or send text only based on the user request.
  • Dall E 3 images are created via a secure HTTP call to the OpenAI Images API.
  • Telegram image sender posts the returned image URL as a file back to the same user.
  • Final text replies are sent to the correct chat id for accurate routing.

What are the benefits?

  • Reduce manual image creation from 30 minutes to 1 minute per request
  • Automate up to 90% of repetitive image replies in Telegram
  • Cut average response time from 5 minutes to under 30 seconds
  • Connect Telegram and OpenAI in one simple flow
  • Maintain context with the last 10 messages per user
  • Handle up to 10 times more requests per hour than one person

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 using BotFather in the Telegram app and copy the bot token.
  4. In the n8n credentials manager, create a new Telegram credential. Paste your bot token and save. Then open the Telegram Trigger, Send final reply, and Send back an image nodes and select this Telegram credential.
  5. In the n8n credentials manager, create a new OpenAI credential. Visit the OpenAI API page, generate an API key, paste it in, and save. Open the OpenAI Chat Model and Generate image in Dalle nodes and select this OpenAI credential.
  6. Open the Generate image in Dalle node and confirm the model is set to dall e 3 and the request method is POST to the OpenAI images endpoint.
  7. Open the AI Agent node and keep the system message as provided so the agent calls the image tool when a user asks for a picture.
  8. Click Execute workflow to register the Telegram webhook. In Telegram, start a chat with your bot and send a simple message. Confirm you receive a text reply.
  9. Ask the bot to draw something, for example say Draw a cozy cafe logo. Confirm that an image file is returned in the chat.
  10. If you do not get an image, check that the Generate image in Dalle node returns a url field and that the Send back an image node operation is set to sendDocument with the file field mapped to that URL.
  11. If the bot does not answer, make sure you started the chat in Telegram, verify the correct Telegram credential is selected on all Telegram nodes, and re run Execute workflow to refresh the webhook.
  12. If OpenAI returns an error, confirm your API key is valid, your account has access to the images endpoint, and your n8n OpenAI credential is selected on both AI nodes.

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

Credits:
Ted's Tech Talks

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.