Context

A personal productivity ecosystem requiring an automated Telegram interface for multi-modal processing. Users interact via a single chat window for natural text dialog and specialized image creation requests.

Problem

Solution

Built an intelligent multi-branch automated system in n8n:

Process • Routing Logic & Data Cleaning: ◦ Configured string condition parameters inside the router to parse insta and fb keys regardless of casing. ◦ Implemented regex strip expressions (.replace(/insta/gi, '').trim()) inside image generation nodes to ensure clean prompt inputs for DALL-E. • API Integrations: ◦ Connected Telegram Trigger and Telegram API nodes to handle bidirectional payload transmission. ◦ Integrated OpenAI Chat Model (gpt-4o-mini) for context-aware conversational text responses. ◦ Integrated OpenAI Image Generation (DALL-E) with custom resolution handling (vertical 1024x1536 vs horizontal 1536x1024). • n8n Workflow Architecture: ◦ Branch 1 (Welcome): Telegram Trigger $\rightarrow$ CheckCommand (/start) $\rightarrow$ Send a welcome message (with user first-name fallback logic). ◦ Branch 2 (Image Generation): Telegram Trigger $\rightarrow$ CheckCommand (insta / fb) $\rightarrow$ OpenAI Image Generation $\rightarrow$ Send Photo Message (Binary Property: data). ◦ Branch 3 (Text Dialogue): Telegram Trigger $\rightarrow$ PreProcessing $\rightarrow$ OpenAI Chat Model $\rightarrow$ Send Text Message.

Results