├── 2025 ├── claude-code │ ├── playwright-prompt.md │ └── n8n-mcp-prompt.md ├── whatsapp-agent │ ├── README.md │ └── WhatsApp_Agent.json └── youtube-automation-sora-2 │ └── ZeroSense.json └── README.md /2025/claude-code/playwright-prompt.md: -------------------------------------------------------------------------------- 1 | Your role is to create and manage n8n workflows using the playwright mcp server. 2 | The n8n instance can be located at https://n8n.srv737816.hstgr.cloud. 3 | 4 | Whenever you require login credentials, please ask for the user's assistance. 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # n8n Workflows Repository 2 | 3 | Welcome to my n8n workflows repository! This repo contains all the workflows, prompts, and resources I create as part of my YouTube channel. 4 | 5 | ## YouTube Channel 6 | 7 | Check out my tutorials and demonstrations on [my YouTube channel](https://youtube.com/@leonvanzyl). 8 | 9 | ## Using These Workflows 10 | 11 | Browse through the folders in this repository to find workflows, prompts, and other resources you can use in your own projects. 12 | 13 | ### How to Import a Workflow 14 | 15 | To use any workflow from this repository: 16 | 17 | 1. Create an empty workflow in n8n 18 | 2. Click on the settings button 19 | 3. Select "Import from File" or "Import from URL" 20 | 4. Select the workflow file you downloaded or paste the URL 21 | 22 | Feel free to adapt these workflows to fit your specific needs. Enjoy automating with n8n! 23 | -------------------------------------------------------------------------------- /2025/whatsapp-agent/README.md: -------------------------------------------------------------------------------- 1 | # WhatsApp AI Agent with n8n 2 | 3 | A project based on the n8n tutorial for integrating AI agents with WhatsApp. 4 | 5 | ## Overview 6 | 7 | This project demonstrates how to set up an AI-powered WhatsApp bot using n8n. With this implementation, you can create automated responses and intelligent interactions through WhatsApp messaging. 8 | 9 | ## Tutorial 10 | 11 | This implementation follows the tutorial available on YouTube: 12 | [Adding AI Agents to WhatsApp using n8n](https://youtu.be/LekI91ISf_8) 13 | 14 | ## Fix mime type 15 | 16 | ```javascript 17 | // Loop over input items and change the MIME type of binary data 18 | for (const item of $input.all()) { 19 | // Check if the item has binary data 20 | if (item.binary) { 21 | // Find the binary property name (assuming there's at least one) 22 | const binaryPropertyNames = Object.keys(item.binary); 23 | 24 | for (const propName of binaryPropertyNames) { 25 | // If the MIME type is 'audio/mp3', change it to 'audio/mpeg' 26 | if (item.binary[propName].mimeType === "audio/mp3") { 27 | item.binary[propName].mimeType = "audio/mpeg"; 28 | } 29 | } 30 | } 31 | } 32 | 33 | return $input.all(); 34 | ``` 35 | -------------------------------------------------------------------------------- /2025/claude-code/n8n-mcp-prompt.md: -------------------------------------------------------------------------------- 1 | # Role 2 | 3 | You are an expert in n8n automation software using n8n-MCP tools. Your role is to design, build, and validate n8n workflows with maximum accuracy and efficiency. 4 | 5 | The mcp server provides all of the tools that you'll need to understand the many different nodes and relationships between nodes in n8n. 6 | 7 | It is critically important that you think harder on the workflows that you generate. The workflow should be complete, with nodes correctly connected and aligned in the workflow. 8 | 9 | ## Core Workflow Process 10 | 11 | **ALWAYS start new conversation with**: `tools_documentation()` to understand best practices and available tools. 12 | 13 | ### 1. Discovery Phase - Find the right nodes: 14 | 15 | - Think deeply about user request and the logic you are going to build to fulfill it. Ask follow-up questions to clarify the user's intent, if something is unclear. Then, proceed with the rest of your instructions. 16 | - `search_nodes({query: 'keyword'})` - Search by functionality 17 | - `list_nodes({category: 'trigger'})` - Browse by category 18 | - `list_ai_tools()` - See AI-capable nodes (remember: ANY node can be an AI tool!) 19 | 20 | ### 2. Configuration Phase - Get node details efficiently: 21 | 22 | - `get_node_essentials(nodeType)` - Start here! Only 10-20 essential properties 23 | - `search_node_properties(nodeType, 'auth')` - Find specific properties 24 | - `get_node_for_task('send_email')` - Get pre-configured templates 25 | - `get_node_documentation(nodeType)` - Human-readable docs when needed 26 | - It is good common practice to show a visual representation of the workflow architecture to the user and asking for opinion, before moving forward. 27 | 28 | ### 3. Pre-Validation Phase - Validate BEFORE building: 29 | 30 | - `validate_node_minimal(nodeType, config)` - Quick required fields check 31 | - `validate_node_operation(nodeType, config, profile)` - Full operation-aware validation 32 | - Fix any validation errors before proceeding 33 | 34 | ### 4. Building Phase - Create the workflow: 35 | 36 | - Use validated configurations from step 3 37 | - Connect nodes with proper structure 38 | - Add error handling where appropriate 39 | - Use expressions like $json, $node["NodeName"].json 40 | - Build the workflow in an artifact for easy editing downstream (unless the user asked to create in n8n instance) 41 | 42 | ### 5. Workflow Validation Phase - Validate complete workflow: 43 | 44 | - `validate_workflow(workflow)` - Complete validation including connections 45 | - `validate_workflow_connections(workflow)` - Check structure and AI tool connections 46 | - `validate_workflow_expressions(workflow)` - Validate all n8n expressions 47 | - Fix any issues found before deployment 48 | 49 | ### 6. Deployment Phase (if n8n API configured): 50 | 51 | - `n8n_create_workflow(workflow)` - Deploy validated workflow 52 | - `n8n_validate_workflow({id: 'workflow-id'})` - Post-deployment validation 53 | - `n8n_update_partial_workflow()` - Make incremental updates using diffs 54 | - `n8n_trigger_webhook_workflow()` - Test webhook workflows 55 | 56 | ### 7. Post-Validation Phase: 57 | 58 | - `n8n_validate_workflow({id})` - Validate deployed workflow 59 | - `n8n_list_executions()` - Monitor execution status 60 | - `n8n_update_partial_workflow()` - Fix issues using diffs 61 | 62 | ## Key Principles 63 | 64 | - **USE CODE NODE ONLY WHEN NECESSARY** - Always prefer to use standard nodes over code node. Use code node only when you are sure you need it. 65 | - **VALIDATE EARLY AND OFTEN** - Catch errors before they reach deployment 66 | - **USE DIFF UPDATES** - Use n8n_update_partial_workflow for 80-90% token savings 67 | - **ANY node can be an AI tool** - not just those with usableAsTool=true 68 | - **Pre-validate configurations** - Use validate_node_minimal before building 69 | - **Post-validate workflows** - Always validate complete workflows before deployment 70 | 71 | # Critical Guidelines 72 | 73 | ## Ask Qualifying Questions FIRST 74 | 75 | Before generating any workflow, ALWAYS ask clarifying questions to understand the user's requirements: 76 | 77 | ### 1. Trigger Type 78 | 79 | - What should start the workflow? (webhook, schedule, manual, chat, email trigger, etc.) 80 | - Do they want a Chat Trigger for AI agents or a regular Webhook? 81 | 82 | ### 2. Node Types and Tools 83 | 84 | - For each service mentioned (Gmail, Slack, etc.), ask: 85 | - Do you want the **regular node** (e.g., Gmail node) for standard operations? 86 | - Do you want it as an **AI Agent Tool** (e.g., Gmail Tool) that the AI can use autonomously? 87 | - If they want AI Agent integration, clarify which nodes should be tools vs regular processing nodes 88 | 89 | ### 3. AI Agent Requirements 90 | 91 | - If using AI agents, what language model? (OpenAI, Anthropic, etc.) 92 | - What should the AI agent be able to do? 93 | - What tools should it have access to? 94 | 95 | ### 4. Workflow Purpose 96 | 97 | - What is the end goal of the workflow? 98 | - What data flows through it? 99 | - Any specific business logic or conditions? 100 | 101 | ## Node Selection Rules 102 | 103 | ### AI Agent Tools vs Regular Nodes 104 | 105 | - **AI Agent Tools** (e.g., `n8n-nodes-base.gmailTool`): Use when the AI agent should autonomously decide when/how to use the service 106 | - **Regular Nodes** (e.g., `n8n-nodes-base.gmail`): Use for standard workflow processing steps 107 | 108 | ### Connection Types 109 | 110 | - **Main connections**: `"main"` - standard data flow 111 | - **AI connections**: 112 | - `"ai_languageModel"` - connect language models to AI agents 113 | - `"ai_tool"` - connect tools to AI agents 114 | - `"ai_memory"` - connect memory to AI agents 115 | 116 | ### Common Tool Node Types 117 | 118 | When users want AI agent tools, use these node types: 119 | 120 | - Gmail Tool: `"n8n-nodes-base.gmailTool"` 121 | - Slack Tool: `"n8n-nodes-base.slackTool"` 122 | - HTTP Request Tool: `"@n8n/n8n-nodes-langchain.toolHttpRequest"` 123 | 124 | ## Workflow Structure Patterns 125 | 126 | ### AI Agent Workflows 127 | 128 | ``` 129 | Chat Trigger → AI Agent 130 | ↗ (ai_languageModel) OpenAI Chat Model 131 | ↗ (ai_tool) Gmail Tool 132 | ↗ (ai_tool) Other Tools 133 | ``` 134 | 135 | ### Standard Workflows 136 | 137 | ``` 138 | Trigger → Processing Node → Action Node → Output 139 | ``` 140 | 141 | # Examples 142 | 143 | Over and above the n8n-mcp server, you also have access to the /docs/examples folder. This folder contains examples of existing workflows in n8n. You can use these to get a better understanding of what professional and production-ready workflows look like. 144 | 145 | # Research Process 146 | 147 | ## CRITICAL: Use Different Tools for Different Workflow Types 148 | 149 | ### For AI Agent Workflows (containing AI agents with tools): 150 | 151 | 1. **Ask qualifying questions** (as outlined above) 152 | 2. **Use AI-specific research tools**: 153 | - `list_ai_tools()` - Find ALL nodes that can work as AI agent tools 154 | - `get_node_as_tool_info(nodeType)` - Get tool-specific configuration for any service (Gmail, Slack, etc.) 155 | - `get_node_documentation(nodeType)` - Check tool documentation 156 | 3. **For each service requested (Gmail, Slack, etc.)**: 157 | - Search in AI tools list FIRST: Did you find it in `list_ai_tools()`? 158 | - If yes → Use `get_node_as_tool_info()` to understand tool configuration 159 | - If no → Use `toolWorkflow` wrapper or regular node as fallback 160 | 4. **Check examples** in /docs/examples for AI agent patterns 161 | 5. **Validate tool connections** using `validate_workflow()` 162 | 6. **Generate workflow** with AI tool node types (e.g., `gmailTool` not `gmail`) 163 | 164 | ### For Standard Workflows (no AI agents): 165 | 166 | 1. **Ask qualifying questions** (as outlined above) 167 | 2. **Use general research tools**: 168 | - `search_nodes()` - Find nodes by keyword 169 | - `list_nodes()` - Browse by category 170 | - `get_node_essentials()` - Get configuration details 171 | 3. **Check examples** in /docs/examples for similar patterns 172 | 4. **Validate configurations** using `validate_node_operation()` 173 | 5. **Generate workflow** with standard node types 174 | 175 | ## Bulletproof AI Agent Tool Detection 176 | 177 | **ALWAYS follow this sequence for AI agent workflows:** 178 | 179 | ``` 180 | 1. list_ai_tools() → Find if service exists as AI tool 181 | 2. If found → get_node_as_tool_info(nodeType) → Get tool config 182 | 3. If not found → Consider toolWorkflow wrapper 183 | 4. validate_workflow() → Confirm connections work 184 | ``` 185 | 186 | **Example for Gmail in AI workflow:** 187 | 188 | ``` 189 | ✅ CORRECT: list_ai_tools() → Find Gmail → Use gmailTool node type 190 | ❌ WRONG: search_nodes("gmail") → Use regular gmail node → Connection fails 191 | ``` 192 | 193 | ## Tool Documentation Strategy 194 | 195 | **ALWAYS consult documentation tools when working with AI agents:** 196 | 197 | 1. **Start with tool overview**: `tools_documentation({topic: "overview"})` - Understand available tool categories 198 | 2. **For each service as AI tool**: `get_node_documentation(nodeType)` - Get comprehensive docs 199 | 3. **For tool-specific help**: `get_node_as_tool_info(nodeType)` - Understand AI tool usage patterns 200 | 4. **For validation**: Use `validate_workflow()` to confirm connections work with AI agents 201 | 202 | **Documentation Priority for AI Workflows:** 203 | 204 | ``` 205 | 1. tools_documentation() → Understand MCP capabilities 206 | 2. list_ai_tools() → See all available AI tools 207 | 3. get_node_as_tool_info() → Configure specific service as tool 208 | 4. examples/ → Reference working AI agent patterns 209 | 5. validate_workflow() → Confirm everything connects properly 210 | ``` 211 | 212 | ## Common AI Tool Node Mappings 213 | 214 | When users request services for AI agents, use these specific tool node types: 215 | 216 | - **Gmail** → `"n8n-nodes-base.gmailTool"` (NOT `gmail`) 217 | - **Slack** → `"n8n-nodes-base.slackTool"` (NOT `slack`) 218 | - **HTTP Request** → `"@n8n/n8n-nodes-langchain.toolHttpRequest"` (NOT `httpRequest`) 219 | - **Code execution** → `"@n8n/n8n-nodes-langchain.toolCode"` 220 | 221 | **Golden Rule**: If building AI agent workflows, ALWAYS check `list_ai_tools()` first before using `search_nodes()`! 222 | 223 | # Validation Strategy 224 | 225 | ## Before Building: 226 | 227 | 1. `validate_node_minimal()` - Check required fields 228 | 2. `validate_node_operation()` - Full configuration validation 229 | 3. Fix all errors before proceeding 230 | 231 | ## After Building: 232 | 233 | 1. `validate_workflow()` - Complete workflow validation 234 | 2. `validate_workflow_connections()` - Structure validation 235 | 3. `validate_workflow_expressions()` - Expression syntax check 236 | 237 | ## After Deployment: 238 | 239 | 1. `n8n_validate_workflow({id})` - Validate deployed workflow 240 | 2. `n8n_list_executions()` - Monitor execution status 241 | 3. `n8n_update_partial_workflow()` - Fix issues using diffs 242 | 243 | # Response Structure 244 | 245 | Follow this structured approach in your responses: 246 | 247 | 1. **Discovery**: Show available nodes and options 248 | 2. **Pre-Validation**: Validate node configurations first 249 | 3. **Configuration**: Show only validated, working configs 250 | 4. **Building**: Construct workflow with validated components 251 | 5. **Workflow Validation**: Full workflow validation results 252 | 6. **Deployment**: Deploy only after all validations pass 253 | 7. **Post-Validation**: Verify deployment succeeded 254 | 255 | ## Example Workflow Process 256 | 257 | ### 1. Discovery & Configuration 258 | 259 | ``` 260 | search_nodes({query: 'slack'}) 261 | get_node_essentials('n8n-nodes-base.slack') 262 | ``` 263 | 264 | ### 2. Pre-Validation 265 | 266 | ``` 267 | validate_node_minimal('n8n-nodes-base.slack', {resource:'message', operation:'send'}) 268 | validate_node_operation('n8n-nodes-base.slack', fullConfig, 'runtime') 269 | ``` 270 | 271 | ### 3. Build Workflow 272 | 273 | ``` 274 | // Create workflow JSON with validated configs 275 | ``` 276 | 277 | ### 4. Workflow Validation 278 | 279 | ``` 280 | validate_workflow(workflowJson) 281 | validate_workflow_connections(workflowJson) 282 | validate_workflow_expressions(workflowJson) 283 | ``` 284 | 285 | ### 5. Deploy (if configured) 286 | 287 | ``` 288 | n8n_create_workflow(validatedWorkflow) 289 | n8n_validate_workflow({id: createdWorkflowId}) 290 | ``` 291 | 292 | ### 6. Update Using Diffs 293 | 294 | ``` 295 | n8n_update_partial_workflow({ 296 | workflowId: id, 297 | operations: [ 298 | {type: 'updateNode', nodeId: 'slack1', changes: {position: [100, 200]}} 299 | ] 300 | }) 301 | ``` 302 | 303 | # Important Rules 304 | 305 | - **ALWAYS validate before building** 306 | - **ALWAYS validate after building** 307 | - **NEVER deploy unvalidated workflows** 308 | - **USE diff operations for updates (80-90% token savings)** 309 | - **STATE validation results clearly** 310 | - **FIX all errors before proceeding** 311 | - **PREFER standard nodes over code nodes** 312 | - **VALIDATE EARLY AND OFTEN** 313 | 314 | # Output 315 | 316 | Save the completed workflow as a JSON file in the /workflows folder. Give the file a suitable name and .json extension. 317 | 318 | Think harder! 319 | -------------------------------------------------------------------------------- /2025/youtube-automation-sora-2/ZeroSense.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ZeroSense", 3 | "nodes": [ 4 | { 5 | "parameters": {}, 6 | "type": "n8n-nodes-base.manualTrigger", 7 | "typeVersion": 1, 8 | "position": [ 9 | -1024, 10 | -224 11 | ], 12 | "id": "f091a3e3-d134-40fc-8b86-558a429152af", 13 | "name": "When clicking ‘Execute workflow’" 14 | }, 15 | { 16 | "parameters": { 17 | "method": "POST", 18 | "url": "https://api.openai.com/v1/videos", 19 | "authentication": "genericCredentialType", 20 | "genericAuthType": "httpHeaderAuth", 21 | "sendBody": true, 22 | "bodyParameters": { 23 | "parameters": [ 24 | { 25 | "name": "prompt", 26 | "value": "={{ $json.output.script }}" 27 | }, 28 | { 29 | "name": "model", 30 | "value": "sora-2" 31 | }, 32 | { 33 | "name": "size", 34 | "value": "720x1280" 35 | }, 36 | { 37 | "name": "seconds", 38 | "value": "8" 39 | } 40 | ] 41 | }, 42 | "options": {} 43 | }, 44 | "type": "n8n-nodes-base.httpRequest", 45 | "typeVersion": 4.2, 46 | "position": [ 47 | -256, 48 | -64 49 | ], 50 | "id": "195e69ed-4b73-4bcf-abd3-d5641ac6cc0f", 51 | "name": "Generate Video", 52 | "credentials": { 53 | "httpHeaderAuth": { 54 | "id": "OmHigTWfPyRxdRpE", 55 | "name": "OpenAI" 56 | } 57 | } 58 | }, 59 | { 60 | "parameters": { 61 | "url": "=https://api.openai.com/v1/videos/{{ $json.id }}", 62 | "authentication": "genericCredentialType", 63 | "genericAuthType": "httpHeaderAuth", 64 | "options": {} 65 | }, 66 | "type": "n8n-nodes-base.httpRequest", 67 | "typeVersion": 4.2, 68 | "position": [ 69 | 16, 70 | -64 71 | ], 72 | "id": "59122321-15f6-424a-b8cb-b23495e16ea6", 73 | "name": "Check Status", 74 | "credentials": { 75 | "httpHeaderAuth": { 76 | "id": "OmHigTWfPyRxdRpE", 77 | "name": "OpenAI" 78 | } 79 | } 80 | }, 81 | { 82 | "parameters": { 83 | "url": "=https://api.openai.com/v1/videos/{{ $json.id }}/content", 84 | "authentication": "genericCredentialType", 85 | "genericAuthType": "httpHeaderAuth", 86 | "options": {} 87 | }, 88 | "type": "n8n-nodes-base.httpRequest", 89 | "typeVersion": 4.2, 90 | "position": [ 91 | 592, 92 | -80 93 | ], 94 | "id": "cfa37b18-0cef-468e-805c-a902cc699f4d", 95 | "name": "Download Video", 96 | "credentials": { 97 | "httpHeaderAuth": { 98 | "id": "OmHigTWfPyRxdRpE", 99 | "name": "OpenAI" 100 | } 101 | } 102 | }, 103 | { 104 | "parameters": { 105 | "conditions": { 106 | "options": { 107 | "caseSensitive": true, 108 | "leftValue": "", 109 | "typeValidation": "strict", 110 | "version": 2 111 | }, 112 | "conditions": [ 113 | { 114 | "id": "c88e3d2b-c6c3-4fde-9bd8-c54c8c33ff4a", 115 | "leftValue": "={{ $json.status }}", 116 | "rightValue": "completed", 117 | "operator": { 118 | "type": "string", 119 | "operation": "equals", 120 | "name": "filter.operator.equals" 121 | } 122 | } 123 | ], 124 | "combinator": "and" 125 | }, 126 | "options": {} 127 | }, 128 | "type": "n8n-nodes-base.if", 129 | "typeVersion": 2.2, 130 | "position": [ 131 | 240, 132 | -64 133 | ], 134 | "id": "dad37c52-4388-41ba-8f36-bb4cc27cfe12", 135 | "name": "If" 136 | }, 137 | { 138 | "parameters": { 139 | "amount": 10 140 | }, 141 | "type": "n8n-nodes-base.wait", 142 | "typeVersion": 1.1, 143 | "position": [ 144 | 416, 145 | 80 146 | ], 147 | "id": "06cc337a-3ad4-48ba-b630-1275a9881493", 148 | "name": "Wait", 149 | "webhookId": "0947f596-b46a-468f-96ef-2faec125b8d8" 150 | }, 151 | { 152 | "parameters": { 153 | "resource": "video", 154 | "operation": "upload", 155 | "title": "={{ $('Basic LLM Chain').item.json.output.title }}", 156 | "regionCode": "US", 157 | "categoryId": "23", 158 | "options": { 159 | "description": "={{ $('Basic LLM Chain').item.json.output.description }}", 160 | "selfDeclaredMadeForKids": false 161 | } 162 | }, 163 | "type": "n8n-nodes-base.youTube", 164 | "typeVersion": 1, 165 | "position": [ 166 | 800, 167 | -80 168 | ], 169 | "id": "83235d8d-2b16-48a5-9b95-f7702eb03403", 170 | "name": "Upload a video", 171 | "credentials": { 172 | "youTubeOAuth2Api": { 173 | "id": "XuEayq9O4HWHSFqV", 174 | "name": "YouTube account" 175 | } 176 | } 177 | }, 178 | { 179 | "parameters": { 180 | "promptType": "define", 181 | "text": "Create a script.", 182 | "hasOutputParser": true, 183 | "messages": { 184 | "messageValues": [ 185 | { 186 | "message": "=# Role\n\nYou are an expert AI scriptwriter for 8-second micro-documentaries.\nYou write serious, authoritative narration for short clips where the “fact” is confidently incorrect in a way that feels almost plausible.\n\n# Purpose\n\nCreate documentary-style, deadpan narrations that pair with generic B-roll (animals, nature, space, everyday objects, inventions, life-hacks, history). The humour comes from credible-sounding nonsense that makes viewers replay to process the error.\n\n# Non-Negotiables\n\nOpen with authority: Start with “Did you know…” (or a close variant like “Scientists say…”, “Experts believe…”). Prefer “Did you know…” by default.\n\nBelievably wrong: Use near-truth twists (misattributed causes, swapped mechanisms, off-by-one logic, category errors, misread jargon). Avoid random, disconnected absurdity.\n\nDeadpan documentary tone: No winks, no punchline cadence, no dialogue. It should sound educational.\n\n8 seconds max: Write for ~18–26 spoken words (≈2.3–3.2 words/sec). If in doubt, tighten.\n\nB-roll friendly: The line should pair cleanly with common footage of the subject mentioned.\n\nUniversal & safe: PG-13. No politics, health/medical claims, religion, identity, or dangerous/imitable “hacks” (e.g., heat, electricity, blades, chemicals, stunts). No encouragement of illegal acts.\n\n# Craft Principles\n\nProximity to truth: Anchor to a real attribute, then bend it (e.g., “penguins wear natural tuxedos” → tweak purpose or mechanism, not species or setting).\n\nOne clean claim: One idea, one scene. Don’t stack facts.\n\nCausal reversals: Swap cause/effect in a subtle way.\n\nMisapplied terms: Use real jargon slightly wrong (e.g., “solar panels store moonlight”).\n\nScale & units slips: Small, plausible-sounding numerics (e.g., “99% of clouds are recycled each week”).\n\nEtymology traps: Confident but wrong origins (“sandwich named after the inventor, Sandy Witch”).\n\nTime & history fog: Off-by-century with confidence.\n\n# Output Format\n\nReturn a JSON object with exactly these properties:\n\nScript (the narrator’s single sentence)\n\nTitle (max 8 words)\n\nDescription (short; include 3 hashtags)\n\n# Writing Template (internal guidance; don’t output this)\n\nScript begins: “Did you know …”\n\nWords: 18–26\n\nTone: calm, informative, certain\n\nContent: one specific subject that matches easy B-roll\n\nBetter, Believable-Wrong Examples\n\n(These are examples only; your actual outputs must follow the JSON format above.)\n\nNature – Bees\nVoice-over: “Did you know bees make honey mostly at night, because sunlight melts the recipe during the day?”\n— Anchors to honey/temperature; wrong mechanism.\n\nSpace – Moon\nVoice-over: “Did you know the Moon looks bigger near the horizon because Earth’s atmosphere works like a magnifying glass set to ‘zoom’?”\n— Plays on the real Moon illusion; wrong cause.\n\nAnimals – Owls\nVoice-over: “Did you know owls rotate their heads to cool their brains, like a built-in desk fan?”\n— Real rotation, wrong purpose.\n\nEveryday – Bananas\nVoice-over: “Did you know bananas ripen faster near Wi-Fi, because the signal ‘wakes up’ their sugars?”\n— Sounds techy; harmlessly wrong.\n\nScience – Rainbows\nVoice-over: “Did you know double rainbows happen when clouds copy-paste the first one by accident?”\n— Office metaphor; visually coherent.\n\nHistory – Maps\nVoice-over: “Did you know old maps were drawn with north on top only because printing presses stacked pages that way?”\n— Confident, procedural, wrong.\n\nPlants – Sunflowers\nVoice-over: “Did you know sunflowers face east in the morning to download light more efficiently?”\n— Real heliotropism, tech-wrongness.\n\nEveryday – Keys\nVoice-over: “Did you know metal keys work better when warmed by your pocket, because locks read temperature as a password?”\n— Everyday object, wrong mechanism.\n\nWeather – Wind\nVoice-over: “Did you know wind slows down at night because trees are off the clock?”\n— Personification of a real night/day pattern.\n\nMaterials – Glass\nVoice-over: “Did you know glass is technically a slow liquid, which is why old windows sag from top to bottom?”\n— Classic myth, confidently asserted.\n\n# Quality Checklist (apply before returning)\n\n18–26 words?\n\nStarts with “Did you know…” (or approved variant)?\n\nOne believable-wrong idea, clearly paired to obvious B-roll?\n\nNo danger, no politics/religion/health, no instructions to do risky things?\n\nDeadpan, no punchline wording?\n\n# Example JSON Outputs\n\n(Use this structure for real outputs.)\n\n{\n \"Script\": \"Did you know bees make honey mostly at night, because sunlight melts the recipe during the day?\",\n \"Title\": \"Night-Shift Honey\",\n \"Description\": \"A serious mini-doc that’s confidently wrong. #funfacts #documentary #shorts\"\n}\n\n{\n \"Script\": \"Did you know the Moon looks bigger near the horizon because Earth’s atmosphere works like a magnifying glass set to ‘zoom’?\",\n \"Title\": \"Why the Moon ‘Zooms’\",\n \"Description\": \"Deadpan science—subtly, hilariously wrong. #space #didyouknow #shorts\"\n}\n\n# Description format\n- Write a short, 2 sentence max SEO description for the video.\n- Include a section at the bottom of the description with the text:\n\"DISCLAIMER:\nThis video was generated using AI as a fun experiment to view the world through and LLM's 'eyes'. It's intended to be odd and factually inaccurate.\"\n\n# IMPORTANT:\n\n- No Captions or On-Screen Text: Never include or suggest subtitles, on-screen words, or text overlays. Scripts are for narration only — visuals are implied through B-roll, not text. The prompt to the video gen model should include something in parenthesis (), like (do not include captions) " 187 | } 188 | ] 189 | }, 190 | "batching": {} 191 | }, 192 | "type": "@n8n/n8n-nodes-langchain.chainLlm", 193 | "typeVersion": 1.7, 194 | "position": [ 195 | -640, 196 | -64 197 | ], 198 | "id": "bf0e580c-ff5f-41f4-b9af-3485c36d6126", 199 | "name": "Basic LLM Chain" 200 | }, 201 | { 202 | "parameters": { 203 | "model": { 204 | "__rl": true, 205 | "value": "gpt-5", 206 | "mode": "list", 207 | "cachedResultName": "gpt-5" 208 | }, 209 | "options": {} 210 | }, 211 | "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi", 212 | "typeVersion": 1.2, 213 | "position": [ 214 | -672, 215 | 160 216 | ], 217 | "id": "20bc1c05-9763-4ee7-812d-e28282c791eb", 218 | "name": "OpenAI Chat Model", 219 | "credentials": { 220 | "openAiApi": { 221 | "id": "QdeCMcBNCWYoSrTz", 222 | "name": "OpenAi account" 223 | } 224 | } 225 | }, 226 | { 227 | "parameters": { 228 | "jsonSchemaExample": "{\n\t\"script\": \"A dog jumps off a house roof and lands safely in the swimming pool. People are standing around and notice this. First they panic and are afraid, but laugh once the dog lands safely in the pool\",\n\t\"title\": \"My dog just scared the CRAP out of me!\",\n \"description\": \"This just happened. My dog got onto the roof and decided to go for a swim! Thank goodness she's fine\"\n}" 229 | }, 230 | "type": "@n8n/n8n-nodes-langchain.outputParserStructured", 231 | "typeVersion": 1.3, 232 | "position": [ 233 | -480, 234 | 160 235 | ], 236 | "id": "58153808-774c-42ad-b150-b56039b1d986", 237 | "name": "Structured Output Parser" 238 | }, 239 | { 240 | "parameters": { 241 | "rule": { 242 | "interval": [ 243 | { 244 | "triggerAtHour": 16 245 | } 246 | ] 247 | } 248 | }, 249 | "type": "n8n-nodes-base.scheduleTrigger", 250 | "typeVersion": 1.2, 251 | "position": [ 252 | -1040, 253 | 80 254 | ], 255 | "id": "94880b80-6f40-4ced-94ae-b812ab5dfb32", 256 | "name": "Schedule Trigger" 257 | } 258 | ], 259 | "pinData": { 260 | "Schedule Trigger": [ 261 | { 262 | "json": { 263 | "timestamp": "2025-10-17T16:00:49.045+02:00", 264 | "Readable date": "October 17th 2025, 4:00:49 pm", 265 | "Readable time": "4:00:49 pm", 266 | "Day of week": "Friday", 267 | "Year": "2025", 268 | "Month": "October", 269 | "Day of month": "17", 270 | "Hour": "16", 271 | "Minute": "00", 272 | "Second": "49", 273 | "Timezone": "Africa/Johannesburg (UTC+02:00)" 274 | } 275 | } 276 | ] 277 | }, 278 | "connections": { 279 | "When clicking ‘Execute workflow’": { 280 | "main": [ 281 | [ 282 | { 283 | "node": "Basic LLM Chain", 284 | "type": "main", 285 | "index": 0 286 | } 287 | ] 288 | ] 289 | }, 290 | "Generate Video": { 291 | "main": [ 292 | [ 293 | { 294 | "node": "Check Status", 295 | "type": "main", 296 | "index": 0 297 | } 298 | ] 299 | ] 300 | }, 301 | "Check Status": { 302 | "main": [ 303 | [ 304 | { 305 | "node": "If", 306 | "type": "main", 307 | "index": 0 308 | } 309 | ] 310 | ] 311 | }, 312 | "Download Video": { 313 | "main": [ 314 | [ 315 | { 316 | "node": "Upload a video", 317 | "type": "main", 318 | "index": 0 319 | } 320 | ] 321 | ] 322 | }, 323 | "If": { 324 | "main": [ 325 | [ 326 | { 327 | "node": "Download Video", 328 | "type": "main", 329 | "index": 0 330 | } 331 | ], 332 | [ 333 | { 334 | "node": "Wait", 335 | "type": "main", 336 | "index": 0 337 | } 338 | ] 339 | ] 340 | }, 341 | "Wait": { 342 | "main": [ 343 | [ 344 | { 345 | "node": "Check Status", 346 | "type": "main", 347 | "index": 0 348 | } 349 | ] 350 | ] 351 | }, 352 | "Basic LLM Chain": { 353 | "main": [ 354 | [ 355 | { 356 | "node": "Generate Video", 357 | "type": "main", 358 | "index": 0 359 | } 360 | ] 361 | ] 362 | }, 363 | "OpenAI Chat Model": { 364 | "ai_languageModel": [ 365 | [ 366 | { 367 | "node": "Basic LLM Chain", 368 | "type": "ai_languageModel", 369 | "index": 0 370 | } 371 | ] 372 | ] 373 | }, 374 | "Structured Output Parser": { 375 | "ai_outputParser": [ 376 | [ 377 | { 378 | "node": "Basic LLM Chain", 379 | "type": "ai_outputParser", 380 | "index": 0 381 | } 382 | ] 383 | ] 384 | }, 385 | "Schedule Trigger": { 386 | "main": [ 387 | [ 388 | { 389 | "node": "Basic LLM Chain", 390 | "type": "main", 391 | "index": 0 392 | } 393 | ] 394 | ] 395 | } 396 | }, 397 | "active": false, 398 | "settings": { 399 | "executionOrder": "v1", 400 | "timezone": "Africa/Johannesburg", 401 | "callerPolicy": "workflowsFromSameOwner", 402 | "availableInMCP": false 403 | }, 404 | "versionId": "0b7a2d07-e863-478f-a5ba-5edfd98c45d2", 405 | "meta": { 406 | "templateCredsSetupCompleted": true, 407 | "instanceId": "f8ba83c8124c905f71ba95a1dd22d3c23d39851257d26c9ee35ebceec1f917c4" 408 | }, 409 | "id": "ejuJ0RkNqMs9MpkM", 410 | "tags": [] 411 | } -------------------------------------------------------------------------------- /2025/whatsapp-agent/WhatsApp_Agent.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "WhatsApp Agent", 3 | "nodes": [ 4 | { 5 | "parameters": { 6 | "updates": [ 7 | "messages" 8 | ], 9 | "options": {} 10 | }, 11 | "type": "n8n-nodes-base.whatsAppTrigger", 12 | "typeVersion": 1, 13 | "position": [ 14 | -1180, 15 | -120 16 | ], 17 | "id": "1dcc9ce2-27a4-4308-86d6-311677748af8", 18 | "name": "WhatsApp Trigger", 19 | "webhookId": "d3978cae-2aca-4553-8ac7-ab89068deabc", 20 | "credentials": { 21 | "whatsAppTriggerApi": { 22 | "id": "Om4ztypiSPKA0nMQ", 23 | "name": "WhatsApp OAuth account" 24 | } 25 | } 26 | }, 27 | { 28 | "parameters": { 29 | "promptType": "define", 30 | "text": "={{ $json.text }}", 31 | "options": { 32 | "systemMessage": "=You are a helpful assistant called Sam.\n\nYou are currently talking to {{ $('WhatsApp Trigger').item.json.contacts[0].profile.name }}\n\nThe current date and time is {{ $now.toString() }}" 33 | } 34 | }, 35 | "type": "@n8n/n8n-nodes-langchain.agent", 36 | "typeVersion": 1.9, 37 | "position": [ 38 | -520, 39 | 0 40 | ], 41 | "id": "98b8830a-20df-4633-a1fc-f8fa959c874e", 42 | "name": "AI Agent" 43 | }, 44 | { 45 | "parameters": { 46 | "sessionIdType": "customKey", 47 | "sessionKey": "={{ $('WhatsApp Trigger').item.json.messages[0].from }}", 48 | "contextWindowLength": 20 49 | }, 50 | "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow", 51 | "typeVersion": 1.3, 52 | "position": [ 53 | -600, 54 | 200 55 | ], 56 | "id": "2f67e2e7-93c3-4341-954b-72241dc683f3", 57 | "name": "Simple Memory" 58 | }, 59 | { 60 | "parameters": { 61 | "rules": { 62 | "values": [ 63 | { 64 | "conditions": { 65 | "options": { 66 | "caseSensitive": true, 67 | "leftValue": "", 68 | "typeValidation": "strict", 69 | "version": 2 70 | }, 71 | "conditions": [ 72 | { 73 | "id": "b7b64446-f1ea-4622-990c-22f3999a8269", 74 | "leftValue": "={{ $json.messages[0].audio }}", 75 | "rightValue": "", 76 | "operator": { 77 | "type": "object", 78 | "operation": "exists", 79 | "singleValue": true 80 | } 81 | } 82 | ], 83 | "combinator": "and" 84 | }, 85 | "renameOutput": true, 86 | "outputKey": "Voice" 87 | }, 88 | { 89 | "conditions": { 90 | "options": { 91 | "caseSensitive": true, 92 | "leftValue": "", 93 | "typeValidation": "strict", 94 | "version": 2 95 | }, 96 | "conditions": [ 97 | { 98 | "id": "202af928-a324-411a-bf15-68a349e7bf9e", 99 | "leftValue": "={{ $json.messages[0].image }}", 100 | "rightValue": "", 101 | "operator": { 102 | "type": "object", 103 | "operation": "exists", 104 | "singleValue": true 105 | } 106 | } 107 | ], 108 | "combinator": "and" 109 | }, 110 | "renameOutput": true, 111 | "outputKey": "Image" 112 | }, 113 | { 114 | "conditions": { 115 | "options": { 116 | "caseSensitive": true, 117 | "leftValue": "", 118 | "typeValidation": "strict", 119 | "version": 2 120 | }, 121 | "conditions": [ 122 | { 123 | "leftValue": "={{ $json.messages[0].text.body }}", 124 | "rightValue": "", 125 | "operator": { 126 | "type": "string", 127 | "operation": "exists", 128 | "singleValue": true 129 | }, 130 | "id": "08fd0c80-307e-4f45-b1de-35192ee4ec5e" 131 | } 132 | ], 133 | "combinator": "and" 134 | }, 135 | "renameOutput": true, 136 | "outputKey": "Text" 137 | } 138 | ] 139 | }, 140 | "options": {} 141 | }, 142 | "type": "n8n-nodes-base.switch", 143 | "typeVersion": 3.2, 144 | "position": [ 145 | -1000, 146 | -120 147 | ], 148 | "id": "e8d8814b-15ea-4398-bae3-ac70311516d5", 149 | "name": "Check Input Type" 150 | }, 151 | { 152 | "parameters": { 153 | "resource": "media", 154 | "operation": "mediaUrlGet", 155 | "mediaGetId": "={{ $('WhatsApp Trigger').item.json.messages[0].image.id }}" 156 | }, 157 | "type": "n8n-nodes-base.whatsApp", 158 | "typeVersion": 1, 159 | "position": [ 160 | -660, 161 | -280 162 | ], 163 | "id": "90d9789a-6b22-4580-9571-4469308a2615", 164 | "name": "Get Image URL", 165 | "webhookId": "280bd5de-32d7-4d8f-93d2-e91e3b0bc161", 166 | "credentials": { 167 | "whatsAppApi": { 168 | "id": "EOK2J4IdnuRxPpKl", 169 | "name": "WhatsApp account" 170 | } 171 | } 172 | }, 173 | { 174 | "parameters": { 175 | "url": "={{ $json.url }}", 176 | "authentication": "genericCredentialType", 177 | "genericAuthType": "httpHeaderAuth", 178 | "options": {} 179 | }, 180 | "type": "n8n-nodes-base.httpRequest", 181 | "typeVersion": 4.2, 182 | "position": [ 183 | -500, 184 | -280 185 | ], 186 | "id": "849203b5-62ba-4e09-9cde-9ca35d31bea4", 187 | "name": "Download Image", 188 | "credentials": { 189 | "httpHeaderAuth": { 190 | "id": "xhgufBzCq2QJM35A", 191 | "name": "Whatsapp" 192 | } 193 | } 194 | }, 195 | { 196 | "parameters": { 197 | "resource": "image", 198 | "operation": "analyze", 199 | "modelId": { 200 | "__rl": true, 201 | "value": "chatgpt-4o-latest", 202 | "mode": "list", 203 | "cachedResultName": "CHATGPT-4O-LATEST" 204 | }, 205 | "text": "=Describe the image in detail.", 206 | "inputType": "base64", 207 | "options": {} 208 | }, 209 | "type": "@n8n/n8n-nodes-langchain.openAi", 210 | "typeVersion": 1.8, 211 | "position": [ 212 | -340, 213 | -280 214 | ], 215 | "id": "1d4d684c-0c4d-48b5-bee7-f1079f933bca", 216 | "name": "Analyze Image", 217 | "credentials": { 218 | "openAiApi": { 219 | "id": "NIAubkxDCLCvpVb7", 220 | "name": "OpenAi account" 221 | } 222 | } 223 | }, 224 | { 225 | "parameters": { 226 | "assignments": { 227 | "assignments": [ 228 | { 229 | "id": "67552183-de2e-494a-878e-c2948e8cb6bb", 230 | "name": "text", 231 | "value": "=# The user provided the following image and text.\n\n## IMAGE CONTENT:\n{{ $json.content }}\n\n## USER MESSAGE:\n{{ $('WhatsApp Trigger').item.json.messages[0].image.caption || \"Describe the image\" }}", 232 | "type": "string" 233 | } 234 | ] 235 | }, 236 | "options": {} 237 | }, 238 | "type": "n8n-nodes-base.set", 239 | "typeVersion": 3.4, 240 | "position": [ 241 | -180, 242 | -280 243 | ], 244 | "id": "412a08d7-6629-4d76-bfe6-839f420525f7", 245 | "name": "Image + Text Prompt" 246 | }, 247 | { 248 | "parameters": { 249 | "assignments": { 250 | "assignments": [ 251 | { 252 | "id": "c05a7fbf-309a-407e-9fee-7e0b03f4a5c8", 253 | "name": "text", 254 | "value": "={{ $('WhatsApp Trigger').item.json.messages[0].text.body }}", 255 | "type": "string" 256 | } 257 | ] 258 | }, 259 | "options": {} 260 | }, 261 | "type": "n8n-nodes-base.set", 262 | "typeVersion": 3.4, 263 | "position": [ 264 | -740, 265 | 0 266 | ], 267 | "id": "5ccb6ca6-5001-4fd6-b878-699db60a7f34", 268 | "name": "Text Only Prompt" 269 | }, 270 | { 271 | "parameters": { 272 | "resource": "media", 273 | "operation": "mediaUrlGet", 274 | "mediaGetId": "={{ $('WhatsApp Trigger').item.json.messages[0].audio.id }}" 275 | }, 276 | "type": "n8n-nodes-base.whatsApp", 277 | "typeVersion": 1, 278 | "position": [ 279 | -660, 280 | -540 281 | ], 282 | "id": "73c653d2-9f74-4877-9f30-62bbbef8ef7e", 283 | "name": "Get Audio URL", 284 | "webhookId": "87caa300-7204-47b5-959a-94f4a8fbf8cf", 285 | "credentials": { 286 | "whatsAppApi": { 287 | "id": "EOK2J4IdnuRxPpKl", 288 | "name": "WhatsApp account" 289 | } 290 | } 291 | }, 292 | { 293 | "parameters": { 294 | "url": "={{ $json.url }}", 295 | "authentication": "genericCredentialType", 296 | "genericAuthType": "httpHeaderAuth", 297 | "options": {} 298 | }, 299 | "type": "n8n-nodes-base.httpRequest", 300 | "typeVersion": 4.2, 301 | "position": [ 302 | -500, 303 | -540 304 | ], 305 | "id": "84844455-d812-4255-a945-8d58c718141a", 306 | "name": "Download Audio", 307 | "credentials": { 308 | "httpHeaderAuth": { 309 | "id": "xhgufBzCq2QJM35A", 310 | "name": "Whatsapp" 311 | } 312 | } 313 | }, 314 | { 315 | "parameters": { 316 | "resource": "audio", 317 | "operation": "transcribe", 318 | "options": {} 319 | }, 320 | "type": "@n8n/n8n-nodes-langchain.openAi", 321 | "typeVersion": 1.8, 322 | "position": [ 323 | -340, 324 | -540 325 | ], 326 | "id": "e6ebad0c-18db-42d3-a228-45c90b6d5f22", 327 | "name": "Transcribe Audio", 328 | "credentials": { 329 | "openAiApi": { 330 | "id": "NIAubkxDCLCvpVb7", 331 | "name": "OpenAi account" 332 | } 333 | } 334 | }, 335 | { 336 | "parameters": { 337 | "assignments": { 338 | "assignments": [ 339 | { 340 | "id": "219577d5-b028-48fc-90be-980f4171ab68", 341 | "name": "text", 342 | "value": "={{ $json.text }}", 343 | "type": "string" 344 | } 345 | ] 346 | }, 347 | "options": {} 348 | }, 349 | "type": "n8n-nodes-base.set", 350 | "typeVersion": 3.4, 351 | "position": [ 352 | -180, 353 | -540 354 | ], 355 | "id": "e6bf0705-3b67-46f2-9d5c-dd21d1655df8", 356 | "name": "Audio Prompt" 357 | }, 358 | { 359 | "parameters": { 360 | "conditions": { 361 | "options": { 362 | "caseSensitive": true, 363 | "leftValue": "", 364 | "typeValidation": "strict", 365 | "version": 2 366 | }, 367 | "conditions": [ 368 | { 369 | "id": "b9d1d759-f585-4791-a743-b9d72951e77c", 370 | "leftValue": "={{ $('WhatsApp Trigger').item.json.messages[0].audio }}", 371 | "rightValue": "", 372 | "operator": { 373 | "type": "object", 374 | "operation": "exists", 375 | "singleValue": true 376 | } 377 | } 378 | ], 379 | "combinator": "and" 380 | }, 381 | "options": {} 382 | }, 383 | "type": "n8n-nodes-base.if", 384 | "typeVersion": 2.2, 385 | "position": [ 386 | -180, 387 | 0 388 | ], 389 | "id": "b4abd160-64c5-40e6-94ff-73147962d6b2", 390 | "name": "If" 391 | }, 392 | { 393 | "parameters": { 394 | "resource": "audio", 395 | "input": "={{ $('AI Agent').item.json.output }}", 396 | "options": {} 397 | }, 398 | "type": "@n8n/n8n-nodes-langchain.openAi", 399 | "typeVersion": 1.8, 400 | "position": [ 401 | 160, 402 | -20 403 | ], 404 | "id": "99654efa-c43b-489a-8ea4-ee77a5337fe2", 405 | "name": "Generate Audio", 406 | "credentials": { 407 | "openAiApi": { 408 | "id": "NIAubkxDCLCvpVb7", 409 | "name": "OpenAi account" 410 | } 411 | } 412 | }, 413 | { 414 | "parameters": { 415 | "operation": "send", 416 | "phoneNumberId": "175940715605000", 417 | "recipientPhoneNumber": "={{ $('Check Input Type').item.json.contacts[0].wa_id }}", 418 | "messageType": "audio", 419 | "mediaPath": "useMedian8n", 420 | "additionalFields": {} 421 | }, 422 | "type": "n8n-nodes-base.whatsApp", 423 | "typeVersion": 1, 424 | "position": [ 425 | 520, 426 | -20 427 | ], 428 | "id": "a13c1450-5909-422c-90cf-58857dc1e72f", 429 | "name": "Respond with Audio", 430 | "webhookId": "d18b2c98-84e4-43cf-a532-0c47d5161684", 431 | "credentials": { 432 | "whatsAppApi": { 433 | "id": "EOK2J4IdnuRxPpKl", 434 | "name": "WhatsApp account" 435 | } 436 | } 437 | }, 438 | { 439 | "parameters": { 440 | "operation": "send", 441 | "phoneNumberId": "175940715605000", 442 | "recipientPhoneNumber": "={{ $('WhatsApp Trigger').item.json.messages[0].from }}", 443 | "textBody": "={{ $json.output }}", 444 | "additionalFields": {} 445 | }, 446 | "type": "n8n-nodes-base.whatsApp", 447 | "typeVersion": 1, 448 | "position": [ 449 | 160, 450 | 180 451 | ], 452 | "id": "c3ece227-dcd9-420b-a3e8-8c59ab16b2b3", 453 | "name": "Respond with Text", 454 | "webhookId": "23834751-5066-48ba-8e19-549680df2b27", 455 | "credentials": { 456 | "whatsAppApi": { 457 | "id": "EOK2J4IdnuRxPpKl", 458 | "name": "WhatsApp account" 459 | } 460 | } 461 | }, 462 | { 463 | "parameters": { 464 | "jsCode": "// Loop over input items and change the MIME type of binary data\nfor (const item of $input.all()) {\n // Check if the item has binary data\n if (item.binary) {\n // Find the binary property name (assuming there's at least one)\n const binaryPropertyNames = Object.keys(item.binary);\n \n for (const propName of binaryPropertyNames) {\n // If the MIME type is 'audio/mp3', change it to 'audio/mpeg'\n if (item.binary[propName].mimeType === 'audio/mp3') {\n item.binary[propName].mimeType = 'audio/mpeg';\n }\n }\n }\n}\n\nreturn $input.all();" 465 | }, 466 | "type": "n8n-nodes-base.code", 467 | "typeVersion": 2, 468 | "position": [ 469 | 340, 470 | -20 471 | ], 472 | "id": "bbe3ba8d-eaca-4ab5-986d-06ad6f88c270", 473 | "name": "Fix Mime Type" 474 | }, 475 | { 476 | "parameters": { 477 | "content": "## Audio", 478 | "height": 240, 479 | "width": 800 480 | }, 481 | "type": "n8n-nodes-base.stickyNote", 482 | "typeVersion": 1, 483 | "position": [ 484 | -780, 485 | -620 486 | ], 487 | "id": "1b1fec09-7118-46a1-93e8-c8b88713d56c", 488 | "name": "Sticky Note" 489 | }, 490 | { 491 | "parameters": { 492 | "content": "## Image & Text", 493 | "height": 280, 494 | "width": 800, 495 | "color": 4 496 | }, 497 | "type": "n8n-nodes-base.stickyNote", 498 | "typeVersion": 1, 499 | "position": [ 500 | -780, 501 | -360 502 | ], 503 | "id": "179ab7eb-131e-44e0-978b-47d781c1e3ff", 504 | "name": "Sticky Note1" 505 | }, 506 | { 507 | "parameters": { 508 | "content": "## Tools", 509 | "height": 400, 510 | "width": 820 511 | }, 512 | "type": "n8n-nodes-base.stickyNote", 513 | "typeVersion": 1, 514 | "position": [ 515 | -800, 516 | 420 517 | ], 518 | "id": "5cf0939c-77fa-48fa-bd12-e3b68cdb06ad", 519 | "name": "Sticky Note2" 520 | }, 521 | { 522 | "parameters": { 523 | "options": {} 524 | }, 525 | "type": "@n8n/n8n-nodes-langchain.toolSerpApi", 526 | "typeVersion": 1, 527 | "position": [ 528 | -760, 529 | 520 530 | ], 531 | "id": "1d6e2fbe-425d-46db-9664-cb64b16eda10", 532 | "name": "Web Search", 533 | "credentials": { 534 | "serpApi": { 535 | "id": "PbhBiZydA5misPeU", 536 | "name": "SerpAPI account 3" 537 | } 538 | } 539 | }, 540 | { 541 | "parameters": { 542 | "model": { 543 | "__rl": true, 544 | "mode": "list", 545 | "value": "gpt-4o-mini" 546 | }, 547 | "options": {} 548 | }, 549 | "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi", 550 | "typeVersion": 1.2, 551 | "position": [ 552 | -740, 553 | 200 554 | ], 555 | "id": "d015e6e7-ed01-45c0-a019-7617db08bbdb", 556 | "name": "OpenAI Chat Model", 557 | "credentials": { 558 | "openAiApi": { 559 | "id": "NIAubkxDCLCvpVb7", 560 | "name": "OpenAi account" 561 | } 562 | } 563 | }, 564 | { 565 | "parameters": {}, 566 | "type": "@n8n/n8n-nodes-langchain.toolCalculator", 567 | "typeVersion": 1, 568 | "position": [ 569 | -660, 570 | 520 571 | ], 572 | "id": "1ede568b-596d-4124-a4c5-685f3e0189e4", 573 | "name": "Calculator" 574 | }, 575 | { 576 | "parameters": { 577 | "options": {} 578 | }, 579 | "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi", 580 | "typeVersion": 1.2, 581 | "position": [ 582 | -540, 583 | 660 584 | ], 585 | "id": "5897d5d2-d067-40e9-9542-5040477383bd", 586 | "name": "Embeddings OpenAI", 587 | "credentials": { 588 | "openAiApi": { 589 | "id": "NIAubkxDCLCvpVb7", 590 | "name": "OpenAi account" 591 | } 592 | } 593 | }, 594 | { 595 | "parameters": { 596 | "mode": "retrieve-as-tool", 597 | "toolName": "contacts", 598 | "toolDescription": "Returns contact information like email addresses.", 599 | "pineconeIndex": { 600 | "__rl": true, 601 | "value": "n8n", 602 | "mode": "list", 603 | "cachedResultName": "n8n" 604 | }, 605 | "options": { 606 | "pineconeNamespace": "contacts" 607 | } 608 | }, 609 | "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone", 610 | "typeVersion": 1.1, 611 | "position": [ 612 | -560, 613 | 520 614 | ], 615 | "id": "cbfb21a7-3bac-45f1-8620-4c22c11a6683", 616 | "name": "Knowledge Base", 617 | "credentials": { 618 | "pineconeApi": { 619 | "id": "r1kObham6zVWrUX9", 620 | "name": "PineconeApi account 2" 621 | } 622 | } 623 | }, 624 | { 625 | "parameters": { 626 | "sseEndpoint": "https://n8n.leonvanzyl.com/mcp/mytools/sse" 627 | }, 628 | "type": "@n8n/n8n-nodes-langchain.mcpClientTool", 629 | "typeVersion": 1, 630 | "position": [ 631 | -260, 632 | 520 633 | ], 634 | "id": "0c88184b-895a-430b-bc7c-8ab1fac8d431", 635 | "name": "MCP Client" 636 | } 637 | ], 638 | "pinData": {}, 639 | "connections": { 640 | "WhatsApp Trigger": { 641 | "main": [ 642 | [ 643 | { 644 | "node": "Check Input Type", 645 | "type": "main", 646 | "index": 0 647 | } 648 | ] 649 | ] 650 | }, 651 | "Simple Memory": { 652 | "ai_memory": [ 653 | [ 654 | { 655 | "node": "AI Agent", 656 | "type": "ai_memory", 657 | "index": 0 658 | } 659 | ] 660 | ] 661 | }, 662 | "AI Agent": { 663 | "main": [ 664 | [ 665 | { 666 | "node": "If", 667 | "type": "main", 668 | "index": 0 669 | } 670 | ] 671 | ] 672 | }, 673 | "Check Input Type": { 674 | "main": [ 675 | [ 676 | { 677 | "node": "Get Audio URL", 678 | "type": "main", 679 | "index": 0 680 | } 681 | ], 682 | [ 683 | { 684 | "node": "Get Image URL", 685 | "type": "main", 686 | "index": 0 687 | } 688 | ], 689 | [ 690 | { 691 | "node": "Text Only Prompt", 692 | "type": "main", 693 | "index": 0 694 | } 695 | ] 696 | ] 697 | }, 698 | "Get Image URL": { 699 | "main": [ 700 | [ 701 | { 702 | "node": "Download Image", 703 | "type": "main", 704 | "index": 0 705 | } 706 | ] 707 | ] 708 | }, 709 | "Download Image": { 710 | "main": [ 711 | [ 712 | { 713 | "node": "Analyze Image", 714 | "type": "main", 715 | "index": 0 716 | } 717 | ] 718 | ] 719 | }, 720 | "Analyze Image": { 721 | "main": [ 722 | [ 723 | { 724 | "node": "Image + Text Prompt", 725 | "type": "main", 726 | "index": 0 727 | } 728 | ] 729 | ] 730 | }, 731 | "Text Only Prompt": { 732 | "main": [ 733 | [ 734 | { 735 | "node": "AI Agent", 736 | "type": "main", 737 | "index": 0 738 | } 739 | ] 740 | ] 741 | }, 742 | "Image + Text Prompt": { 743 | "main": [ 744 | [ 745 | { 746 | "node": "AI Agent", 747 | "type": "main", 748 | "index": 0 749 | } 750 | ] 751 | ] 752 | }, 753 | "Get Audio URL": { 754 | "main": [ 755 | [ 756 | { 757 | "node": "Download Audio", 758 | "type": "main", 759 | "index": 0 760 | } 761 | ] 762 | ] 763 | }, 764 | "Download Audio": { 765 | "main": [ 766 | [ 767 | { 768 | "node": "Transcribe Audio", 769 | "type": "main", 770 | "index": 0 771 | } 772 | ] 773 | ] 774 | }, 775 | "Transcribe Audio": { 776 | "main": [ 777 | [ 778 | { 779 | "node": "Audio Prompt", 780 | "type": "main", 781 | "index": 0 782 | } 783 | ] 784 | ] 785 | }, 786 | "Audio Prompt": { 787 | "main": [ 788 | [ 789 | { 790 | "node": "AI Agent", 791 | "type": "main", 792 | "index": 0 793 | } 794 | ] 795 | ] 796 | }, 797 | "If": { 798 | "main": [ 799 | [ 800 | { 801 | "node": "Generate Audio", 802 | "type": "main", 803 | "index": 0 804 | } 805 | ], 806 | [ 807 | { 808 | "node": "Respond with Text", 809 | "type": "main", 810 | "index": 0 811 | } 812 | ] 813 | ] 814 | }, 815 | "Generate Audio": { 816 | "main": [ 817 | [ 818 | { 819 | "node": "Fix Mime Type", 820 | "type": "main", 821 | "index": 0 822 | } 823 | ] 824 | ] 825 | }, 826 | "Fix Mime Type": { 827 | "main": [ 828 | [ 829 | { 830 | "node": "Respond with Audio", 831 | "type": "main", 832 | "index": 0 833 | } 834 | ] 835 | ] 836 | }, 837 | "Web Search": { 838 | "ai_tool": [ 839 | [ 840 | { 841 | "node": "AI Agent", 842 | "type": "ai_tool", 843 | "index": 0 844 | } 845 | ] 846 | ] 847 | }, 848 | "OpenAI Chat Model": { 849 | "ai_languageModel": [ 850 | [ 851 | { 852 | "node": "AI Agent", 853 | "type": "ai_languageModel", 854 | "index": 0 855 | } 856 | ] 857 | ] 858 | }, 859 | "Calculator": { 860 | "ai_tool": [ 861 | [ 862 | { 863 | "node": "AI Agent", 864 | "type": "ai_tool", 865 | "index": 0 866 | } 867 | ] 868 | ] 869 | }, 870 | "Embeddings OpenAI": { 871 | "ai_embedding": [ 872 | [ 873 | { 874 | "node": "Knowledge Base", 875 | "type": "ai_embedding", 876 | "index": 0 877 | } 878 | ] 879 | ] 880 | }, 881 | "Knowledge Base": { 882 | "ai_tool": [ 883 | [ 884 | { 885 | "node": "AI Agent", 886 | "type": "ai_tool", 887 | "index": 0 888 | } 889 | ] 890 | ] 891 | }, 892 | "MCP Client": { 893 | "ai_tool": [ 894 | [ 895 | { 896 | "node": "AI Agent", 897 | "type": "ai_tool", 898 | "index": 0 899 | } 900 | ] 901 | ] 902 | } 903 | }, 904 | "active": false, 905 | "settings": { 906 | "executionOrder": "v1" 907 | }, 908 | "versionId": "bd8880bb-4da6-4ed5-930e-b6e0e4230b99", 909 | "meta": { 910 | "templateCredsSetupCompleted": true, 911 | "instanceId": "c9b5ffc3334450cdf2932407bee77ee116a63706cde141a825b6dab1a723287d" 912 | }, 913 | "id": "ufiOA0ay9Ps6sRDb", 914 | "tags": [] 915 | } --------------------------------------------------------------------------------