FinOps

Unleashing AI Creativity with n8n: Automation Made Simple 🎨🤖**

Unleashing AI Creativity with n8n: Automation Made Simple 🎨🤖**

Building truly personalised AI experiences

Mondweep Chakravorthy

Building truly personalised AI experiences often means stitching together disparate APIs and services. I found n8n streamlined this process, allowing me to create a single, unified workflow that handles many things from web searches and data scraping to restaurant recommendations and, yes, even stylised image generation. 🤯

Imagine a single Telegram interface where you can:
  • 🔍 Perform real-time web searches.

  • 🕸️ Scrape data from websites.

  • 🍽️ Find local restaurants.

  • 🏨 Book accommodation.

  • 🎨 Generate custom AI images with style preferences.



This isn't just about images; it's about creating a personalised AI assistant that adapts to your needs. n8n's visual workflow builder made it possible to combine these diverse functionalities into a cohesive, user-friendly experience. 🚀

What struck me was how n8n:
  • Democratises AI Development: No need for complex coding to build sophisticated AI apps. 🧩

  • Accelerates Prototyping: Rapidly iterate and deploy custom AI solutions. ⚡️

  • Unlocks Integration Potential: Seamlessly connects to a vast array of services and APIs. 🔗



Are you a CIO or Exec Tech leader exploring new digital revenue opportunities through personalised AI applications? Let's connect! I have 20 years of experience helping organisations transform through technology-led programmes. 🤝

Reach out to me, and let's explore how n8n can supercharge your AI initiatives. 💼 #AI #Automation #DigitalTransformation



This n8n workflow automates AI-driven image generation through Telegram, offering users style customisation. It comprises a main workflow and a subworkflow.

Main Workflow:

It acts as a gateway, receiving user input via Telegram or chat. An AI Agent, powered by LangChain and OpenAI's gpt-4o-mini, processes the input. It utilises tools like "brave," "firecrawl," and "airbnb" for web searches, scraping, and accommodation searches, respectively. The tools have been integrated using Model Context Protocol (MCP) servers. The AI Agent determines user intent and triggers tools that are available to it including an "Image Generation Workflow" subworkflow for photorealistic and stylised images, passing the user's query. It then sends the AI's response back to the user via Telegram.

Subworkflow: Image Generation Workflow:

This subworkflow generates images based on user input and selected styles. It starts with a trigger node receiving the user's query from the main workflow. An "Image Style Selection" node prompts the user to choose a style from a dropdown list in Telegram. A "Route by style" node then directs the workflow based on the chosen style. Style-specific "Edit Fields" nodes define the stylePrompt, containing detailed instructions for the AI image generation model. A "Merge" node combines the user's query and the style prompt. An "AI Agent" node prepares the prompt for the Hugging Face Inference API. The "Call hugginface inference api" node sends the generated prompt to Hugging Face to generate the image. Finally, the generated image is sent back to the user via Telegram.

Key Features:



  • User Input: Accepts input from Telegram.

  • Style Selection: Offers a variety of image styles.

  • AI-Powered Generation: Utilizes OpenAI, Google Gemini, and Hugging Face models.

  • Telegram Integration: Seamlessly integrates with Telegram.

  • Customisable Styles: stylePrompt allows for detailed style customization.



Setup Requirements:



  • Telegram API credentials.

  • Hugging Face API credentials.

  • OpenAI API credentials.

  • Google Gemini API credentials.

  • MCP client credentials.

  • n8n internet access.



This workflow provides a flexible and powerful automated system for AI image creation, enabling users to generate images with specific styles through a user-friendly Telegram interface. It leverages the capabilities of n8n for workflow automation, LangChain for AI agent management, and Hugging Face for image generation. The inclusion of web search, scraping and accommodation search tools allows the AI agent to gather information and generate images based on real time data, broadening the scope of the image generation.



Appendix:

# n8n Workflow: AI Image Generation with Style Selection - README

This document explains the functionality of two n8n workflows designed to facilitate AI-powered image generation with customizable styles through Telegram.

## Main Workflow Overview

The main workflow acts as a gateway, receiving input from Telegram messages and triggering a subworkflow for image generation.

Nodes:

1. Telegram Trigger / When chat message received:

* These nodes initiate the workflow when a message is received via Telegram. They capture the incoming message.

* When chat message received is disabled, Telegram Trigger is active.

2. AI Agent:

* This node uses LangChain's agent capabilities, leveraging OpenAI's gpt-4o-mini to process the input message.

* It's configured with a system message that instructs the AI to use specific tools like "brave" for web search, "firecrawl" for web scraping, "airbnb" for accommodation search and "ImageGeneration" (the subworkflow) for generating images.

* It determines the user's intent and selects the appropriate tool.

3. OpenAI Chat Model:

* This node uses OpenAI's gpt-4o-mini chat model. This is used by the AI Agent.

4. Brave Execute, Brave Tool, Firecrawl Tool, Firecrawl Execute, Airbnb Tool, Airbnb Execute:

* These nodes interact with external services (Brave, Firecrawl, Airbnb) via the MCP (Message Control Protocol) client.

* They are tools that the AI agent can use to perform web searches, web scraping, and accommodation searches.

5. ImageGeneration (Call n8n Workflow Tool):

* This node triggers the subworkflow named "Image Generation Workflow" (ID: qxk52I8r6hEjzdgf) to generate an image.

* It passes the user's query to the subworkflow.

6. Telegram:

* This node sends the processed response back to the user via Telegram.

Connections:

* The Telegram Trigger initiates the AI Agent.

* The AI Agent's output is sent to the Telegram node for messaging the user.

* The AI agent uses the other tool nodes as needed.

* The AI agent uses the OpenAI chat model nodes for language processing.

* The ImageGeneration node triggers the subworkflow.

## Subworkflow: Image Generation Workflow

The subworkflow generates images based on user input, allowing users to select from various artistic styles.

Nodes:

1. When Executed by Another Workflow:

* This trigger node receives input from the main workflow, specifically the user's query.

* It is configured with a JSON example.

2. Image Style Selection:

* This node sends a Telegram message to the user asking them to select a style for their image.

* It provides a custom form with a dropdown list of available styles.

3. Route by style:

* This Switch node routes the workflow based on the user's selected image style.

* Each style ("Hyper-Surreal Escape," "Post-Analog Glitchscape," etc.) has a corresponding output path.

4. Edit Fields (Style-specific nodes):

* These Set nodes define the stylePrompt variable for each selected style.

* The stylePrompt contains detailed instructions for the AI image generation model.

5. Merge:

* This merge node merges the query from the trigger node and the style prompt from the style selection.

6. Call hugginface inference api:

* This HTTP Request node sends the generated prompt to the Hugging Face Inference API to generate the image.

* It passes the user's query and the selected style prompt.

7. ImageOutput2Telegram:

* This node sends the generated image back to the user via Telegram.

Connections:

* The trigger initiates the style selection.

* The style selection initiates the style router.

* The style router initiates the style specific set nodes.

* The set nodes connect to the merge node.

* The merge node connects to the hugginface api call.

* The hugginface api call connects to the telegram output.

Key Functionality:

*User Input:** The workflow accepts user input from Telegram messages.

*Style Selection:** Users can choose from a variety of image styles.

*AI-Powered Generation:** The workflow leverages AI models (OpenAI, Hugging Face) to process user input and generate images.

*Telegram Integration:** The workflow interacts with Telegram to receive input and send output.

*Customizable Styles:** The stylePrompt allows for highly customizable image generation.

Setup:

* Configure Telegram API credentials.

* Configure the HuggingFace API credentials.

* Configure the Open AI API credentials.

* Setup the MCP client credentials.

* Ensure the n8n instance has access to the internet.

This workflow provides a flexible and powerful solution for AI-based image generation with user-selected styles, integrated seamlessly with Telegram.

Like this article? Share it.

You might also like

Check out our latest pieces on Ai Voice agents & APIs.

View other blogs you might be interested in

finops + agentic ai

Get Started Today

Whether your priority is reducing cloud costs, deploying Agentic AI, or both — we’ll design a clear, actionable roadmap to deliver measurable results.

Accelerate analysis and recommendations

Automate routine optimisation tasks

Free your teams to focus on strategic priorities

finops + agentic ai

Get Started Today

Whether your priority is reducing cloud costs, deploying Agentic AI, or both — we’ll design a clear, actionable roadmap to deliver measurable results.

Accelerate analysis and recommendations

Automate routine optimisation tasks

Free your teams to focus on strategic priorities

finops + agentic ai

Get Started Today

Whether your priority is reducing cloud costs, deploying Agentic AI, or both — we’ll design a clear, actionable roadmap to deliver measurable results.

Accelerate analysis and recommendations

Automate routine optimisation tasks

Free your teams to focus on strategic priorities

finops + agentic ai

Get Started Today

Whether your priority is reducing cloud costs, deploying Agentic AI, or both — we’ll design a clear, actionable roadmap to deliver measurable results.

Accelerate analysis and recommendations

Automate routine optimisation tasks

Free your teams to focus on strategic priorities