Skip to main content

Generate AI images via Telegram with WaveSpeed, credit system, PIX and S3

Workflow preview

Workflow preview
100%
Generate AI images via Telegram with WaveSpeed, credit system, PIX and S3 preview
Open on n8n.io

1. Workflow Overview

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 credi...

Best for

  • Content Creation automation workflows
  • AI Chatbot automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.stickynote, n8n-nodes-wavespeed.wavespeedtasksubmit, n8n-nodes-base.telegram, n8n-nodes-base.datatable, n8n-nodes-base.switch, n8n-nodes-base.set, n8n-nodes-base.httprequest, n8n-nodes-base.s3

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Cleverton Ruppenthal.

Original n8n.io source

1.1 Workflow description

Title
Generate AI images via Telegram with WaveSpeed, credit system, PIX and S3
Workflow name
Generate AI images via Telegram with WaveSpeed, credit system, PIX and S3

๐Ÿค– 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
chat_id 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)
aspect_ratio String Preferred aspect ratio
user_default_prompt String Custom default prompt
number_images Number Total images generated
number_videos Number Total videos generated
demo_sended 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
  1. Set up credentials:
  • Telegram API credentials
  • WaveSpeed API credentials
  • S3 credentials
  • Mercado Pago credentials (if using payments)
  1. 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

User Message โ†’ Telegram Trigger โ†’ Route by Status
 โ†“
 โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
 โ†“ โ†“ โ†“
 New User Generate Image Edit Image
 โ†“ โ†“ โ†“
 Welcome Flow Check Credits Check Credits
 โ†“ โ†“ โ†“
 Create User Submit to WaveSpeed Upload to S3
 โ†“ โ†“ โ†“
 Show Menu Poll for Result Submit Edit
 โ†“ โ†“
 Download Image Poll for Result
 โ†“ โ†“
 Send to User โ†โ†โ†โ†โ†โ†โ†โ†โ†โ†โ†โ†โ†โ”˜

๐Ÿ“ 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.


1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Main Overview

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 2 - WaveSpeed text-to-image submit

Type / Role
n8n-nodes-wavespeed.waveSpeedTaskSubmit - waveSpeedTaskSubmit
Config choices
Version 1

Block 3 - newOptionAfterConfig

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 4 - sendOptionsWelcome

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 5 - welcomeMessage

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 6 - resolutionConfig

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 7 - aspectRatioConfig

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 8 - upsertStatusReturn

Type / Role
n8n-nodes-base.dataTable - dataTable
Config choices
Version 1

Block 9 - upsertStatusConfig

Type / Role
n8n-nodes-base.dataTable - dataTable
Config choices
Version 1

Block 10 - switchReturn/Config

Type / Role
n8n-nodes-base.switch - switch
Config choices
Version 3.4

Block 11 - switchMaster

Type / Role
n8n-nodes-base.switch - switch
Config choices
Version 3.3

Block 12 - getUser

Type / Role
n8n-nodes-base.dataTable - dataTable
Config choices
Version 1.1

Block 13 - updateUserFirstAccess

Type / Role
n8n-nodes-base.dataTable - dataTable
Config choices
Version 1.1

Block 14 - welcomeGenerateImage

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 15 - sendForceReply

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 16 - editImageOnReply

Type / Role
n8n-nodes-wavespeed.waveSpeedTaskSubmit - waveSpeedTaskSubmit
Config choices
Version 1

Block 17 - editFields

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 18 - messageType

Type / Role
n8n-nodes-base.switch - switch
Config choices
Version 3.2

Block 19 - getFilePath

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 20 - downloadImage

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 21 - uploadS3

Type / Role
n8n-nodes-base.s3 - s3
Config choices
Version 1

Block 22 - swtichW/WOCallback

Type / Role
n8n-nodes-base.switch - switch
Config choices
Version 3.4

Block 23 - upsertUserStatus

Type / Role
n8n-nodes-base.dataTable - dataTable
Config choices
Version 1

Block 24 - messageTypeGenerateImage

Type / Role
n8n-nodes-base.switch - switch
Config choices
Version 3.2

Showing the first 24 of 103 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Generate AI images via Telegram with WaveSpeed, credit system, PIX and S3
Complexity advanced
Nodes 103
Categories Content Creation, AI Chatbot
Author Cleverton Ruppenthal
Published 18 Jan 2026

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/12797/12797.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Generate AI images via Telegram with WaveSpeed, credit system, PIX and S3 do?

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 credi...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Content Creation, AI Chatbot use case.