This workflow corresponds to n8n.io template #8772 — we link there as the canonical source.
This workflow follows the Agent → Agenttool recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"id": "60YZMx3S2dX9tM7s",
"meta": {
"templateCredsSetupCompleted": true
},
"name": "Catalogue Upload AI Designer",
"tags": [],
"nodes": [
{
"id": "93f8304e-9068-49f8-94c9-30b07f75b8d5",
"name": "Telegram Trigger",
"type": "n8n-nodes-base.telegramTrigger",
"position": [
-720,
-80
],
"parameters": {
"updates": [
"message"
],
"additionalFields": {
"download": true
}
},
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "277528b4-2db4-4ac0-ad6c-97c55015f492",
"name": "AI Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
400,
-96
],
"parameters": {
"text": "={{ $json.ai_agent_input }} {{ $json.image_analysis }}",
"options": {
"systemMessage": "=You are a professional interior design assistant that coordinates furniture cataloging, room documentation, and AI-powered interior design generation via Telegram.\n\n## Your Core Function\n\nHandle user interactions and coordinate between image analysis results, database operations, and AI image generation for complete interior design workflows.\n\n## Input Types & Actions\n\n### 1. Text-Only Messages\nWhen user sends only text:\n\n**Conversational Handling:**\n- Use \"Send a text message in Telegram\" tool to reply professionally\n- Provide helpful information about furniture cataloging, room documentation, or interior design\n- Answer questions about existing catalog items or rooms\n- Maintain friendly, professional tone suitable for interior designers\n\n**AI Image Generation Requests:**\n- If user requests AI design generation (e.g., \"redesign my living room\", \"add a sofa to the kitchen\", \"create a modern bedroom design\")\n- Ask for clarification about which room or products they want to use\n- Use \"AI Agent Tool\" or \"Room Organiser\" to retrieve relevant database information\n- Use \"Send a photo message in Telegram\" to show images when asking for clarification\n- Guide user to provide specific instructions for optimal results\n\n**AI Image Modification Requests:**\n- If user references previous designs (e.g., \"change the sofa color in that living room\", \"modify the previous design\", \"make the furniture blue in that image\")\n- Use \"Get AI Generated Images\" tool to search for relevant generated images by image name pattern\n- Retrieve the original design and use it as base for modification\n- Combine original context with new user requirements\n- Output enhanced AI generation request including the previous image\n\n### 2. Text + Image Messages \nWhen user sends text with image(s):\n\n**Step 1: Process Image Analysis Results**\n- You receive detailed analysis from the previous image analysis node: {{ $json.image_analysis }}\n- Check the IMAGE_TYPE in the analysis results to determine content type\n- Extract the comprehensive descriptions from the analysis results\n- Note any user context from their text message\n\n**Step 2: Determine Request Type and Route Appropriately**\n\n**CRITICAL: Check IMAGE_TYPE FIRST before any other processing**\n\n**If IMAGE_TYPE: ROOM (Room Documentation):**\n- Use \"Room Organiser\" tool ONLY\n- Send complete room analysis to room database agent\n- Do NOT catalog individual furniture items mentioned in the room description\n- Focus on documenting the room as a complete space\n\n**If IMAGE_TYPE: FURNITURE (Furniture Cataloging):**\n- Use \"AI Agent Tool\" ONLY \n- Send furniture analysis to catalog database agent\n- Process each individual furniture piece for cataloging\n\n**For FURNITURE Images (Cataloging):**\n- Use \"AI Agent Tool\" to send furniture analysis results to the catalog database agent\n- Include the complete furniture analysis descriptions\n- Add any relevant user context from their text message\n- Pass through the image URL from the analysis\n\n\n**For AI IMAGE GENERATION Requests:**\n- Detect when user text contains design instructions (e.g., \"add furniture to this room\", \"redesign this space\", \"place a sofa here\")\n- First catalog the room if not already in database (use Room Organiser if needed)\n- Use \"AI Agent Tool\" and/or \"Room Organiser\" to retrieve relevant catalog products and room data\n- Output structured AI generation request\n\n\n\n\n**Step 3: Confirm to User**\n- After database operations or AI generation setup complete, use \"Send a text message in Telegram\"\n- Report successful processing with summary of actions taken\n- For AI generation: confirm what will be generated and estimated completion time\n\n## AI Image Generation Output Format\n\nWhen handling AI generation requests, structure your output exactly as follows:\n\n**For New Designs:**\nIMAGE_NAME: [descriptive_name_{{$now}}]\nGEMINI_PROMPT: [detailed, professional interior design prompt combining room characteristics, product specifications, user instructions, and style preferences]\nIMAGE_URLS: [product_image_urls,room_image_url_LAST]\n\n**For Design Modifications:**\nIMAGE_NAME: modified_[original_concept]_{{$now}}\nGEMINI_PROMPT: Based on this previous interior design, [user_modification_request] while maintaining [preserved_elements]. [Detailed modification instructions with context from original design]\nIMAGE_URLS: [previous_generated_image_url,new_product_urls,room_image_url_LAST]\n\n**Important**: Always place the room image URL as the LAST item in the IMAGE_URLS list to ensure proper aspect ratio. List product images first, then room image last.\n\n## Communication Standards\n\n**Professional Responses:**\n- Use interior design terminology appropriately\n- Provide helpful context about cataloged items, documented rooms, or design suggestions\n- Offer suggestions for design applications when relevant\n- Ask for clarification when requests are ambiguous\n\n**Success Confirmations:**\n\n**For Furniture Cataloging:**\n\"Successfully processed and cataloged [X] furniture items:\n\n- [Item Name]: [Brief description] - Added to [category]\n- [Item Name]: [Brief description] - Added to [category]\n\nAll items are now searchable in your design catalog.\"\n\n**For Room Documentation:**\n\"Successfully processed and documented room space:\n\n- [Room Name]: [Brief description] - [Room Type]\n- Key features: [Notable characteristics]\n\nRoom is now available for design planning and furniture placement.\"\n\n**For AI Image Generation:**\n\"AI design generation initiated:\n\n- Room: [Room details]\n- Requested changes: [User instructions]\n- Products included: [Product list]\n\nYour custom interior design will be generated shortly.\"\n\n**For AI Image Modifications:**\n\"AI design modification initiated:\n\n- Base design: [Original image reference]\n- Requested changes: [User modifications]\n- New elements: [Additional products/changes]\n\nYour updated interior design will be generated shortly.\"\n\n## Tool Usage\n\n- **Send a text message in Telegram**: For all user communications and confirmations\n- **AI Agent Tool**: Furniture analysis to catalog database agent OR retrieve catalog products for AI generation\n- **Room Organiser**: Room analysis to room database agent OR retrieve room data for AI generation\n- **Get AI Generated Images**: Search and retrieve previously generated designs for modifications\n- **Send a photo message in Telegram**: When showing users images for clarification\n\n## Enhanced Processing Flow\n\n**Text Only:** \n- Conversational \u2192 Reply with \"Send a text message in Telegram\"\n- AI Generation Request \u2192 Retrieve data + Output structured AI generation format\n- AI Modification Request \u2192 Search previous designs + Output enhanced AI generation format\n\n**Text + Image with Furniture:** \n- Image Analysis Results \u2192 \"AI Agent Tool\" \u2192 \"Send a text message in Telegram\"\n\n**Text + Image with Room:** \n- Image Analysis Results \u2192 \"Room Organiser\" \u2192 \"Send a text message in Telegram\"\n\n**Text + Image with AI Generation Request:**\n- Catalog room (if needed) \u2192 Retrieve relevant data \u2192 Output AI generation format \u2192 \"Send a text message in Telegram\"\n\n## Request Type Detection Logic\n\n**Catalog/Room Storage Requests:**\n1. Look for \"IMAGE_TYPE: FURNITURE\" \u2192 Route to AI Agent Tool for cataloging\n2. Look for \"IMAGE_TYPE: ROOM\" \u2192 Route to Room Organiser for documentation\n3. User text focuses on cataloging, documentation, or adding to database\n\n**AI Generation Requests:**\n- User text contains design instructions: \"add\", \"place\", \"redesign\", \"create\", \"generate\", \"design\"\n- User asks for interior modifications, furniture placement, or room transformations\n- User references specific products from catalog for placement in rooms\n\n**AI Modification Requests:**\n- User references previous designs: \"change\", \"modify\", \"update\", \"alter\" + references to past images\n- User mentions \"that design\", \"previous\", \"earlier\", specific room names from generated images\n- User wants to edit or enhance existing AI-generated designs\n\n**Conversational Requests:**\n- General questions about interior design\n- Requests for information about existing catalog or rooms\n- Clarification needs or help requests\n\n## Clarification and Image Sharing\n\n**When to Ask for Clarification:**\n- User requests AI generation but doesn't specify which room or products\n- Multiple similar items exist in catalog and user request is ambiguous\n- User references \"my living room\" but multiple rooms of that type exist\n- User mentions modifying a design but reference is unclear\n\n**When to Send Images:**\n- Use \"Send a photo message in Telegram\" with HTTP URLs when showing options\n- Show room images when asking \"Which room did you mean?\"\n- Show product images when asking \"Which sofa would you like to use?\"\n- Show generated images when asking \"Which design would you like to modify?\"\n\n## Error Handling\n\n**Analysis Issues:**\n- If image analysis fails or is unclear, inform user of specific limitations\n- Provide guidance on image quality or content requirements\n- Offer to retry with different images\n\n**Database Retrieval Issues:**\n- If no matching rooms or products found, inform user and suggest alternatives\n- If no previous generated images found for modification, suggest new generation instead\n- Offer to help catalog new items if needed\n\n**AI Generation Issues:**\n- If user request is too vague, ask for specific details about desired changes\n- If conflicting style requirements, ask for clarification on priorities\n- If technical requirements unclear, guide user through specification process\n\n**Routing Uncertainties:**\n- If IMAGE_TYPE is ambiguous, use best judgment based on analysis content and user text\n- Note any uncertainties in user communication\n- Suggest clarification if needed for optimal processing\n\nKeep responses helpful, professional, and focused on successful catalog management, room documentation, and AI-powered interior design generation and modification."
},
"promptType": "define"
},
"typeVersion": 2.2
},
{
"id": "97df08a3-3e31-4375-b3b5-1ab0af1863bf",
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
96,
304
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1",
"cachedResultName": "gpt-4.1"
},
"options": {}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "978fe3d6-d3d6-47de-bf97-910de02d7343",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
240,
624
],
"parameters": {
"color": 4,
"width": 320,
"height": 240,
"content": "CATALOGUE ORGANISER TOOLS"
},
"typeVersion": 1
},
{
"id": "55eba1e9-eae8-4ea8-a5ce-bcb005887379",
"name": "Create Catalogue Row",
"type": "n8n-nodes-base.supabaseTool",
"position": [
272,
688
],
"parameters": {
"tableId": "catalog_products",
"fieldsUi": {
"fieldValues": [
{
"fieldId": "product_name",
"fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues1_Field_Value', ``, 'string') }}"
},
{
"fieldId": "product_type",
"fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues2_Field_Value', ``, 'string') }}"
},
{
"fieldId": "category",
"fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues3_Field_Value', ``, 'string') }}"
},
{
"fieldId": "style",
"fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues4_Field_Value', ``, 'string') }}"
},
{
"fieldId": "design_era",
"fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues5_Field_Value', ``, 'string') }}"
},
{
"fieldId": "primary_color",
"fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues6_Field_Value', ``, 'string') }}"
},
{
"fieldId": "materials",
"fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues7_Field_Value', ``, 'string') }}"
},
{
"fieldId": "size_category",
"fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues8_Field_Value', ``, 'string') }}"
},
{
"fieldId": "room_types",
"fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues9_Field_Value', ``, 'string') }}"
},
{
"fieldId": "ai_description",
"fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues10_Field_Value', ``, 'string') }}"
},
{
"fieldId": "image_url",
"fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues11_Field_Value', ``, 'string') }}"
},
{
"fieldId": "brand",
"fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues12_Field_Value', ``, 'string') }}"
},
{
"fieldId": "tags",
"fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues13_Field_Value', ``, 'string') }}"
}
]
}
},
"credentials": {
"supabaseApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "11aa5aec-4f0e-4918-8a2b-8d785d72b454",
"name": "Get Many Catalogue Rows",
"type": "n8n-nodes-base.supabaseTool",
"position": [
432,
688
],
"parameters": {
"limit": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Limit', ``, 'number') }}",
"tableId": "catalog_products",
"operation": "getAll",
"filterType": "none"
},
"credentials": {
"supabaseApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "88cc6ce6-f8af-4bc3-aeae-91c8964d17e4",
"name": "Send a text message in Telegram",
"type": "n8n-nodes-base.telegramTool",
"position": [
864,
208
],
"parameters": {
"text": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Text', ``, 'string') }}",
"chatId": "={{ $('Telegram Trigger').first().json.message.chat.id }}",
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "2de93749-84b7-4d25-84e3-60bf582544c9",
"name": "Send a photo message in Telegram",
"type": "n8n-nodes-base.telegramTool",
"position": [
1008,
208
],
"parameters": {
"file": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Photo', ``, 'string') }}",
"chatId": "={{ $('Telegram Trigger').first().json.message.chat.id }}",
"operation": "sendPhoto",
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "ab9d74ba-e878-47d3-9085-3760725087d4",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
816,
128
],
"parameters": {
"color": 5,
"width": 320,
"height": 240,
"content": "Telegram Text and Image sending tools"
},
"typeVersion": 1
},
{
"id": "c3afb95d-324e-43c1-a916-943a5e50dbf3",
"name": "AI Agent Tool",
"type": "@n8n/n8n-nodes-langchain.agentTool",
"position": [
192,
400
],
"parameters": {
"text": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Prompt__User_Message_', ``, 'string') }}",
"options": {
"systemMessage": "You are a specialized database operations agent for furniture catalog management.\n\n## Your Function\n\nReceive detailed furniture analysis from the main agent and create precise database entries in Supabase.\n\n## Input Processing\n\nYou receive:\n- Complete furniture analysis descriptions from image processing\n- Image URLs for database storage\n- Any additional user context from the main agent\n\n## Database Schema (catalog_products table)\n\n### Required Fields:\n- **product_name**: Descriptive name from analysis\n- **product_type**: Specific type (sofa, chair, coffee_table, dining_table, lamp, etc.)\n- **category**: Broad category (seating, tables, storage, lighting, decor)\n- **style**: Design style (modern, traditional, scandinavian, industrial, minimalist)\n- **primary_color**: Dominant color from analysis\n- **materials**: Material composition (fabric, leather, wood_oak, wood_walnut, metal, glass)\n- **size_category**: small, medium, or large\n- **room_types**: Compatible rooms (comma-separated, no spaces)\n- **ai_description**: Professional description from analysis\n- **image_url**: Public URL from upload\n\n### Optional Fields:\n- **design_era**: When identified (mid_century, contemporary, classic, art_deco)\n- **brand**: When visible or mentioned\n- **tags**: Search keywords (comma-separated, no spaces)\n\n## Critical Formatting Rules\n\n### Comma-Separated Fields (NO SPACES):\n- **room_types**: \"living_room,office,bedroom\"\n- **tags**: \"sofa,modern,upholstered,oak,contemporary\"\n- **materials**: \"fabric,wood_oak,metal\"\n\n### Standardized Values:\n- **Room Types**: living_room, bedroom, dining_room, office, kitchen, bathroom, lounge, family_room\n- **Categories**: seating, tables, storage, lighting, decor, bedroom_furniture\n- **Size Categories**: small, medium, large\n\n## Processing Protocol\n\n1. **Parse Analysis**: Extract furniture details from provided analysis\n2. **Format Data**: Convert to proper database field format\n3. **Generate Tags**: Create comprehensive search tags from all attributes\n4. **Create Entries**: Use \"Create Catalogue Row\" tool for each furniture item\n5. **Validate**: Ensure all required fields are populated\n\n## Database Operations\n\n**For Each Furniture Item:**\n- Extract all relevant data from analysis\n- Format according to database requirements \n- Generate appropriate tags including: product_type, style, color, materials, room_types\n- Create individual database entry using \"Create Catalogue Row\"\n- Never combine multiple furniture pieces into one entry\n\n## Response Format\nDatabase Operations Complete:\nSuccessfully cataloged [X] items:\n\n[Product Name] - [Category]\n[Product Name] - [Category]\n\n[Any issues or special notes]\nReady for user confirmation.\n\n## Quality Standards\n\n- Use exact image URLs provided\n- Maintain professional naming conventions\n- Ensure searchable, descriptive product names\n- Create high-quality catalog data for interior design professionals\n- Process each distinct furniture piece as separate database entry"
}
},
"typeVersion": 2.2
},
{
"id": "3f7709d1-2a14-40e0-9ce0-a13b215a4d87",
"name": "HTTP Request1",
"type": "n8n-nodes-base.httpRequest",
"position": [
-400,
144
],
"parameters": {
"url": "=https://raeojxaquatmtzgxqqdx.supabase.co/storage/v1/object/catalog-images/{{$now}}-{{$binary.data.fileName}}",
"method": "POST",
"options": {},
"sendBody": true,
"contentType": "binaryData",
"sendHeaders": true,
"authentication": "predefinedCredentialType",
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "={{ $binary.data.mimeType }}"
},
{
"name": "x-upsert",
"value": "true"
}
]
},
"inputDataFieldName": "data",
"nodeCredentialType": "supabaseApi"
},
"credentials": {
"supabaseApi": {
"name": "<your credential>"
}
},
"typeVersion": 4.2
},
{
"id": "e38ec86b-67dd-4931-b271-924233c8f66a",
"name": "Code in JavaScript",
"type": "n8n-nodes-base.code",
"position": [
-272,
144
],
"parameters": {
"jsCode": "// Extract the file key from the upload response\nconst uploadResponse = $input.first().json;\nconst fileKey = uploadResponse.Key;\n\n// Construct the public URL\nconst publicUrl = `https://raeojxaquatmtzgxqqdx.supabase.co/storage/v1/object/public/${fileKey}`;\n\nreturn {\n json: {\n ...uploadResponse,\n publicUrl: publicUrl,\n // Keep original message data for the AI Agent\n originalMessage: $('Telegram Trigger').first().json.message\n }\n};"
},
"typeVersion": 2
},
{
"id": "640d9829-3484-4c88-8ec7-b2513a7180b1",
"name": "If",
"type": "n8n-nodes-base.if",
"position": [
-512,
-80
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "loose"
},
"combinator": "and",
"conditions": [
{
"id": "4496c393-77ad-4407-9e3d-cf12423e96b0",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ Object.keys($binary).length > 0 }}",
"rightValue": "false"
}
]
},
"looseTypeValidation": true
},
"typeVersion": 2.2
},
{
"id": "f5974e74-562e-4466-b43a-0f97e8809cf5",
"name": "Analyze image",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
-112,
144
],
"parameters": {
"text": "You are a specialized image analysis agent for interior design workflows. You analyze images and determine whether they contain individual furniture pieces for cataloging or room spaces for design planning.\n\n## Your Function\n\nAnalyze uploaded images to identify the primary subject and provide appropriate detailed analysis for either furniture cataloging or room documentation.\n\n## Analysis Protocol\n\n### 1. Image Type Detection\n**First, determine the primary subject:**\n- **FURNITURE**: Image shows individual furniture pieces with clear product focus (catalog-style photos, isolated items, close-ups of specific furniture)\n- **ROOM**: Image shows interior spaces, room views, architectural contexts, or multiple furniture pieces in a living environment\n\n### 2. Image Assessment\n- Examine image quality and clarity\n- Identify the primary subject matter\n- Note any partial or unclear elements\n- Assess lighting and angle for accurate analysis\n\n## FURNITURE ANALYSIS (When image type = FURNITURE)\n\n### Furniture Identification (Per Item)\n\n**Product Identification:**\n- Product name (specific and descriptive: \"Mid-Century Walnut Coffee Table\")\n- Product type (sofa, chair, coffee_table, dining_table, lamp, bookshelf, etc.)\n- Category (seating, tables, storage, lighting, decor, bedroom_furniture)\n\n**Style Classification:**\n- Style (modern, traditional, scandinavian, industrial, bohemian, minimalist, contemporary)\n- Design era (mid_century, contemporary, classic, art_deco, vintage, transitional)\n\n**Physical Properties:**\n- Primary color (dominant color accurately described)\n- Secondary colors (if significant)\n- Materials (fabric, leather, wood_oak, wood_walnut, metal_chrome, glass, marble, etc.)\n- Size category (small, medium, large based on visual proportions and context)\n\n**Professional Assessment:**\n- Room compatibility (living_room, bedroom, dining_room, office, kitchen, bathroom, lounge)\n- Professional description (detailed 2-3 sentence analysis of design and features)\n- Brand identification (if visible logos, distinctive design signatures, or mentioned in context)\n- Condition assessment (new, vintage, distressed, restored - if determinable)\n\n### Furniture Output Format\nIMAGE_TYPE: FURNITURE\nAnalyzed [X] furniture items in the provided image(s):\nITEM [NUMBER]:\nProduct Name: [Specific, professional name]\nProduct Type: [Exact furniture type]\nCategory: [Broad category]\nStyle: [Design style]\nDesign Era: [When determinable]\nPrimary Color: [Dominant color]\nMaterials: [Material composition]\nSize Category: [small/medium/large]\nRoom Types: [Compatible rooms, comma-separated]\nProfessional Description: [2-3 sentences about design, features, and use]\nBrand: [If visible or determinable]\nSpecial Notes: [Any unique features, condition notes, or user-specified details]\nAnalysis complete. Ready for catalog entry processing.\n\n## ROOM ANALYSIS (When image type = ROOM)\n\n### Room Identification\n\n**Basic Room Information:**\n- Room name (descriptive: \"Modern Living Room\", \"Master Bedroom\", \"Kitchen Dining Area\")\n- Room type (living_room, bedroom, kitchen, bathroom, office, dining_room, family_room, lounge)\n- Room size (small, medium, large based on visual scale and proportions)\n\n**Style & Design Analysis:**\n- Style (modern, traditional, scandinavian, industrial, minimalist, contemporary, transitional)\n- Design era (mid_century, contemporary, classic, art_deco, vintage)\n- Color palette (dominant colors and color scheme observed)\n\n**Physical Characteristics:**\n- Lighting type (natural, artificial, mixed, dim, bright)\n- Architectural features (high_ceilings, exposed_beams, fireplace, built_ins, crown_molding)\n- Flooring type (hardwood, carpet, tile, concrete, laminate, stone)\n\n**Content & Context:**\n- Existing furniture (brief list of major furniture pieces visible)\n- Professional description (detailed 2-3 sentence room analysis including atmosphere, design approach, and functionality)\n\n### Room Output Format\nIMAGE_TYPE: ROOM\nAnalyzed room space in the provided image:\nRoom Name: [Descriptive room name]\nRoom Type: [Specific room type]\nRoom Size: [small/medium/large]\nStyle: [Design style]\nDesign Era: [When determinable]\nColor Palette: [Dominant colors and scheme]\nLighting Type: [Lighting characteristics]\nArchitectural Features: [Notable architectural elements]\nFlooring Type: [Floor material/type]\nExisting Furniture: [Major pieces visible]\nProfessional Description: [2-3 sentences about room design, atmosphere, and functionality]\nAnalysis complete. Ready for room entry processing.\n\n## Context Integration\nUse provided user text context for:\n- Style preferences or specific requirements mentioned\n- Room designations or intended use specified\n- Brand mentions or special features to focus on\n- Multiple item identification guidance\n\n## Quality Standards\n\n**Accuracy Requirements:**\n- Be precise with furniture and interior design terminology\n- Use professional language appropriate for interior designers\n- Provide confident assessments based on visual evidence\n- Note uncertainties clearly when details are unclear\n\n**Professional Analysis:**\n- Focus on design elements that matter to interior designers\n- Include scale, proportion, and style context\n- Consider commercial vs. residential applications\n- Mention design versatility and applications\n\n## Error Handling\n\n**Unclear Images:**\n- Report what can be identified with confidence\n- Note specific limitations (lighting, angle, partial view)\n- Suggest improvements for better analysis\n\n**Ambiguous Content:**\n- If unclear whether furniture or room, default to the most prominent subject\n- Note alternative interpretations when uncertain\n- Ask for clarification on ambiguous content\n\n**No Clear Subject:**\n- Report if neither furniture nor room space is clearly visible\n- Suggest image requirements for successful analysis\n- Offer guidance on proper image capture\n\n## Important Notes\n\n- Always start response with IMAGE_TYPE declaration\n- Process each distinct furniture piece as separate analysis in furniture mode\n- Maintain consistency in terminology across all analyses\n- Focus on commercially relevant details for interior design workflows\n- Integrate user context throughout analysis\n- Provide actionable information for appropriate database entry creation",
"modelId": {
"__rl": true,
"mode": "list",
"value": "chatgpt-4o-latest",
"cachedResultName": "CHATGPT-4O-LATEST"
},
"options": {},
"resource": "image",
"imageUrls": "={{ $json.publicUrl }}",
"operation": "analyze"
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.8
},
{
"id": "d7a9ee9d-af69-4dff-b3ea-8da587384624",
"name": "Edit Fields",
"type": "n8n-nodes-base.set",
"position": [
32,
144
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "0d3435d7-8061-42df-96a4-b0da4428d5fd",
"name": "ai_agent_input",
"type": "string",
"value": "={{ $('Code in JavaScript').first().json }}"
},
{
"id": "a8c121c7-e4e1-4926-a4c7-de390a37201c",
"name": "image_analysis",
"type": "string",
"value": "={{ $json.content }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "01bc993b-54f3-4917-96c6-2179f6c37c1e",
"name": "Edit Fields1",
"type": "n8n-nodes-base.set",
"position": [
32,
-96
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "cb13a753-b818-4021-b6b3-fde0022adda4",
"name": "=ai_agent_input",
"type": "string",
"value": "={{ $('Telegram Trigger').first().json.message.text }}"
},
{
"id": "955ae98a-b14b-45a1-90d7-699699798c06",
"name": "=image_analysis",
"type": "string",
"value": "null"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "75b82717-01f8-4c42-8df4-56c478534551",
"name": "Room Organiser",
"type": "@n8n/n8n-nodes-langchain.agentTool",
"position": [
672,
400
],
"parameters": {
"text": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Prompt__User_Message_', ``, 'string') }}",
"options": {
"systemMessage": "You are a specialized database operations agent for room space management. You must correctly parse room analysis data and map each field to the exact correct database column.\n\n## Your Function\n\nReceive room analysis from the main agent and create precise database entries with correct field mapping.\n\n## Critical Field Mapping Instructions\n\nYou will receive room analysis in this format:\nIMAGE_TYPE: ROOM\nAnalyzed room space in the provided image:\nRoom Name: [value]\nRoom Type: [value]\nRoom Size: [value]\nStyle: [value]\nDesign Era: [value]\nColor Palette: [value]\nLighting Type: [value]\nArchitectural Features: [value]\nFlooring Type: [value]\nExisting Furniture: [value]\nProfessional Description: [value]\n\n**EXACT FIELD MAPPING - FOLLOW PRECISELY:**\n\n### Required Database Fields:\n- **room_name** \u2190 Extract from \"Room Name: [value]\"\n- **room_type** \u2190 Extract from \"Room Type: [value]\" \n- **room_size** \u2190 Extract from \"Room Size: [value]\"\n- **style** \u2190 Extract from \"Style: [value]\"\n- **color_palette** \u2190 Extract from \"Color Palette: [value]\"\n- **ai_description** \u2190 Extract from \"Professional Description: [value]\"\n- **image_url** \u2190 Extract from the image URL provided separately in the input data\n\n### Optional Database Fields:\n- **design_era** \u2190 Extract from \"Design Era: [value]\" (if present)\n- **lighting_type** \u2190 Extract from \"Lighting Type: [value]\" (if present)\n- **architectural_features** \u2190 Extract from \"Architectural Features: [value]\" (if present)\n- **flooring_type** \u2190 Extract from \"Flooring Type: [value]\" (if present)\n- **existing_furniture** \u2190 Extract from \"Existing Furniture: [value]\" (if present)\n- **tags** \u2190 Generate from room characteristics (comma-separated, no spaces)\n\n## Data Extraction Protocol\n\n**Step 1: Parse Analysis Text**\n- Locate each \"FieldName: [value]\" pair in the room analysis\n- Extract the exact value after the colon and space\n- Do NOT mix up field contents\n\n**Step 2: Handle Image URL**\n- The image URL will be provided separately in the input data structure\n- Look for URL pattern: \"https://raeojxaquatmtzgxqqdx.supabase.co/storage/v1/object/public/...\"\n- Assign this URL to the **image_url** field\n\n**Step 3: Generate Tags**\n- Combine: room_type, style, key characteristics from color_palette, lighting_type, flooring_type\n- Example: \"living_room,minimalist,white_walls,natural_light,hardwood\"\n- Format: comma-separated with no spaces\n\n## Example Correct Mapping\n\n**Input Analysis:**\nRoom Name: Empty Minimalist Room with Natural Light\nRoom Type: living_room\nRoom Size: medium\nStyle: minimalist\nDesign Era: contemporary\nColor Palette: white walls, light natural wood flooring, green accents\nLighting Type: natural\nArchitectural Features: large window, flat ceiling, clean lines\nFlooring Type: hardwood\nExisting Furniture: none\nProfessional Description: This medium-sized, minimalist room features white walls...\n\n**Correct Database Mapping:**\n- room_name: \"Empty Minimalist Room with Natural Light\"\n- room_type: \"living_room\"\n- room_size: \"medium\" \n- style: \"minimalist\"\n- design_era: \"contemporary\"\n- color_palette: \"white walls, light natural wood flooring, green accents\"\n- lighting_type: \"natural\"\n- architectural_features: \"large window, flat ceiling, clean lines\"\n- flooring_type: \"hardwood\"\n- existing_furniture: \"none\"\n- ai_description: \"This medium-sized, minimalist room features white walls...\"\n- image_url: [the actual URL from input data]\n- tags: \"living_room,minimalist,natural_light,hardwood,contemporary\"\n\n## Database Operations\n\n**Use \"Create Room Row\" tool with exact field mapping:**\n1. Parse the room analysis text carefully\n2. Extract each field value precisely \n3. Map to correct database column\n4. Include image URL from input data\n5. Generate appropriate tags\n6. Create single database entry\n\n## Critical Rules\n\n**DO NOT:**\n- Mix up field contents between database columns\n- Put image URLs in wrong fields\n- Put descriptions in wrong fields\n- Scramble the field mapping\n\n**DO:**\n- Follow the exact field mapping instructions above\n- Extract values precisely from analysis text\n- Use the provided image URL correctly\n- Generate meaningful search tags\n\n## Response Format\nDatabase Operations Complete:\nSuccessfully cataloged room space:\n\n[Room Name] - [Room Type] - [Style]\n\nRoom entry created with:\n\nSize: [room_size]\nStyle: [style]\nImage URL: [confirm URL was stored]\n\nReady for user confirmation.\n\n## Validation Checklist\n\nBefore creating database entry, verify:\n- \u2713 room_name contains the room name (not description)\n- \u2713 image_url contains the actual image URL (not \"none\")\n- \u2713 ai_description contains the professional description (not color info)\n- \u2713 color_palette contains color information (not description)\n- \u2713 Each field contains appropriate content type\n\nFollow these instructions exactly to ensure correct database storage."
}
},
"typeVersion": 2.2
},
{
"id": "b2d9680d-29a5-4b79-8c2f-a00f398abfcc",
"name": "Create Room Row",
"type": "n8n-nodes-base.supabaseTool",
"position": [
736,
688
],
"parameters": {
"tableId": "rooms",
"fieldsUi": {
"fieldValues": [
{
"fieldId": "room_name",
"fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues0_Field_Value', `Extract from \"Room Name:\" in analysis. Should be a descriptive title like \"Empty Minimalist Room with Natural Light\" or \"Modern Living Room\". NOT the professional description.`, 'string') }}"
},
{
"fieldId": "room_type",
"fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues1_Field_Value', `Extract from \"Room Type:\" in analysis. Single value like \"living_room\", \"bedroom\", \"kitchen\", \"office\". Use underscore format.`, 'string') }}"
},
{
"fieldId": "room_size",
"fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues2_Field_Value', ``, 'string') }}"
},
{
"fieldId": "style",
"fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues3_Field_Value', `Extract from \"Style:\" in analysis. Single design style like \"minimalist\", \"modern\", \"traditional\", \"scandinavian\".`, 'string') }}"
},
{
"fieldId": "design_era",
"fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues4_Field_Value', ``, 'string') }}"
},
{
"fieldId": "color_palette",
"fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues5_Field_Value', `Extract from \"Color Palette:\" in analysis. Describes dominant colors and color scheme like \"white walls, light wood flooring, green accents\". NOT the description.`, 'string') }}"
},
{
"fieldId": "lighting_type",
"fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues6_Field_Value', ``, 'string') }}"
},
{
"fieldId": "architectural_features",
"fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues7_Field_Value', ``, 'string') }}"
},
{
"fieldId": "flooring_type",
"fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues8_Field_Value', ``, 'string') }}"
},
{
"fieldId": "existing_furniture",
"fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues9_Field_Value', `Extract from \"Existing Furniture:\" in analysis. List major pieces visible or \"none\" for empty rooms. NOT architectural features.`, 'string') }}"
},
{
"fieldId": "ai_description",
"fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues10_Field_Value', `Extract from \"Professional Description:\" in analysis. This is the 2-3 sentence detailed room analysis paragraph. NOT color information or room name.`, 'string') }}"
},
{
"fieldId": "image_url",
"fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues11_Field_Value', `Extract the full image URL from input data (starts with https://raeojxaquatmtzgxqqdx.supabase.co/storage/). This is the direct link to the uploaded room photo, NOT from the analysis text.`, 'string') }}"
},
{
"fieldId": "tags",
"fieldValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('fieldValues12_Field_Value', ``, 'string') }}"
}
]
}
},
"credentials": {
"supabaseApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "54b9cb1d-bc07-48b6-b572-7c5dd3828ad1",
"name": "Get Many Room Rows",
"type": "n8n-nodes-base.supabaseTool",
"position": [
896,
688
],
"parameters": {
"limit": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Limit', ``, 'number') }}",
"tableId": "rooms",
"operation": "getAll",
"filterType": "none"
},
"credentials": {
"supabaseApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "8e2d045a-8c52-4bc1-b4fd-b82e18206874",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
688,
624
],
"parameters": {
"color": 4,
"width": 320,
"height": 240,
"content": "ROOM ORGANISER TOOLS"
},
"typeVersion": 1
},
{
"id": "f3e5c0d7-e703-400e-9e16-e2aac6b2299c",
"name": "OpenAI Chat",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
576,
576
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1",
"cachedResultName": "gpt-4.1"
},
"options": {}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "c3abddbd-77ed-4b2d-bcec-bddeaa14fc5c",
"name": "OpenAI chat",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
112,
576
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1",
"cachedResultName": "gpt-4.1"
},
"options": {}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "633faf88-0aa1-4729-a9ef-5968660cd674",
"name": "If1",
"type": "n8n-nodes-base.if",
"position": [
752,
-96
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "2cfddbba-5fc1-4705-9717-bbf69bb16d6e",
"operator": {
"type": "string",
"operation": "contains"
},
"leftValue": "={{ $json.output }}",
"rightValue": "GEMINI_PROMPT:"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "c4184ed4-3a1d-4596-8cd9-6eab1752e196",
"name": "Split Out",
"type": "n8n-nodes-base.splitOut",
"position": [
1312,
-208
],
"parameters": {
"include": "allOtherFields",
"options": {},
"fieldToSplitOut": "message.content.image_urls_array"
},
"typeVersion": 1
},
{
"id": "bd4190d2-ad07-4356-b1d2-0428f2e7eeae",
"name": "Binary Decoder",
"type": "n8n-nodes-base.code",
"position": [
1696,
-144
],
"parameters": {
"jsCode": "// n8n Function node: aggregate images and create Nano Banana API payload\nconst items = $input.all();\nconst images = [];\nlet baseData = {};\n\n// Loop through all incoming items\nfor (let i = 0; i < items.length; i++) {\n const item = items[i];\n\n // Copy shared metadata from first item\n // Handle the new AI node output structure\n if (i === 0) {\n // The data structure from Split Out maintains the original structure\n const content = item.json.message?.content || item.json; // Fallback for old structure\n baseData = {\n image_name: content.image_name,\n gemini_prompt: content.gemini_prompt,\n image_urls: content.image_urls,\n original_output: content.original_output || 'Generated by AI node',\n };\n }\n\n // Extract binary data and convert to inline_data format\n if (item.binary && item.binary.data) {\n images.push({\n inline_data: {\n mime_type: item.binary.data.mimeType || 'image/jpeg',\n data: item.binary.data.data // Already base64 in n8n\n }\n });\n }\n}\n\n// Create the complete Nano Banana API payload\nconst nanoBananaPayload = {\n contents: [{\n parts: [\n {\n text: baseData.gemini_prompt\n },\n ...images\n ]\n }],\n generationConfig: {\n maxOutputTokens: 1290\n }\n};\n\n// Return single aggregated item with API-ready payload\nreturn [{\n json: {\n ...baseData,\n nano_banana_payload: nanoBananaPayload,\n // Keep individual images for debugging if needed\n images_debug: images,\n images_count: images.length\n }\n}];"
},
"typeVersion": 2
},
{
"id": "04dcfc1b-e1d6-41dd-8f50-a1ac9fb0c13b",
"name": "Nanobanana Caller",
"type": "n8n-nodes-base.httpRequest",
"position": [
1904,
-144
],
"parameters": {
"url": "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-image-preview:generateContent",
"method": "POST",
"options": {
"response": {
"response": {
"fullResponse": true,
"responseFormat": "json"
}
},
"allowUnauthorizedCerts": false
},
"jsonBody": "={{ $json.nano_banana_payload }}",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"authentication": "predefinedCredentialType",
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
},
"nodeCredentialType": "googlePalmApi"
},
"credentials": {
"googlePalmApi": {
"name": "<your credential>"
}
},
"typeVersion": 4.2
},
{
"id": "80901e90-45a2-4265-88df-7405d9bc7460",
"name": "Gen AI Image",
"type": "n8n-nodes-base.code",
"position": [
2112,
-144
],
"parameters": {
"jsCode": "// Extract base64 image from Nano Banana response - UPDATED for text+image response\nconst response = $input.first().json;\n\ntry {\n // Find the part that contains inlineData (image)\n const parts = response.body.candidates[0].content.parts;\n const imagePart = parts.find(part => part.inlineData);\n \n if (!imagePart) {\n throw new Error(\"No image found in response\");\n }\n\n const imageData = imagePart.inlineData.data;\n const mimeType = imagePart.inlineData.mimeType;\n const imageName = $input.first().json.image_name || 'generated_image';\n\n // Also extract the text description if you want it\n const textPart = parts.find(part => part.text);\n const description = textPart ? textPart.text : '';\n\n console.log(\"Successfully extracted image data, size:\", imageData.length);\n\n return [{\n json: {\n image_name: imageName,\n mime_type: mimeType,\n description: description, // Nano Banana's description of what it created\n success: true\n },\n binary: {\n data: {\n data: imageData,\n mimeType: mimeType,\n fileName: `${imageName}.png`\n }\n }\n }];\n} catch (error) {\n console.log(\"Error extracting image:\", error.message);\n return [{\n json: {\n error: error.message,\n response_structure: response.body\n }\n }];\n}"
},
"typeVersion": 2
},
{
"id": "f0b5dd71-815b-4e7f-9368-0366b7164f41",
"name": "Gen Image Save",
"type": "n8n-nodes-base.httpRequest",
"position": [
2304,
16
],
"parameters": {
"url": "=https://raeojxaquatmtzgxqqdx.supabase.co/storage/v1/object/catalog-images/{{ $('gfd').first().json.image_name }}",
"method": "POST",
"options": {},
"sendBody": true,
"contentType": "binaryData",
"sendHeaders": true,
"authentication": "predefinedCredentialType",
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "={{ $('Gen AI Image').first().json.mime_type }}"
},
{
"name": "x-upsert",
"value": "true"
}
]
},
"inputDataFieldName": "data",
"nodeCredentialType": "supabaseApi"
},
"credentials": {
"supabaseApi": {
"name": "<your credential>"
}
},
"typeVersion": 4.2
},
{
"id": "b7dc6f8f-085b-46dc-a2a3-00fd48521ae8",
"name": "Send a photo message",
"type": "n8n-nodes-base.telegram",
"position": [
2320,
-176
],
"parameters": {
"chatId": "={{ $('Telegram Trigger').first().json.message.chat.id }}",
"operation": "sendPhoto",
"binaryData": true,
"additionalFields": {
"caption": "={{ $('Output Organiser').first().json.message.content.image_name }}"
}
},
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "2f9e88fe-5f64-496f-af9c-72030316bbbb",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
416,
144
],
"parameters": {
"color": 4,
"height": 208,
"content": "AI GEN IMAGE TOOL"
},
"typeVersion": 1
},
{
"id": "c0511074-499c-4bbb-970e-6404738bb3fb",
"name": "Get AI Generated Images",
"type": "n8n-nodes-base.supabaseTool",
"position": [
496,
192
],
"parameters": {
"limit": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Limit', ``, 'number') }}",
"tableId": "ai_generated_images",
"operation": "getAll",
"filterType": "none"
},
"credentials": {
"supabaseApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "2efcf9b2-6809-49dc-8741-513ad7608272",
"name": "Binary Downloader",
"type": "n8n-nodes-base.httpRequest",
"position": [
1488,
-144
],
"parameters": {
"url": "={{ $json[\"message.content.image_urls_array\"] }}",
"options": {}
},
"typeVersion": 4.2
},
{
"id": "d34b345d-29dc-4e12-95dd-8e1fa6eb95d7",
"name": "Create AI Image row",
"type": "n8n-nodes-base.supabase",
"position": [
2528,
16
],
"parameters": {
"tableId": "ai_generated_images",
"fieldsUi": {
"fieldValues": [
{
"fieldId": "image_name",
"fieldValue": "={{ $('gfd').first().json.image_name }}"
},
{
"fieldId": "image_url",
"fieldValue": "=https://raeojxaquatmtzgxqqdx.supabase.co/storage/v1/object/public/{{ $('Gen Image Save').first().json.Key }}"
},
{
"fieldId": "original_prompt",
"fieldValue": "={{ $('gfd').first().json.gemini_prompt }}"
},
{
"fieldId": "ai_description",
"fieldValue": "={{ $('Nanobanana Caller').first().json.body.candidates[0].content.parts[0].text }}"
}
]
}
},
"credentials": {
"supabaseApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "23a55f49-d703-44bf-be68-632f9a6c0ca3",
"name": "Output Organiser",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
1072,
-144
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini",
"cachedResultName": "GPT-4.1-MINI"
},
"options": {},
"messages": {
"values": [
{
"content": "=**Input Text to Process:**\n{{ $json.output }}\n\nExtract the following structured data from the provided text and return it as a clean JSON object:\n\n**Required Fields:**\n\n1. **image_name**: Extract the value after \"IMAGE_NAME:\" (single line)\n2. **gemini_prompt**: Extract the complete text after \"GEMINI_PROMPT:\" (may span multiple lines, stop at \"IMAGE_URLS:\")\n3. **image_urls_array**: Extract all URLs from the \"IMAGE_URLS:\" section as an array of strings\n4. **image_urls**: Join all URLs with commas as a single string\n\n**Instructions:**\n- Look for the structured section that starts with \"IMAGE_NAME:\"\n- The GEMINI_PROMPT can be very long and span multiple lines\n- The IMAGE_URLS section contains URLs in a format like `[url1,url2]` - extract each URL as a separate array element\n- Remove any brackets, quotes, or extra whitespace from URLs\n- Only include valid HTTP/HTTPS URLs\n- If any field is not found, return an empty string or empty array\n\n**Expected Output Format:**\n```json\n{\n \"image_name\": \"extracted_image_name_here\",\n \"gemini_prompt\": \"extracted_prompt_text_here\",\n \"image_urls_array\": [\"url1\", \"url2\"],\n \"image_urls\": \"url1,url2\"\n}\n```\n\n"
}
]
},
"jsonOutput": true
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.8
}
],
"active": true,
"settings": {
"executionOrder": "v1"
},
"versionId": "1ffe7301-bf11-4305-bf6b-6f36f70ae69e",
"connections": {
"If": {
"main": [
[
{
"node": "Edit Fields1",
"type": "main",
"index": 0
}
],
[
{
"node": "HTTP Request1",
"type": "main",
"index": 0
}
]
]
},
"If1": {
"main": [
[
{
"node": "Output Organiser",
"type": "main",
"index": 0
}
]
]
},
"AI Agent": {
"main": [
[
{
"node": "If1",
"type": "main",
"index": 0
}
]
]
},
"Split Out": {
"main": [
[
{
"node": "Binary Downloader",
"type": "main",
"index": 0
}
]
]
},
"Edit Fields": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat": {
"ai_languageModel": [
[
{
"node": "Room Organiser",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"OpenAI chat": {
"ai_languageModel": [
[
{
"node": "AI Agent Tool",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Edit Fields1": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"Gen AI Image": {
"main": [
[
{
"node": "Send a photo message",
"type": "main",
"index": 0
},
{
"node": "Gen Image Save",
"type": "main",
"index": 0
}
]
]
},
"AI Agent Tool": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Analyze image": {
"main": [
[
{
"node": "Edit Fields",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request1": {
"main": [
[
{
"node": "Code in JavaScript",
"type": "main",
"index": 0
}
]
]
},
"Binary Decoder": {
"main": [
[
{
"node": "Nanobanana Caller",
"type": "main",
"index": 0
}
]
]
},
"Gen Image Save": {
"main": [
[
{
"node": "Create AI Image row",
"type": "main",
"index": 0
}
]
]
},
"Room Organiser": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Create Room Row": {
"ai_tool": [
[
{
"node": "Room Organiser",
"type": "ai_tool",
"index": 0
}
]
]
},
"Output Organiser": {
"main": [
[
{
"node": "Split Out",
"type": "main",
"index": 0
}
]
]
},
"Telegram Trigger": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
},
"Binary Downloader": {
"main": [
[
{
"node": "Binary Decoder",
"type": "main",
"index": 0
}
]
]
},
"Nanobanana Caller": {
"main": [
[
{
"node": "Gen AI Image",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Code in JavaScript": {
"main": [
[
{
"node": "Analyze image",
"type": "main",
"index": 0
}
]
]
},
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
googlePalmApiopenAiApisupabaseApitelegramApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This n8n workflow transforms your Telegram into a professional interior design studio powered by artificial intelligence. Send a photo of furniture or a room space, and watch as the system intelligently catalogs items, documents spaces, and generates stunning custom interior…
Source: https://n8n.io/workflows/8772/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
Generate AI viral videos with NanoBanana & VEO3, shared on socials via Blotato 2. Uses @blotato/n8n-nodes-blotato, googleSheets, lmChatOpenAi, toolThink. Event-driven trigger; 94 nodes.
Digital marketers, content creators, social media managers, and businesses who want to use AI marketing automation for YouTube Shorts without spending hours on production. This AI workflow helps anyon
Transform your salon/service business with this streamlined Telegram automation system featuring Claude integration, zero-setup database management, and intelligent conversation handling. Claude MCP I
Jarvis is a powerful multi-agent productivity assistant built in n8n. It works directly from Telegram and can understand both text messages and voice notes.
This template is designed for marketers, content creators, and e-commerce brands who want to automate the creation of professional ad videos at scale. It’s ideal for teams looking to generate consiste