Who is this workflow for? Streamline your AI prompt workflows by dynamically fetching prompts from GitHub and automatically populating variables within n8n expressions. This workflow ensures efficient prompt management, reduces manual intervention, and maintains consistency in AI interactions..

What does this workflow do?

1. Retrieve the Prompt from GitHub

  • Trigger: Initiates manually or through an external event.
  • HTTP Request: Connects to the GitHub repository to fetch the raw prompt file.
  • Extract from File: Extracts the content from the fetched GitHub file.
  • SetPrompt: Stores the retrieved prompt for further processing.

Note: Prompts must include n8n expression format variables (e.g., {{ $json.company }}) to enable dynamic replacement.

2. Extract & Auto-Populate Variables

  • Code Node: Scans the prompt for placeholders in the n8n expression format.
  • Check Variables: Compares the required variables in the prompt against those defined in the setVars node.
  • All Variables Present: Proceeds to replace placeholders with actual values.
  • Missing Variables: Halts the workflow and returns an error specifying the missing variables.
  • Replace Variables: Substitutes all placeholders with corresponding values from the setVars node.

Example Prompt:

Hello {{ $json.company }}, your product {{ $json.features }} launches on {{ $json.launch_date }}.

3. AI Processing & Output

  • Set Completed Prompt: Saves the finalized prompt after variable replacement.
  • AI Agent: Processes the prompt using an AI model (e.g., Ollama).
  • Prompt Output: Delivers the fully formatted AI response.

Optional: Integrate alternative AI models such as OpenAI or Claude by modifying the AI Agent node.

1. Connect Your GitHub Repository

  • Store your prompts in a public or private GitHub repository.
  • Configure the workflow to fetch the raw prompt file using the GitHub API.

2. Configure the SetVars Node

  • Define all required variables within the setVars node.
  • Ensure variable names match those used in your prompt templates.

3. Test & Run

  • Execute the workflow using the “Test Workflow” option.
  • Address any errors related to missing variables as indicated.
  • Upon successful execution, the workflow outputs the fully formatted prompt ready for AI processing.
  • CRM or Database Integration: Connect the setVars node to APIs like Airtable, Google Sheets, or HubSpot to dynamically source variables.
  • AI Model Modification: Switch the AI Agent to use different models such as OpenAI or Claude by updating the respective node configurations.
  • No Manual Updates Needed: Automatically fetches and updates prompts from GitHub.
  • Ensures Prompt Integrity: Validates the presence of all required variables before execution.
  • Versatile Application: Suitable for AI chat prompts, marketing messages, and more.
  • Universal Compatibility: Operates seamlessly on Cloud, Self-Hosted, and Desktop versions of n8n.

By implementing this workflow, you enhance the efficiency and reliability of your AI-driven processes, ensuring that your prompts are always up-to-date and correctly formatted.

🤖 Why Use This Automation Workflow?

  • Automated Prompt Retrieval: Fetches the latest prompts from GitHub without manual updates.
  • Dynamic Variable Population: Automatically replaces placeholders with defined variables, ensuring accuracy.
  • Error Prevention: Validates the presence of all required variables before executing AI processes.
  • Scalable Integration: Supports various AI models and integrates seamlessly with multiple platforms.

👨‍💻 Who is This Workflow For?

This workflow is ideal for AI engineers, automation specialists, and content creators who require a robust system to manage and deploy dynamic prompts efficiently. It caters to professionals seeking to enhance their AI-driven applications with reliable and maintainable prompt handling.

🎯 Use Cases

  1. AI Chatbots: Automatically update chatbot responses based on the latest prompts stored in GitHub.
  2. Marketing Campaigns: Dynamically generate personalized marketing messages using predefined variables.
  3. Content Generation: Streamline the creation of content scripts by managing templates and variables centrally.

TL;DR

This workflow automates the retrieval and management of AI prompts from GitHub, ensuring that all necessary variables are dynamically populated and validated. By eliminating manual updates and enforcing variable integrity, it provides a reliable and scalable solution for managing AI-driven interactions across various applications.

Help us find the best n8n templates

About

A curated directory of the best n8n templates for workflow automations.