Skip to main content

Generate images with Pollinations & blog articles with Gemini 2.5 from Telegram

Workflow preview

Workflow preview
100%
Generate images with Pollinations & blog articles with Gemini 2.5 from Telegram preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

This n8n workflow is a Telegram bot that allows users to either: Generate AI images using Pollinations API, or Generate blog articles using Gemini AI Users simply type image your prompt or blog you...

Best for

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

Tools used

@n8n/n8n-nodes-langchain.lmchatgooglegemini, n8n-nodes-base.telegramtrigger, n8n-nodes-base.code, n8n-nodes-base.switch, n8n-nodes-base.telegram, n8n-nodes-base.if, n8n-nodes-base.set, n8n-nodes-base.httprequest

Source and attribution

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

Original n8n.io source

1.1 Workflow description

Title
Generate images with Pollinations & blog articles with Gemini 2.5 from Telegram
Workflow name
Generate images with Pollinations & blog articles with Gemini 2.5 from Telegram

This n8n workflow is a Telegram bot that allows users to either:

  • Generate AI images using Pollinations API, or
  • Generate blog articles using Gemini AI

Users simply type image your prompt or blog your title, and the bot responds with either an AI-generated image or article.

Who's it for

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

What it does / How it works

Telegram Interaction

  • 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

Menu & Help

  • 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

Input Validation

  • Validate Command Format: Ensures input starts with image or blog

  • Notify Invalid Input Format: If validation fails, informs user of correct format

Image Generator

  • 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

Blog Article Generator

  • 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

Requirements

  • Telegram bot (via @BotFather)
  • Pollinations API (free and public endpoint)
  • Google Sheets & Drive (OAuth credential setup in n8n)
  • Google Gemini / PaLM API key via LangChain
  • Self-hosted or cloud n8n setup

Setup Instructions

  • Clone the workflow and import it into your n8n instance

  • Set credentials:

    • Telegram API
    • Google Sheets OAuth
    • Google Drive OAuth
    • Gemini (via LangChain)
  • Replace:

    • Sheet ID with your own Google Sheet
    • Folder ID on Google Drive
    • chat_id placeholders if needed (use expressions instead)
  • Deploy and send /start in your Telegram bot

🔧 Customization Tips

  • 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

Security Considerations

  • 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)

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 - Gemini Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatGoogleGemini - lmChatGoogleGemini
Config choices
Version 1

Block 2 - Trigger Telegram Message

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

Block 3 - Classify Telegram Input

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 4 - Switch Input Type

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

Block 5 - Send Main Menu to User

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

Block 6 - Switch Callback Selection

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

Block 7 - Prompt User for Image Description

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

Block 8 - Prompt User for Blog Title

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

Block 9 - Validate Command Format

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 10 - Detect Text-Based Input Type

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

Block 11 - Switch Text Command Type

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

Block 12 - Build Image Generation URL

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 13 - Download AI Image

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

Block 14 - Send Image Result to Telegram

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

Block 15 - Log Image Prompt to Google Sheets

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.5

Block 16 - Upload Image to Google Drive

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 17 - Notify Invalid Input Format

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

Block 18 - Show Typing for Article Response

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

Block 19 - Show Typing for Image Generation

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

Block 20 - Send Help Instructions

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

Block 21 - Send Article Style Options

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

Block 22 - Store Blog Prompt

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

Block 23 - Log Blog Prompt to Google Sheets

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.5

Block 24 - Store Selected Article Style

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.5

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

3. Summary Table

Workflow Generate images with Pollinations & blog articles with Gemini 2.5 from Telegram
Complexity advanced
Nodes 34
Categories Content Creation, Multimodal AI
Author Fahmi Oktafian
Published 10 Jul 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/5844/5844.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 images with Pollinations & blog articles with Gemini 2.5 from Telegram do?

This n8n workflow is a Telegram bot that allows users to either: Generate AI images using Pollinations API, or Generate blog articles using Gemini AI Users simply type image your prompt or blog you...

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, Multimodal AI use case.