← All N8N workflows
AI & researchAgentCodeExecute Workflow TriggerOpenAI Chat ModelMemory Buffer Window

Optimize Prompt

Configured with Agent, Execute Workflow Trigger, OpenAI Chat Model, Memory Buffer Window, and additional nodes. Review the connections and setup before adapting this template.

Workflow preview
TriggerWhen Executed byAnother WorkflowExecute Workflow TriggerAI & modelsAI AgentAgentMessagingTelegram3TelegramAI & modelsOpenAI Chat ModelOpenAI Chat ModelCodeSplit into chunks1CodeData storeSimple MemoryMemory Buffer Window

Node categories in this workflow

  • Trigger
  • AI & models
  • Messaging
  • Code
  • Data store

Icons describe general node roles, inferred from node types. Inspect the parameters for the configured action.

Drag to pan; use + and − to zoom. Reconstructed from the exported node positions; nothing runs here. Dashed lines represent non-main connections. Full node names and notes appear below.

How it works

The exported workflow contains the following configured nodes. Their connections are shown above; inspect the JSON for the complete logic, expressions, and external actions.

Workflow node names, types, and operations
NodeCategoryTypeOperation
When Executed by Another WorkflowTriggerExecute Workflow TriggerSee node parameters
AI AgentAI & modelsAgentSee node parameters
Telegram3MessagingTelegramSee node parameters
OpenAI Chat ModelAI & modelsOpenAI Chat ModelSee node parameters
Split into chunks1CodeCodeSee node parameters
Simple MemoryData storeMemory Buffer WindowSee node parameters

Setup

  1. Download the JSON and import it into an isolated n8n instance. Leave the workflow inactive.
  2. Connect your own credentials through n8n’s credential store. Replace REPLACE_WITH_* values with your resource identifiers.
  3. Inspect API destinations, Code nodes, database queries, file paths, and outbound actions.
  4. Run with synthetic data and harmless destinations. Enable triggers only after checking the actual outputs.

Requirements

An n8n instance with the listed node types and compatible versions. Service-connected workflows may require accounts, credentials, or paid APIs.

Credential types declared in the source

  • openAiApi
  • telegramApi

Workflow notes

Trigger

Trigger

  • Trigger can be anything. For this example the trigger is a call from another workflow and a received Telegram message.

  • Note that this workflow can be integrated in the middle of another larger workflow.

Inference / Optimization

Inference / Optimization

  • Incoming trigger is processed by a LLM with a specific system prompt set aimed at improving the input prompt.
Improved prompt:

Improved prompt:

  • Send as a response

  • Use as input for next nodes

Workflow Documentation

Workflow Documentation

Description:

This workflow is designed to optimize prompts by enhancing user inputs for clarity and specificity using AI. The workflow takes a user-provided prompt as input and uses a Natural Language Processing (NLP) model to refine and improve the prompt. The optimized prompt is then sent back to the user, ready for use in further workflows or processes.

Setup:

  1. This workflow is suitable for users who want to improve their prompts for better communication and understanding in their workflows.
  2. The workflow utilizes an AI Agent powered by an OpenAI Chat Model to enhance user prompts.
  3. A Telegram node is used to deliver the optimized prompt back to the user.
  4. Ensure you have the necessary credentials set up for Telegram and OpenAI accounts.
  5. Customize the workflow's settings, such as the AI model used for prompt optimization, to suit your requirements.
  6. Activate the workflow once all configurations are set to start optimizing prompts efficiently.

Expected Outcomes:

  • Users can provide vague or imprecise prompts as input to the workflow.
  • The AI Agent will refine and optimize the prompt, adding clarity and specific details.
  • The optimized prompt will be delivered back to the user via Telegram for further use in workflows or processes.

For more detailed instructions and guidelines on using this workflow, refer to the detailed setup guide above.

Optimize Prompt

Optimize Prompt

Purpose and structure

This folder contains the Optimize Prompt workflow. Its executable nodes use agent, code, executeWorkflowTrigger, lmChatOpenAi, memoryBufferWindow, telegram. The table and connection map below are derived from the JSON, not an inferred guarantee of behavior.

Setup

Import inactive. Configure your own credentials and replace REPLACE_WITH_* values. Review external destinations and Code nodes before running.

Entry points

When Executed by Another Workflow

Verification

Sanitized source candidate; not runtime-tested. This overview is generated from node metadata. Read the folder README for the connection map, credential types, and license.

Attribution

https://github.com/Zie619/n8n-workflows/blob/94007c1445d9258a7da116646b79473e7c7c3282/workflows/Telegram/1877_Telegram_Stickynote_Automation_Triggered.json MIT; preserve source notices.

More in AI & research