No Products in the Cart
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.
flux-pro
model (AIMLAPI)/newbot
β Choose a name and usernameTelegram API
: Use your bot tokenGoogle Sheets
: Set up via OAuth2 or Service AccountAI/ML API
: Set up with your API key from aimlapi.com
Image bot usage statistic
)Sheet1
user_id | date | query | result_url
Open the n8n editor and import the JSON
Update:
Node | Function |
---|---|
π© Receive Telegram Message
|
Triggered by user message |
π Fetch Usage Logs
|
Read 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
|
Send back to Telegram |
π Log Successful Generation
|
Writes to Google Sheets |
Each successful generation is stored in Google Sheets:
user_id | dates | query | result_url |
---|
User sends:
astronaut cat floating in space
Bot replies:
Here's your image:
A majestic feline astronaut drifts through a glittering cosmic void, his helmet reflecting starlight.
The image is sent with the caption
5
generations/day for Telegram userπ’ Set Daily Limit
node/execute workflow
in Telegram β not "Execute Node" in editorSet
nodes for debugging as needed