I want to discuss a task or project
Done! We will get back to you within one business day
Something went wrong. Please try again
Alexander Start:Duck 🦢
@olga_startduck
Write to Telegram
Назад
1k+ участников
Вступить в Telegram
n8n
11.09.2025

Pocket Photo Editor - Pocket AI photo editor on Telegram

Process description

This automation is a full-fledged AI-powered photo editor that works via the Telegram interface. The system takes photos and text commands from users, uses an intelligent AI agent to understand queries, performs various operations with images (editing, merging, searching), integrates with Google Drive to store files, and provides a personalized experience through dialogue memory.

API keys and services:

  1. Telegram Bot API - for the user interface (bot: Photo editing 2)
  2. OpenAI API Key - for AI agent (gpt-4.1-mini)
  3. Google Gemini 2.5 Flash API - for editing images
  4. Google Drive OAuth2 - for storing and searching files (account 13)
  5. Sub-workflows - Edit Image and Combine Image for specific operations

System architecture by blocks

SECTION 1: MESSAGE PROCESSING

1.1 Telegram Trigger — Monitoring messages

Purpose: Tracks all incoming messages from users

1.2 Switch - Message type classification

Purpose: Separates messages into photos and text for different processing

Switch conditions:

  • Output 0 “Photo”: $json.message.photo exists (there is a photo)
  • Output 1 “Text”: $json.message.text exists (there is text)

SECTION 2: PHOTO PROCESSING

2.1 Download File - Download photos from Telegram

Purpose: Downloads a photo submitted by the user

Settings:

  • Resource: file
  • File ID: {{$json.message.photo [3] .file_id}} (high res)
  • Credentials: Photo editing 2

Why index [3]: Telegram provides several photo sizes; the index [3] usually corresponds to the highest resolution.

2.2 Upload file - Save to Google Drive

Purpose: Automatically saves uploaded photos to Google Drive

Settings:

  • Name: {{$now.format ('yyyy-mm-dd')}} (date name)
  • Drive ID: My Drive
  • Folder ID: your folder id
  • Credentials: your credentials

2.3 Set Text - Preparing the context

Purpose: Generates a message for the AI agent with information about the downloaded file

Message text:

A user just sent a photo. Here's the Google Drive ID for this file: {{$json.id}}

SECTION 3: AI AGENT - SYSTEM CORE

3.1 Photoshop Agent — Main AI Assistant

Purpose: An intelligent agent that understands user requests and performs operations with images

Connected components:

  • OpenAI Chat Model (gpt-4.1-mini) - main language model
  • Simple Memory - memory of conversations with each user
  • Change Name - file name change tool
  • Combine Images - image merging tool
  • Search Raw Files - search for files uploaded by the user
  • Search AI Images - search for AI-generated images
  • Edit Image - image editing tool

System prompt:

# Review

You're a personal assistant. Your job is to use the tools available to you to help the user fulfill their request.

## Tools

Change Name — use this tool to change the photo's name. To change the name, you must know the file ID.

Combine Images — use this tool to combine two images.

Search Raw Files — Use this tool to find image files that a user has previously uploaded.

Search AI Images — use this tool to search for AI-generated images that you helped the user create.

Edit Image — use this tool to edit an image.

## Instructions

1) If a user sends a photo, ask them what to call that photo by saying, “How do you want me to name this photo on your Google Drive?” Then, when he answers, change the name using the “Change Name” tool.

3.2 Simple Memory - Personalized memory

Purpose: Saves the context of the conversation for each user separately

Settings:

  • Session ID Type: CustomKey
  • Session Key: {{$ ('Telegram Trigger') .item.json.message.chat.id}} (unique chat ID)
  • Context Window Length: 10 (last 10 posts)

Benefits: Each user has their own story, AI remembers previous operations and can link to previously processed images.

SECTION 4: AI AGENT TOOLS

4.1 Change Name - Rename files

Purpose: Allows AI to change file names in Google Drive

Google Drive Tool settings:

  • Operation: update
  • File ID: {{$fromai ('File_to_update')}} (receives from AI)
  • New Updated File Name: {{$fromAI ('New_Updated_File_Name')}} (receives from AI)

4.2 Search Raw Files - Search for user files

Purpose: Searches for files that the user has previously uploaded

Settings:

  • Resource: FileFolder
  • Return All: true
  • Folder ID: your folder id
  • What To Search: files
  • Options Fields: [id, name, WebViewLink]

4.3 Search AI Images — Search for AI-generated images

Purpose: Searches for images created with AI tools

Settings: Similar to Search Raw Files, but with a focus on AI-generated content.

4.4 Edit Image — Editing images

Purpose: Calls sub-workflow to edit images

Input parameters for sub-workflow:

  • ImageTitle: The name of the new image
  • ImagePrompt: Editing instructions
  • ImageID: ID of the image being edited

4.5 Combine Images - Combine images

Purpose: Calls sub-workflow to combine two images

Input parameters for sub-workflow:

  • prompt: Merging instructions
  • image1: First image ID
  • image2: Second image ID
  • ImageTitle: Result name

SECTION 5: SUB-WORKFLOWS

5.1 Edit Image Sub-Workflow

The process:

The principle is the same as in Photo AD System automation

  1. When Executed by Another Workflow - gets parameters
  2. Download file - downloads the original image from Google Drive
  3. Extract from File - converts to Base64
  4. generate_image - edits via Gemini 2.5 Flash
  5. Convert to File - converts the result back
  6. Upload file - saves to Google Drive
  7. Result - returns a link to the result

Prompt for Gemini:

Edit the photo by this instruction: {{ImagePrompt}}.

The edited image must be in high quality!

And do not make any comments just send the edited photo.

5.2 Combine Image Sub-Workflow

The process:

The principle is the same as in the tool before

  1. Edit Fields - creates an array of two image IDs
  2. Split Out - separates for individual processing
  3. Download file - downloads both images
  4. Extract from File - converts to Base64
  5. Aggregate - combines data for a single request
  6. generate_image - combines via Gemini with two images
  7. Convert to File + Upload file - saves the result

SECTION 6: ANSWERS TO THE USER

6.1 Respond - Sending Responses

Purpose: Sends the AI agent's responses back to the user

Settings:

  • Chat ID: {{$ ('Telegram Trigger') .item.json.message.chat.id}}
  • Text: {{$json.output}} (response from an AI agent)
  • Additional Fields:
    • AppendAttribution: false
    • parse_mode: HTML (formatting support)

Node connection diagram

Main stream:

  1. Telegram TriggerSwitch

Photo stream:

  1. Switch (Photo) → Download FileUpload fileSet TextPhotoshop Agent

Text flow:

  1. Switch (Text) → Photoshop Agent

The final answer is:

  1. Photoshop AgentRespond

AI connections:

  • OpenAI Chat Model + Simple MemoryPhotoshop Agent
  • Change Name + Search Raw Files + Search AI Images + Edit Image + Combine ImagesPhotoshop Agent

Required services and their settings

Telegram Bot setup:

  • Create a bot via @BotFather
  • Get the token for “Photo editing 2"
  • Set up rights to receive photos and messages

Setting up Google Drive:

  • Create a “Photos to automate” folder
  • Folder ID: 12rfff5hacwvsde2nlcyzw7c2xje8avuj
  • Set up OAuth2 for Google Drive account 13
  • Permissions to read, write and modify files

Setting up AI services:

  • OpenAI API for gpt-4.1-mini (main agent)
  • Google Gemini 2.5 Flash for image editing
  • Setting up billing for both services

Creating Sub-Workflows:

  • Edit Image
  • Combine Image
  • Set up Execute Workflow Trigger for everyone

System capabilities

Image operations:

  • Auto save photos in Google Drive
  • Editing images by text instructions
  • Combine two images into one
  • Rename files at the user's request
  • Search for previously downloaded files

AI capabilities:

  • Understanding natural language - teams in Russian
  • Contextual memory - remembers previous operations
  • Intelligent tool selection - determines the required operation by itself
  • Personalization - separate memory for each user

Integrations:

  • Telegram interface - easy to use via messenger
  • Google Drive storage - secure cloud storage
  • AI processing - modern editing technologies
  • Modular architecture - easy to add new features

Use cases

Scenario 1: Uploading and naming photos

👤 User: [sends photo]

🤖 AI: How do you want me to name this photo on your Google Drive?

👤 User: “Vacation in Paris”

🤖 AI: Done! Photo saved as “Vacation in Paris”

Scenario 2: Editing an image

👤 User: Change the sky color to sunset in my last photo

🤖 AI: [searches for the latest photo, edits via Gemini]

🤖 AI: Image edited! Here's a link: [Google Drive link]

Scenario 3: Combining images

👤 User: Combine “Vacation in Paris” and “Eiffel Tower” photos

🤖 AI: [finds both images, combines]

🤖 AI: Images are combined! A new “Paris collage” image has been created

System application

For personal use:

  • Quick editing photos directly on Telegram
  • Organizing a photo archive with smart names
  • Creative experiments with image merging
  • Mobile access to advanced AI tools

For small businesses:

  • Product photo processing for an online store
  • Creating collages for social media
  • Fast retouching without Photoshop skills
  • Teamwork via shared Google Drive

For content creators:

  • Content processing on the go
  • Experimenting with visuals for social media
  • Creating unique images via AI
  • Archiving works with a convenient organization

The result of the system

What happens is:

  • Pocket AI photo editor voice-controlled
  • Intelligent cloud storage images
  • Personalized assistant with dialogue memory
  • Modular system to expand functions
  • Simple interface for complex operations

Performance metrics:

  • Processing time: 30-60 seconds per surgery
  • Editing quality: professional AI quality
  • Usability: messenger interface
  • Personalization: individual memory for each user

Advantages over traditional editors:

  • Accessibility - works on any Telegram device
  • Simplicity - natural language commands instead of a complex interface
  • AI help - understands intentions without precise instructions
  • Cloudiness - all files are automatically saved and synced
  • memento - remembers previous operations and can refer to them

ROI and practical value:

  • Save on software - replacement of expensive graphic editors
  • Workflow acceleration - operations in seconds instead of minutes
  • Lowering the entry threshold - you don't need graphics skills
  • Mobility - full editing on a smartphone

This system turns Telegram into a powerful AI-powered photo editor with a personal assistant and cloud storage!

Читайте также

No items found.

write to us and we will show you the way to efficiency