What This Workflow Does
This n8n workflow creates a fully automated Telegram bot that generates AI images on demand while managing a credit-based payment system. Users purchase credits (via PIX or other payment methods), then spend those credits to generate images through simple Telegram commands. The system automatically tracks credit balances, processes payments, generates images using AI models, stores results in Amazon S3, and delivers the final images back to users - all without manual intervention.
The solution solves three major challenges for AI service providers: monetization through a flexible credit system, automated payment processing, and secure storage/retrieval of generated content. It's particularly valuable for businesses offering AI art services, marketing agencies needing custom visuals, or entrepreneurs creating passive income streams through automated digital products.
How It Works
1. User initiates request via Telegram
Users interact with your branded Telegram bot using simple commands like "/generate" followed by their prompt. The bot provides clear instructions and menu options for different image styles and sizes (which can consume different credit amounts).
2. Credit verification
The system checks the user's available credit balance before processing. If insufficient credits are available, it prompts the user to purchase more through integrated payment options. Admins can set different credit costs based on image resolution or generation parameters.
3. AI image generation
Once credits are verified, the workflow triggers your preferred AI image generation API (like Stable Diffusion, DALL-E, or Midjourney through unofficial APIs). The system passes the user's prompt and selected parameters to create high-quality, customized images.
4. Secure S3 storage
All generated images are automatically uploaded to Amazon S3 with proper organization (user folders, timestamps, etc.). This provides reliable cloud storage with built-in redundancy and the ability to serve images through CDN for fast delivery worldwide.
5. Delivery and credit deduction
The final image is sent back to the user through Telegram, with appropriate credits deducted from their balance. The system logs all transactions for reporting and provides users with their updated credit balance after each generation.
Pro tip: Configure different credit costs for various image sizes and qualities to create tiered pricing. For example, charge 1 credit for 512x512 images and 3 credits for 1024x1024 HD generations.
Who This Is For
This workflow is ideal for:
- AI art service providers wanting to automate their delivery
- Digital marketing agencies offering custom visuals to clients
- Content creators needing automated image generation for social media
- Entrepreneurs building passive income through automated digital products
- Brazilian businesses leveraging PIX payments for local customers
What You'll Need
- n8n instance (self-hosted or cloud)
- Telegram bot token from @BotFather
- AI image generation API access (Stable Diffusion, DALL-E, etc.)
- Amazon S3 bucket for storage
- Payment processor account (for PIX or other methods)
- WaveSpeed or similar credit tracking system
Quick Setup Guide
- Download the JSON template file
- Import into your n8n instance
- Configure Telegram bot credentials
- Set up your AI image generation API keys
- Connect your Amazon S3 storage
- Integrate your payment processor
- Adjust credit values and pricing tiers as needed
- Test with your Telegram account before going live
Key Benefits
Automated monetization - The credit system handles all payment processing and access control automatically, creating hands-off revenue from your AI service.
Scalable infrastructure - Amazon S3 provides unlimited storage that grows with your user base, while Telegram handles all messaging infrastructure.
24/7 availability - Your AI image generation service operates around the clock without staff oversight, serving global customers in their timezones.
Reduced operational costs - Eliminate manual image generation, payment processing, and delivery tasks that would otherwise require staff time.
Brazilian market access - PIX integration makes it easy to serve the lucrative Brazilian market where credit cards have lower penetration.