Generate images via Telegram using an AI bot with a credit system and S3 storage A complete, production-ready Telegram bot for AI-powered image generation and editing, featuring a built-in credit system, payment integration, and cloud storage. --- โจ Features ๐จ AI Image Generation - Text-to-Image: Generate stunning images from text prompts using the Nano Banana Pro Ultra model via WaveSpeed API - Image-to-Image Editing: Edit existing images by sending a photo with a caption describing the desired

Generate images via Telegram using an AI bot with a credit system and S3 storage A complete, production-ready Telegram bot for AI-powered image generation and editing, featuring a built-in credit system, payment integration, and cloud storage. --- โจ Features ๐จ AI Image Generation - Text-to-Image: Generate stunning images from text prompts using the Nano Banana Pro Ultra model via WaveSpeed API - Image-to-Image Editing: Edit existing images by sending a photo with a caption describing the desired changes - Multiple Resolutions: Support for both 4K and 8K output quality - Flexible Aspect Ratios: Choose from 10 different aspect ratios (1:1, 3:2, 2:3, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9) ๐ณ Credit Management System - Per-generation billing: Different costs for 4K vs 8K resolution - Balance tracking: Real-time credit balance displayed to users - Initial credits: New users receive starter credits automatically - Insufficient balance handling: Graceful messages when credits run out Here's the adjusted payment section: --- ๐ฐ Payment Integration (Mercado Pago PIX) > About PIX: PIX is Brazil's instant payment system, launched by the Central Bank of Brazil in 2020. It allows instant money transfers 24/7, 365 days a year, using QR codes or copy-paste codes. It has become the most popular payment method in Brazil due to its speed and zero fees for individuals. This workflow includes a fully integrated PIX payment flow as a reference implementation. You can adapt it to your local payment provider. Features: - Multiple deposit options: Pre-configured credit packages (R$ 3, R$ 6, R$ 10) - QR Code generation: Automatic PIX QR code sent directly to users via Telegram - Copy-paste code: PIX code provided for manual payment - Webhook confirmation: Real-time payment status updates via Mercado Pago webhooks - Auto credit top-up: Credits added automatically upon payment approval - Payment status handling: Supports approved, pending, and rejected states > ๐ก Tip: To adapt this for other regions, replace the Mercado Pago nodes with your preferred payment gateway (Stripe, PayPal, etc.) while keeping the same credit update logic. --- โ๏ธ User Configuration - Resolution settings: Users can set their preferred default resolution - Aspect ratio preferences: Save preferred aspect ratio for future generations - Custom default prompts: Set a default prompt that's automatically appended to all generations - Persistent settings: All preferences stored in n8n Data Tables ๐ฆ Cloud Storage (S3/MinIO) - Automatic upload: Generated images are automatically uploaded to S3-compatible storage - Persistent URLs: Images remain accessible via permanent links - Edit from storage: Reference previously uploaded images for editing --- ๐ ๏ธ Tech Stack | Component | Technology | |-----------|------------| | Bot Platform | Telegram Bot API | | AI Generation | WaveSpeed API (Nano Banana Pro) | | Storage | S3-compatible (MinIO/AWS S3) | | Database | n8n Data Tables | | Payments | Mercado Pago PIX | | Automation | n8n | --- ๐ Prerequisites Before using this workflow, you'll need: 1. Telegram Bot Token - Create a bot via @BotFather 2. WaveSpeed API Key - Sign up at WaveSpeed 3. S3-compatible Storage - MinIO, AWS S3, or any S3-compatible service 4. Mercado Pago Account (optional) - For payment integration 5. n8n Data Table - Create a table with the required schema --- ๐ Data Table Schema Create a Data Table with the following columns: | Column | Type | Description | |--------|------|-------------| | chatid | String | Telegram chat ID (primary key) | | username | String | Telegram username | | status | String | Current user state in the flow | | credits | String | User's credit balance | | resolution | String | Preferred resolution (4k/8k) | | aspectratio | String | Preferred aspect ratio | | userdefaultprompt | String | Custom default prompt | | numberimages | Number | Total images generated | | numbervideos | Number | Total videos generated | | demosended | Boolean | Welcome demo sent flag | --- โก Quick Setup 1. Import the workflow into your n8n instance 2. Configure the Global Environment node with your settings: - botName: Your bot's display name - botToken: Your Telegram bot token - dataTableId: Your n8n Data Table ID - bucketName: Your S3 bucket name - initialCredits: Credits given to new users - generateImageCost4k: Cost per 4K image - generateImageCost8k: Cost per 8K image 3. Set up credentials: - Telegram API credentials - WaveSpeed API credentials - S3 credentials - Mercado Pago credentials (if using payments) 4. Activate the workflow --- ๐ฎ Bot Commands | Command | Description | |---------|-------------| | /start | Initialize bot and receive welcome message | | menu | Return to main menu | | config | Open settings menu | | Any text | Generate image from prompt (when in generation mode) | | Photo + caption | Edit the photo based on the caption | --- ๐ Workflow Flow --- ๐ Notes - The workflow uses polling to check generation status - WaveSpeed processes may take up to 1 minute - Credits are deducted when the task is submitted and refunded if generation fails - All user states are managed through the Data Table for persistence across restarts --- ๐ License Free to use and modify. Attribution appreciated but not required. ---
Download the workflow JSON file after purchase.
Open n8n โ click the menu โ Import from File.
Select the downloaded JSON and import.
Set up credentials for each node that requires them.
Click Execute Workflow to test, then activate.
Setup guide included
Purchase to unlock the full step-by-step guide
No reviews yet
Be the first to buy and share your experience.
Leave a review
Sign in to share your experience with this workflow.
Create a free account to purchase workflows.
Need help setting this up?
Book a 3-hour live setup session with an Agility consultant.