UGC Image Generator from Form Submission using Gemini and Telegram - n8n Workflow

Instantly generate realistic UGC (User-Generated Content) images from simple form submissions. This n8n workflow leverages the n8n trigger, Google Gemini, and Telegram automation for content creation.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Markdown-formatted text:
Digital Marketers and Content Teams: Who need a rapid, scalable way to produce authentic-looking UGC images for advertising.
n8n Automation Experts: Looking for advanced n8n templates integrating multimodal AI models like Google Gemini.
Agencies: Seeking to streamline their content creation pipeline triggered directly by client or internal submissions.
Developers and Integrators: Wanting a complex example of using the n8n node structure for file processing (Base64 conversion, binary handling) and external API integration (OpenRouter).

Overview

This powerful n8n workflow solves the challenge of manually creating engaging User-Generated Content (UGC) images. Instead of complex photo shoots or design software, users simply fill out a basic n8n form—uploading a product image and selecting a character type (e.g., Male/Female). The core value of this n8n template lies in its seamless integration of this input with a powerful AI model. It sends the product image and character context to Google Gemini (via OpenRouter), instructing the AI to create a realistic, lifestyle-style UGC photo. The resulting, high-quality AI-generated image is then automatically posted to a designated Telegram channel, providing an end-to-end, zero-touch content generation and distribution system. This entire automation demonstrates the flexibility of using n8n nodes for complex media transformations.

How it Works

Markdown-formatted text:


  1. Form Submission (n8n trigger): The process starts with the 'Form submission with character type and image' n8n trigger, which captures the product image (as a binary file) and the character model selection.

  2. File Extraction and Preparation: The 'Extract the form file' n8n node converts the binary image data into a Base64 string (image_base64). This data is then combined with the character model metadata using the 'Merge the two data sets' n8n node.

  3. Data URL Creation: A specialized 'Creating a data URL' n8n node (Code node) constructs a valid Data URL (data:image/jpeg;base64,...) from the Base64 string, preparing the image for the API call.

  4. AI Generation Request: The workflow uses the 'Mapping' n8n node to structure the payload before the 'Google gemini' n8n node (an HTTP Request n8n node) sends the multimodal request to OpenRouter. The prompt asks Gemini-2.5-Flash to create a 'realistic and engaging UGC image' based on the product image and character specified.

  5. Result Processing: The 'Transform URL data' n8n node (Code node) extracts the resulting Base64 image data from the Gemini response and cleans up the prefix.

  6. Binary Conversion: The 'Download the file' n8n node (Convert to File) transforms the clean Base64 string back into a storable binary file format.

  7. Distribution: Finally, the 'Send a photo message' n8n node utilizes the Telegram integration to instantly share the newly generated UGC image as a photo message to the target channel, completing the n8n workflow.

Installation Guide

Markdown-formatted text:
To deploy this powerful n8n workflow and start generating UGC images, follow these steps:


  1. Import the n8n Template: Copy the provided JSON code and paste it into your n8n instance using the 'New' -> 'Import from JSON' function.

  2. Set up the n8n Trigger Form: Activate the 'Form submission with character type and image' n8n trigger node. Share the generated public form URL with your content creators or team members. Ensure the fields match the expected inputs (Product image upload and Character model dropdown).

  3. Configure OpenRouter Credentials: The 'Google gemini' n8n node requires an OpenRouter API key credential. Set this up in your n8n credentials section to authorize API access to the Google Gemini model.

  4. Configure Telegram Credentials: Set up the Telegram API credentials in the 'Send a photo message' n8n node. You will need your Bot Token and the Chat ID (e.g., @assistantjaures) of the channel or group where the final UGC image should be posted.

  5. Activation: Once all credentials are set, save and activate the n8n workflow. Submitting the form will now trigger the full automation loop.

Node Details

Markdown-formatted text:
This n8n workflow relies on a sequence of specialized n8n nodes for data manipulation and external API interaction:

Form submission with character type and image (Form Trigger n8n trigger):
Function: Serves as the starting point, capturing user input including a file upload ('Product image') and a selection ('Character model').
Key Configuration: Configured to accept .jpg, .png, .jpeg files and uses a dropdown for character type (Homme/Femme).
Extract the form file (Extract From File n8n node):
Function: Converts the binary uploaded file into a text-based Base64 string, storing it under the property imagebase64 for API transport.
Creating a data URL (Code n8n node):
Function: Essential pre-processing step that formats the raw Base64 data into a standard Data URL string (data:image/jpeg;base64,...), required by multimodal APIs.
Google gemini (HTTP Request n8n node):
Function: Executes the core AI generation task. It connects to the OpenRouter endpoint to access google/gemini-2.5-flash-image-preview using the user's input image and character model in the prompt.
Key Configuration: Uses a complex JSON body containing multimodal input (text prompt and image
url object) to guide the UGC generation.
Transform URL data (Code n8n node):
Function: Cleans the AI response by extracting the resultant Base64 image URL and stripping the data: prefix, making it ready for binary conversion.
Download the file (Convert To File n8n node):
Function: Reverts the processed Base64 string back into a true binary file object, which is necessary for the Telegram n8n node to send the photo.
Send a photo message (Telegram n8n node):
Function: Publishes the final AI-generated UGC image to the specified Telegram chat/channel, completing this sophisticated n8n workflow.

Related n8n Workflows

Free

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

Je rends l’IA claire et pratique même pour ceux qui débutent

Featured*