Generate AI images in Telegram with GPT-4o enhancement and Flux Pro
π§ AI Image Generator Bot β Telegram + AI/ML API
This n8n workflow allows users to generate AI-generated images by sending messages to a Telegram bot. Each request is logged in Google Sheets and limited by a daily quota per user. Image prompts are enhanced by LLM before generation.
π Features
- π© Telegram-based input
- π§ Prompt enhancement with GPT-4o
- π¨ AI image generation via
flux-promodel (AIMLAPI) - π Auto-caption generation
- π Usage tracked per user daily in Google Sheets
- π Daily request limits
- β Graceful UX for over-limit cases
π Setup Guide
1. π² Create Telegram Bot
- Talk to @BotFather
- Use
/newbotβ Choose a name and username - Save the bot token
2. π Set Up Credentials in n8n
Telegram API: Use your bot tokenGoogle Sheets: Set up via OAuth2 or Service AccountAI/ML API: Set up with your API key from aimlapi.com
3. π Prepare Google Sheet
- Name: Any (e.g.,
Image bot usage statistic) - Sheet:
Sheet1 - Columns:
user_id | date | query | result_url
- Share the sheet with the email of your service/OAuth2 account
4. π§ Configure the Workflow
-
Open the n8n editor and import the JSON
-
Update:
- Telegram credential
- Google Sheets credential and Sheet ID
- AI/ML API credentials
βοΈ Flow Summary
| Node | Function |
| ------------------------------ | ------------------------------------ |
| π© Receive Telegram Message | Triggered by user message |
| π Fetch Usage Logs | Reads today's entries from Sheet |
| π Count Todayβs Requests | Counts how many generations today |
| π’ Set Daily Limit | Sets default limit (5) |
| π¦ Check Limit Exceeded? | If over limit β notify |
| π§ Enhance Prompt | Uses GPT-4o to improve user's prompt |
| π¨ Generate Image | Sends to AIMLAPI to generate |
| π Describe Image | Generates caption for the image |
| π€ Send Image to User | Sends back to Telegram |
| π Log Successful Generation | Writes to Google Sheets |
π Data Logging
Each successful generation is stored in Google Sheets:
| user_id | date | query | result_url | | -------- | ---- | ----- | ----------- |
π‘ Example Prompt Flow
-
User sends:
astronaut cat floating in space -
Bot replies:
> Hereβs your image: > A majestic feline astronaut drifts through a glittering cosmic void, its helmet reflecting starlight.
-
The image is sent with the caption
π Daily Limit
- Default:
5generations/day per Telegram user - You can change this in the
π’ Set Daily Limitnode
π§ͺ Testing
- Use
/execute workflowin Telegram β not "Execute Node" in editor - Log test results to sheet
- Add extra
Setnodes for debugging as needed
π Resources
- π AI/ML API Docs
- πΌοΈ flux-pro Model UI
n8n Workflow: Generate AI Images in Telegram (Placeholder)
This n8n workflow is a placeholder and does not contain any functional logic for generating AI images or interacting with GPT-4o or Flux Pro. It serves as a starting point or a template, demonstrating the inclusion of various core n8n nodes and app integrations.
Note: The workflow JSON provided is empty in terms of actual configuration (e.g., node parameters, expressions, connections between nodes). Therefore, this README describes the potential components based on the included nodes, rather than a fully functional workflow.
What it does (Potential Components)
Based on the included nodes, a complete workflow might involve:
- Receiving Telegram Messages: A
Telegram Triggernode would listen for incoming messages in a Telegram chat. - Processing Data:
Edit Fields (Set)nodes could be used to manipulate or extract data from the incoming Telegram message. - Conditional Logic: An
Ifnode would enable branching logic, allowing different actions based on conditions (e.g., if a message contains a specific keyword). - Data Aggregation: An
Aggregatenode could combine data from multiple sources or process items in batches. - Interacting with Google Sheets: A
Google Sheetsnode could be used to read from or write data to a Google Sheet, potentially for logging requests or storing user preferences. - Making HTTP Requests: An
HTTP Requestnode would be crucial for interacting with external APIs, such as an AI image generation service (e.g., DALL-E, Midjourney, Stable Diffusion) or a large language model (e.g., GPT-4o). - Sending Telegram Responses: A
Telegramnode would be used to send messages or images back to the user in Telegram. - Documentation:
Sticky Notenodes are present for adding comments and explanations within the workflow.
Prerequisites/Requirements
To make this workflow functional for its intended purpose (generating AI images in Telegram with GPT-4o enhancement and Flux Pro), you would typically need:
- n8n Instance: A running n8n instance.
- Telegram Bot Token: A Telegram Bot token configured as a credential in n8n.
- AI Image Generation API Key: An API key for an AI image generation service (e.g., OpenAI DALL-E, Midjourney API, Stability AI API).
- Large Language Model API Key: An API key for a large language model like OpenAI (for GPT-4o).
- Google Account: If using Google Sheets, a Google account with access to the target spreadsheet, configured as a credential in n8n.
- Flux Pro Account/API (Hypothetical): If "Flux Pro" refers to a specific service, its corresponding API key or credentials would be needed.
Setup/Usage
- Import the Workflow: Download the JSON file and import it into your n8n instance.
- Configure Telegram Trigger:
- Add your Telegram Bot credential to the
Telegram Triggernode. - Activate the webhook for the trigger.
- Add your Telegram Bot credential to the
- Configure Google Sheets (if used):
- Add your Google Sheets credential to the
Google Sheetsnode. - Specify the Spreadsheet ID and other relevant details.
- Add your Google Sheets credential to the
- Configure HTTP Request for AI Services:
- Add credentials for your AI image generation API and LLM API (e.g., OpenAI API Key).
- Configure the
HTTP Requestnodes with the correct API endpoints, headers (including API keys), and request bodies to interact with the AI services. This would involve sending prompts to GPT-4o and then feeding the generated descriptions to an image generation API.
- Configure Telegram Node for Responses:
- Add your Telegram Bot credential to the
Telegramnode. - Configure the message or image to be sent back to the user, referencing the output from the AI image generation.
- Add your Telegram Bot credential to the
- Develop Logic: The current workflow is a skeleton. You will need to:
- Connect the nodes to create a logical flow.
- Add expressions and parameters to the nodes to extract user input, formulate AI prompts, and process responses.
- Implement the specific logic for GPT-4o enhancement (e.g., using GPT-4o to refine user prompts before sending to an image generator).
- Implement logic for "Flux Pro" if it's an external service.
- Activate the Workflow: Once configured, activate the workflow to start processing Telegram messages.
Related Templates
Generate song lyrics and music from text prompts using OpenAI and Fal.ai Minimax
Spark your creativity instantly in any chatβturn a simple prompt like "heartbreak ballad" into original, full-length lyrics and a professional AI-generated music track, all without leaving your conversation. π What This Template Does This chat-triggered workflow harnesses AI to generate detailed, genre-matched song lyrics (at least 600 characters) from user messages, then queues them for music synthesis via Fal.ai's minimax-music model. It polls asynchronously until the track is ready, delivering lyrics and audio URL back in chat. Crafts original, structured lyrics with verses, choruses, and bridges using OpenAI Submits to Fal.ai for melody, instrumentation, and vocals aligned to the style Handles long-running generations with smart looping and status checks Returns complete song package (lyrics + audio link) for seamless sharing π§ Prerequisites n8n account (self-hosted or cloud with chat integration enabled) OpenAI account with API access for GPT models Fal.ai account for AI music generation π Required Credentials OpenAI API Setup Go to platform.openai.com β API keys (sidebar) Click "Create new secret key" β Name it (e.g., "n8n Songwriter") Copy the key and add to n8n as "OpenAI API" credential type Test by sending a simple chat completion request Fal.ai HTTP Header Auth Setup Sign up at fal.ai β Dashboard β API Keys Generate a new API key β Copy it In n8n, create "HTTP Header Auth" credential: Name="Fal.ai", Header Name="Authorization", Header Value="Key [Your API Key]" Test with a simple GET to their queue endpoint (e.g., /status) βοΈ Configuration Steps Import the workflow JSON into your n8n instance Assign OpenAI API credentials to the "OpenAI Chat Model" node Assign Fal.ai HTTP Header Auth to the "Generate Music Track", "Check Generation Status", and "Fetch Final Result" nodes Activate the workflowβchat trigger will appear in your n8n chat interface Test by messaging: "Create an upbeat pop song about road trips" π― Use Cases Content Creators: YouTubers generating custom jingles for videos on the fly, streamlining production from idea to audio export Educators: Music teachers using chat prompts to create era-specific folk tunes for classroom discussions, fostering interactive learning Gift Personalization: Friends crafting anniversary R&B tracks from shared memories via quick chats, delivering emotional audio surprises Artist Brainstorming: Songwriters prototyping hip-hop beats in real-time during sessions, accelerating collaboration and iteration β οΈ Troubleshooting Invalid JSON from AI Agent: Ensure the system prompt stresses valid JSON; test the agent standalone with a sample query Music Generation Fails (401/403): Verify Fal.ai API key has minimax-music access; check usage quotas in dashboard Status Polling Loops Indefinitely: Bump wait time to 45-60s for complex tracks; inspect fal.ai queue logs for bottlenecks Lyrics Under 600 Characters: Tweak agent prompt to enforce fuller structures like [V1][C][V2][B][C]; verify output length in executions
AI-powered code review with linting, red-marked corrections in Google Sheets & Slack
Advanced Code Review Automation (AI + Lint + Slack) Whoβs it for For software engineers, QA teams, and tech leads who want to automate intelligent code reviews with both AI-driven suggestions and rule-based linting β all managed in Google Sheets with instant Slack summaries. How it works This workflow performs a two-layer review system: Lint Check: Runs a lightweight static analysis to find common issues (e.g., use of var, console.log, unbalanced braces). AI Review: Sends valid code to Gemini AI, which provides human-like review feedback with severity classification (Critical, Major, Minor) and visual highlights (red/orange tags). Formatter: Combines lint and AI results, calculating an overall score (0β10). Aggregator: Summarizes results for quick comparison. Google Sheets Writer: Appends results to your review log. Slack Notification: Posts a concise summary (e.g., number of issues and average score) to your teamβs channel. How to set up Connect Google Sheets and Slack credentials in n8n. Replace placeholders (<YOURSPREADSHEETID>, <YOURSHEETGIDORNAME>, <YOURSLACKCHANNEL_ID>). Adjust the AI review prompt or lint rules as needed. Activate the workflow β reviews will start automatically whenever new code is added to the sheet. Requirements Google Sheets and Slack integrations enabled A configured AI node (Gemini, OpenAI, or compatible) Proper permissions to write to your target Google Sheet How to customize Add more linting rules (naming conventions, spacing, forbidden APIs) Extend the AI prompt for project-specific guidelines Customize the Slack message formatting Export analytics to a dashboard (e.g., Notion or Data Studio) Why itβs valuable This workflow brings realistic, team-oriented AI-assisted code review to n8n β combining the speed of automated linting with the nuance of human-style feedback. It saves time, improves code quality, and keeps your teamβs review history transparent and centralized.
Auto-reply & create Linear tickets from Gmail with GPT-5, gotoHuman & human review
This workflow automatically classifies every new email from your linked mailbox, drafts a personalized reply, and creates Linear tickets for bugs or feature requests. It uses a human-in-the-loop with gotoHuman and continuously improves itself by learning from approved examples. How it works The workflow triggers on every new email from your linked mailbox. Self-learning Email Classifier: an AI model categorizes the email into defined categories (e.g., Bug Report, Feature Request, Sales Opportunity, etc.). It fetches previously approved classification examples from gotoHuman to refine decisions. Self-learning Email Writer: the AI drafts a reply to the email. It learns over time by using previously approved replies from gotoHuman, with per-classification context to tailor tone and style (e.g., different style for sales vs. bug reports). Human Review in gotoHuman: review the classification and the drafted reply. Drafts can be edited or retried. Approved values are used to train the self-learning agents. Send approved Reply: the approved response is sent as a reply to the email thread. Create ticket: if the classification is Bug or Feature Request, a ticket is created by another AI agent in Linear. Human Review in gotoHuman: How to set up Most importantly, install the gotoHuman node before importing this template! (Just add the node to a blank canvas before importing) Set up credentials for gotoHuman, OpenAI, your email provider (e.g. Gmail), and Linear. In gotoHuman, select and create the pre-built review template "Support email agent" or import the ID: 6fzuCJlFYJtlu9mGYcVT. Select this template in the gotoHuman node. In the "gotoHuman: Fetch approved examples" http nodes you need to add your formId. It is the ID of the review template that you just created/imported in gotoHuman. Requirements gotoHuman (human supervision, memory for self-learning) OpenAI (classification, drafting) Gmail or your preferred email provider (for email trigger+replies) Linear (ticketing) How to customize Expand or refine the categories used by the classifier. Update the prompt to reflect your own taxonomy. Filter fetched training data from gotoHuman by reviewer so the writer adapts to their personalized tone and preferences. Add more context to the AI email writer (calendar events, FAQs, product docs) to improve reply quality.