AI Image Generation and Editing with OpenAI & Telegram Distribution - n8n Workflow

Use this powerful n8n workflow to generate or edit images using OpenAI GPT-Image-1 and automatically share results via Telegram. A robust n8n template for creative AI.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Markdown-formatted text.
Content creators and marketers needing fast visual assets.
Developers looking for advanced openai_integration n8n templates.
Users seeking a versatile n8n workflow for conditional AI image processing.
Teams wanting automated distribution of AI-generated content through Telegram.

Overview

This sophisticated n8n workflow acts as a centralized AI image factory, triggered by a custom web form submission. It intelligently switches between two core modes: pure image generation (text-to-image) or image-to-image editing, depending on whether the user provides an input image file or URL. Utilizing the powerful OpenAI GPT-Image-1 model, the automation ensures high-quality results. Once the image is processed, this n8n automation stores the resulting image either on Google Drive or imgbb and finally notifies a specified Telegram channel. This robust n8n template demonstrates effective conditional logic and seamless integration between AI services, storage, and messaging platforms, making it a key component for any creative automation stack. Every step leverages a specific n8n node to ensure smooth data transformation and service interaction.

How it Works

Markdown-formatted text.


  1. Trigger and Input (n8n trigger): The process begins with the On form submission n8n trigger, capturing user inputs including the image prompt, desired quality, and optionally, an input image file or URL.

  2. Mode Switching: The Switch Mode n8n node analyzes the input. If an existing image URL or file is detected, the workflow branches to the image editing path. Otherwise, it defaults to pure image generation.

  3. Image Editing Path: If an image URL is provided, the Get Input Image by URL node fetches the binary data. The Edit Image (OpenAI) n8n node then sends the image and the prompt to the OpenAI /v1/images/edits endpoint using the gpt-image-1 model.

  4. Image Generation Path: If no image is supplied, the Image Generation n8n node sends only the prompt to the OpenAI /v1/images/generations endpoint.

  5. Binary Conversion: The workflow uses a Convert json binary to File n8n node to transform the base64-encoded image data received from OpenAI into a usable binary PNG file.

  6. Storage and Linking: The resulting image is either uploaded to Google Drive (with public sharing permissions set by the Set Access Permissions n8n node) or to imgbb, depending on the preceding path. A subsequent Set n8n node captures the public view and content links.

  7. Final Distribution: The final Send to Telegram n8n node posts the generated photo along with the prompt and a direct link to the stored image, concluding the n8n workflow execution.

Installation Guide

Markdown-formatted text.


  1. Import the n8n workflow: Copy the provided JSON data and paste it into your n8n instance using the 'New' -> 'Import from JSON' option.

  2. OpenAI Credentials: Update the Edit Image (OpenAI) and Image Generation n8n nodes with your active OpenAI API credential. This is crucial for the n8n workflow to function.

  3. Google Drive Setup: If using the editing path, update the Upload Result Image to Google Drive n8n node with a valid Google Service Account credential.

  4. imgbb Setup: The image generation path requires setting the IMGBBAPIKEY in the SETUP API KEY n8n node. Replace the placeholder value.

  5. Telegram Configuration: In the Send to Telegram n8n node, provide your Telegram Bot API credential and ensure the chatId field is set to your target channel or chat ID.

  6. Activate: Save the n8n workflow and set the On form submission n8n trigger to 'Active'.

Node Details

Markdown-formatted text.
On form submission (n8n trigger): Initiates the entire n8n workflow. It collects Promt, quality (dropdown: low/medium/high), and file/URL inputs for image processing.
Switch Mode: A core n8n node for flow control. It uses conditional logic to determine if the workflow proceeds with image generation (fallback) or image editing (if input image data is present).
Edit Image (OpenAI) / Image Generation (HTTP Request n8n node): Sends requests to OpenAI's DALL-E API (gpt-image-1). Key configuration includes sending binary image data (for editing) or just the text prompt (for generation).
Convert json binary to File (n8n node): Essential data transformation step. It converts the b64_json output field from OpenAI into a binary file format (image/png), allowing subsequent n8n nodes to upload it to storage.
Upload Result Image to Google Drive (Google Drive n8n node): Stores the generated binary file in Google Drive. This n8n node requires service account authentication and specifies setting public read permissions via the connected Set Access Permissions node.
Upload Result Image to imgbb (HTTP Request n8n node): Provides an alternative storage method for results. It uses a multipart form data request, requiring an API key passed via a previous Set n8n node.


  • Send to Telegram (Telegram n8n node): The final action of this n8n workflow. It sends the public URL of the generated image as a photo, complete with a descriptive caption derived from the original prompt.

Related n8n Workflows

Free

Nodes: 8 Nodes
Updated: December 26 2025
View all
Created by

Featured*