Skip to main content

Fetch dynamic prompts from GitHub and auto-populate n8n expressions in prompt

Workflow preview

Workflow preview
100%
Fetch dynamic prompts from GitHub and auto-populate n8n expressions in prompt preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

Who Is This For? This workflow is designed for AI engineers, automation specialists, and content creators who need a scalable system to dynamically manage prompts stored in GitHub. It eliminates ma...

Best for

  • Engineering automation workflows
  • Multimodal AI automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.manualtrigger, n8n-nodes-base.github, n8n-nodes-base.extractfromfile, n8n-nodes-base.set, n8n-nodes-base.code, n8n-nodes-base.if, n8n-nodes-base.stopanderror, @n8n/n8n-nodes-langchain.agent

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by RealSimple Solutions.

Original n8n.io source

1.1 Workflow description

Title
Fetch dynamic prompts from GitHub and auto-populate n8n expressions in prompt
Workflow name
Fetch dynamic prompts from GitHub and auto-populate n8n expressions in prompt

Who Is This For?

This workflow is designed for AI engineers, automation specialists, and content creators who need a scalable system to dynamically manage prompts stored in GitHub. It eliminates manual updates, enforces required variable checks, and ensures that AI interactions always receive fully processed prompts.


πŸš€ What Problem Does This Solve?

Manually managing AI prompts can be inefficient and error-prone. This workflow:
βœ… Fetches dynamic prompts from GitHub
βœ… Auto-populates placeholders with values from the setVars node
βœ… Ensures all required variables are present before execution
βœ… Processes the formatted prompt through an AI agent


πŸ›  How This Workflow Works

This workflow consists of three key branches, ensuring smooth prompt retrieval, variable validation, and AI processing.


1️⃣ Retrieve the Prompt from GitHub (HTTP Request β†’ Extract from File β†’ SetPrompt)

  • The workflow starts manually or via an external trigger.
  • It fetches a text-based prompt stored in a GitHub repository.
  • The Extract from File Node retrieves the content from the GitHub file.
  • The SetPrompt Node stores the prompt, making it accessible for processing.

πŸ“Œ Note:
The prompt must contain n8n expression format variables (e.g., {{ $json.company }}) so they can be dynamically replaced.


2️⃣ Extract & Auto-Populate Variables (Check All Prompt Vars β†’ Replace Variables)

  • A Code Node scans the prompt for placeholders in the n8n expression format ({{ $json.variableName }}).
  • The workflow compares required variables against the setVars node:
    • βœ… If all variables are present, it proceeds to variable replacement.
    • ❌ If any variables are missing, the workflow stops and returns an error listing them.
  • The Replace Variables Node replaces all placeholders with values from setVars.

πŸ“Œ Example of a properly formatted GitHub prompt:

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

This ensures seamless replacement when processed in n8n.


3️⃣ AI Processing & Output (AI Agent β†’ Prompt Output)

  • The Set Completed Prompt Node stores the final, processed prompt.
  • The AI Agent Node (Ollama Chat Model) processes the prompt.
  • The Prompt Output Node returns the fully formatted response.

πŸ“Œ Optional: Modify this to use OpenAI, Claude, or other AI models.


⚠️ Error Handling: Missing Variables

If a required variable is missing, the workflow stops execution and provides an error message:

⚠️ Missing Required Variables: ["launch_date"]

This ensures no incomplete prompts are sent to AI agents.


βœ… Example Use Case

πŸ“œ GitHub Prompt File (Using n8n Expressions)

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

πŸ”Ή Variables in setVars Node

{
  "company": "PropTechPro",
  "features": "AI-powered Property Management",
  "launch_date": "March 15, 2025"
}

βœ… Successful Output

Hello PropTechPro, your product AI-powered Property Management launches on March 15, 2025.

🚨 Error Output (If Missing launch_date)

⚠️ Missing Required Variables: ["launch_date"]

πŸ”§ Setup Instructions

1️⃣ Connect Your GitHub Repository

  • Store your prompt in a public or private GitHub repo.
  • The workflow will fetch the raw file using the GitHub API.

2️⃣ Configure the SetVars Node

  • Define the required variables in the SetVars Node.
  • Make sure the variable names match those used in the prompt.

3️⃣ Test & Run

  • Click Test Workflow to execute.
  • If variables are missing, it will show an error.
  • If everything is correct, it will output the fully formatted prompt.

⚑ How to Customize This Workflow

πŸ’‘ Need CRM or Database Integration?

  • Connect the setVars node to an Airtable, Google Sheets, or HubSpot API to pull variables dynamically.

πŸ’‘ Want to Modify the AI Model?

  • Replace the Ollama Chat Model with OpenAI, Claude, or a custom LLM endpoint.

πŸ“Œ Why Use This Workflow?

βœ… No Manual Updates Required – Fetches prompts dynamically from GitHub.
βœ… Prevents Broken Prompts – Ensures required variables exist before execution.
βœ… Works for Any Use Case – Handles AI chat prompts, marketing messages, and chatbot scripts.
βœ… Compatible with All n8n Deployments – Works on Cloud, Self-Hosted, and Desktop versions.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - When clicking β€˜Test workflow’

Type / Role
n8n-nodes-base.manualTrigger - manualTrigger
Config choices
Version 1

Block 2 - GitHub

Type / Role
n8n-nodes-base.github - github
Config choices
Version 1

Block 3 - Extract from File

Type / Role
n8n-nodes-base.extractFromFile - extractFromFile
Config choices
Version 1

Block 4 - setVars

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 5 - replace variables

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 6 - If

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 7 - Check All Prompt Vars Present

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 8 - SetPrompt

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 9 - Stop and Error

Type / Role
n8n-nodes-base.stopAndError - stopAndError
Config choices
Version 1

Block 10 - Set Completed Prompt

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 11 - AI Agent

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 1.7

Block 12 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 13 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 14 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 15 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 16 - Prompt Output

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 17 - Ollama Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatOllama - lmChatOllama
Config choices
Version 1

3. Summary Table

Workflow Fetch dynamic prompts from GitHub and auto-populate n8n expressions in prompt
Complexity advanced
Nodes 17
Categories Engineering, Multimodal AI
Author RealSimple Solutions
Published 12 Feb 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/2893/2893.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Fetch dynamic prompts from GitHub and auto-populate n8n expressions in prompt do?

Who Is This For? This workflow is designed for AI engineers, automation specialists, and content creators who need a scalable system to dynamically manage prompts stored in GitHub. It eliminates ma...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Engineering, Multimodal AI use case.