Use this powerful n8n workflow to automatically enhance vague AI prompts into highly specific, optimized instructions using GPT-4o-mini. Delivers the refined prompt via Telegram.
Download this n8n workflow template and start using it instantly.
-
Developers or researchers who frequently use AI models and need consistently high-quality, detailed prompts.
Automation specialists looking for advanced n8n templates that integrate custom code with AI services.
Users of n8n who want to build modular n8n workflows for prompt engineering.
Anyone needing reliable messaging delivery for long AI outputs.
Achieving precise results from modern LLMs often requires highly detailed and structured prompts. This n8n workflow solves the problem of vague user input by acting as a 'Prompt Enhancer.' Utilizing the powerful GPT-4o-mini model within an n8n node structure, it automatically takes a simple, initial prompt and rewrites it according to strict quality guidelines (e.g., adding context, specifying format, defining length). This specific n8n workflow is designed to be a subprocess, allowing it to be easily integrated into larger applications. Crucially, the final optimized prompt is robustly delivered via Telegram, using a custom code n8n node to ensure even very long outputs are correctly chunked and formatted to respect Telegram's character limits. This makes it an invaluable addition to any advanced n8n automation toolkit.
This modular n8n workflow is designed to be executed by a parent n8n workflow or a preceding n8n trigger (such as a Telegram message trigger).
$json.query) and the recipient's Telegram chat ID (chatid) from the calling n8n workflow.gpt-4o-mini for cost-effective and high-quality processing.chatid provided by the initial n8n trigger. This completes the n8n automation cycle.To utilize this prompt optimization n8n workflow, follow these steps:
query (the prompt to be optimized) and chat_id parameters.-
When Executed by Another Workflow (n8n trigger):
Function: Serves as the entry point, allowing this to function as a modular subroutine within a larger n8n workflow structure. It receives the input prompt (query) and the destination chat ID.
Key Configuration: Input Source set to passthrough.
OpenAI Chat Model (n8n node):
Function: Defines the AI model used for prompt enhancement.
Key Configuration: Model selected is gpt-4o-mini.
AI Agent (n8n node):
Function: Executes the core prompt engineering logic based on a highly detailed system prompt to refine user input.
Key Configuration: The system message specifies requirements for clarity, format, specific details, and markdown output.
Split into chunks1 (n8n node - Code):
Function: Custom JavaScript code to handle post-processing. It splits the potentially large optimized prompt into smaller chunks (max 3072 chars) compatible with Telegram limits, ensuring reliable delivery. It also adds Markdown formatting.
Telegram3 (n8n node):
Function: Sends the optimized, chunked prompt messages to the specific recipient identified by the input chatId.
Key Configuration: Text uses an expression referencing the chunked output ({{ $json.text }}), and ChatId is dynamically pulled from the initial n8n trigger input.
Use this expert n8n workflow to enhance AI chatbot responses by integrating GraphRAG via InfraNodus, transforming user queries into structured knowledge base lookups. Leverage custom n8n templates.

Use this powerful n8n workflow to automatically upscale images using Replicate's AI (CodeFormer) and expand them to a perfect 3:2 aspect ratio using LightX, delivering the final result via Telegram.

Use this powerful n8n workflow template to schedule automated English vocabulary lessons sent directly to Telegram, leveraging the Google Gemini LLM and core n8n nodes for data manipulation.

Build an advanced RAG chatbot using this specialized n8n workflow. It uses the n8n node for Bright Data search engines (Google, Bing, Yandex) and Google Gemini for informed, real-time AI responses.

Use this advanced n8n workflow to buffer rapid user messages via Twilio and Redis, ensuring your AI agent sends one consolidated reply instead of fragmented, expensive responses.








































