This template is ideal for:
Content creators and marketers who want to generate visual and written content quickly
Telegram bot developers looking for real-world AI integration
Educators or students automating content workflows
Anyone managing content pipelines using Google Sheets
Trigger Telegram Message: Listens for new messages or button clicks via Telegram
Classify Telegram Input: JavaScript logic to classify input as /start, /help, normal text, or callback
Switch Input Type: Directs the flow based on the classification
Send Main Menu to User: Shows "Generate Image", "Blog Article", "Help" options
Switch Callback Selection: Routes based on button pressed (image, blog, or help)
Send Help Instructions: Sends markdown instructions on how to use the bot
Validate Command Format: Ensures input starts with image or blog
Notify Invalid Input Format: If validation fails, informs user of correct format
Prompt User for Image Description
→ When user clicks Generate Image
Detect Text-Based Input Type
→ Detects if text is image or blog
Switch Text Command Type
→ Directs whether to generate image or article
Show Typing for Image Generation
→ Sends "uploading photo..." typing status
Build Image Generation URL
→ Constructs Pollinations API image URL from prompt
Download AI Image
→ Makes HTTP request to get the image
Send Image Result to Telegram
→ Sends image to user via Telegram
Log Image Prompt to Google Sheets
→ Logs prompt, image URL, date, and user ID
Upload Image to Google Drive
→ Saves image to Google Drive folder
Prompt User for Blog Title
→ When user clicks Blog Article
Store Blog Prompt
→ Saves prompt for later use
Log Blog Prompt to Google Sheets
→ Writes title + user ID to Google Sheets
Send Article Style Options
→ Offers: Formal, Casual, or News style
Store Selected Article Style
→ Updates row with chosen style in Google Sheets
Fetch Last User Prompt
→ Finds the latest prompt submitted by this user
Extract Last Blog Prompt
→ Extracts row for use in AI request
Gemini Chat Wrapper
→ Handles input into LangChain node for AI processing
Generate Article with Gemini
→ Calls Gemini to create 3-paragraph blog post
Parse Gemini Response
→ Parses JSON string to extract title and content
Send Article to Telegram
→ Sends blog article result back to user
Log Final Article to Google Sheets
→ Updates row with final content and timestamp
Clone the workflow and import it into your n8n instance
Set credentials:
Replace:
Deploy and send /start in your Telegram bot
Edit the Gemini prompt to adjust article length or tone
Add extra style buttons like "SEO", "Story", "Academic"
Add image post-processing (e.g. compression, renaming)
Add error catching logic (e.g. if Pollinations image fails)
Store images with filenames based on timestamp/user
Use n8n credentials for all tokens (Telegram, Gemini, Sheets, Drive)
Never hardcode your token inside HTTP nodes
Do not expose real Google Sheet or Drive links in shared version
Use Set node to collect all editable variables (like folder ID, sheet name)