The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "/prompt-cowboy",
"responseMode": "responseNode",
"options": {}
},
"id": "d1baacbc-6f52-4f81-b123-81235c4735a9",
"name": "Webhook",
"type": "n8n-nodes-base.webhook",
"typeVersion": 1.1,
"position": [
-928,
272
]
},
{
"parameters": {
"modelId": {
"__rl": true,
"value": "gpt-4o-mini",
"mode": "list",
"cachedResultName": "GPT-4O-MINI"
},
"messages": {
"values": [
{
"content": "Voc\u00ea \u00e9 um analisador sem\u00e2ntico especializado. Sempre responda APENAS com JSON v\u00e1lido, sem texto adicional.",
"role": "system"
},
{
"content": "Analise semanticamente o seguinte prompt do usu\u00e1rio e extraia informa\u00e7\u00f5es estruturadas.\n\nRETORNE APENAS JSON NO FORMATO EXATO:\n{\n \"intent\": \"descri\u00e7\u00e3o clara da inten\u00e7\u00e3o do usu\u00e1rio\",\n \"entities\": [\"lista\", \"de\", \"entidades\", \"mencionadas\"],\n \"ambiguities\": [\"poss\u00edveis\", \"ambiguidades\"]\n}\n\nPROMPT DO USU\u00c1RIO:\n{{ $json.prompt }}",
"role": "user"
}
]
},
"jsonOutput": true,
"options": {
"temperature": 0.3
}
},
"id": "e50261b2-2653-4076-9b83-93b193323ca1",
"name": "Semantic Analyzer",
"type": "@n8n/n8n-nodes-langchain.openAi",
"typeVersion": 1.3,
"position": [
-560,
-48
],
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"jsCode": "// Get output from Semantic Analyzer\nconst analyzerOutput = $input.first().json;\n\n// OpenAI with jsonOutput returns: { message: { content: {...} } }\nconst semantic = analyzerOutput.message?.content || analyzerOutput.output || analyzerOutput;\n\n// Get previous data from Text Preprocessor\nconst prompt = analyzerOutput.prompt || $('Text Preprocessor').first().json.prompt;\nconst original_prompt = analyzerOutput.original_prompt || $('Text Preprocessor').first().json.original_prompt;\n\nreturn [{\n prompt: prompt,\n original_prompt: original_prompt,\n semantic: {\n intent: semantic.intent || 'N\u00e3o identificado',\n entities: semantic.entities || [],\n ambiguities: semantic.ambiguities || []\n }\n}];"
},
"id": "a65757e0-b3d5-4bc5-a0bd-916edce42b35",
"name": "Semantic Data Merger",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-240,
-48
]
},
{
"parameters": {
"modelId": {
"__rl": true,
"value": "gpt-4o-mini",
"mode": "list",
"cachedResultName": "GPT-4O-MINI"
},
"messages": {
"values": [
{
"content": "Voc\u00ea \u00e9 um parser estrutural especializado. Sempre responda APENAS com JSON v\u00e1lido, sem texto adicional.",
"role": "system"
},
{
"content": "Analise estruturalmente o seguinte prompt do usu\u00e1rio e extraia:\n\nRETORNE APENAS JSON NO FORMATO EXATO:\n{\n \"instructions\": [\"a\u00e7\u00e3o 1\", \"a\u00e7\u00e3o 2\"],\n \"context\": \"contexto e informa\u00e7\u00f5es de fundo\",\n \"constraints\": [\"limite 1\", \"formato X\"]\n}\n\nPROMPT DO USU\u00c1RIO:\n{{ $json.prompt }}",
"role": "user"
}
]
},
"jsonOutput": true,
"options": {
"temperature": 0.3
}
},
"id": "04c46f77-9b3a-40ac-b6fe-9d5893d8c44b",
"name": "Structural Parser",
"type": "@n8n/n8n-nodes-langchain.openAi",
"typeVersion": 1.3,
"position": [
-256,
240
],
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"jsCode": "// Get output from Structural Parser\nconst parserOutput = $input.first().json;\n\n// OpenAI with jsonOutput returns: { message: { content: {...} } }\nconst structural = parserOutput.message?.content || parserOutput.output || parserOutput;\n\n// Get previous data from Semantic Data Merger\nconst previous = $('Semantic Data Merger').first().json;\n\nreturn [{\n prompt: previous.prompt,\n original_prompt: previous.original_prompt,\n semantic: previous.semantic,\n structural: {\n instructions: structural.instructions || [],\n context: structural.context || '',\n constraints: structural.constraints || []\n }\n}];"
},
"id": "d45cd2a3-a646-4168-9b17-69a76d2bb001",
"name": "Structural Data Merger",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
16,
240
]
},
{
"parameters": {
"modelId": {
"__rl": true,
"value": "gpt-4o",
"mode": "list",
"cachedResultName": "GPT-4O"
},
"messages": {
"values": [
{
"content": "Voc\u00ea \u00e9 um especialista em enriquecimento de contexto. Sempre responda APENAS com JSON v\u00e1lido, sem texto adicional. NUNCA invente informa\u00e7\u00f5es que n\u00e3o est\u00e3o nos dados fornecidos.",
"role": "system"
},
{
"content": "Baseado EXCLUSIVAMENTE nos dados abaixo (an\u00e1lise sem\u00e2ntica e estrutural do prompt original), gere:\n\nRETORNE APENAS JSON:\n{\n \"persona\": \"persona adequada baseada NO CONTEXTO DOS DADOS\",\n \"qualityCriteria\": [\"crit\u00e9rios RELEVANTES AO PROMPT\"],\n \"examples\": [\"exemplos RELACIONADOS AO TEMA DO PROMPT\"]\n}\n\nIMPORTANTE: Use APENAS informa\u00e7\u00f5es presentes nos dados. N\u00c3O invente contextos diferentes.\n\nDADOS DA AN\u00c1LISE:\n{{ JSON.stringify($json) }}",
"role": "user"
}
]
},
"jsonOutput": true,
"options": {
"temperature": 0.4
}
},
"id": "5bb2d1a4-6c77-484b-a93f-f027b67e2beb",
"name": "Context Enricher",
"type": "@n8n/n8n-nodes-langchain.openAi",
"typeVersion": 1.3,
"position": [
160,
-48
],
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"jsCode": "// Get output from Context Enricher\nconst enricherOutput = $input.first().json;\n\n// OpenAI with jsonOutput returns: { message: { content: {...} } }\nconst enriched = enricherOutput.message?.content || enricherOutput.output || enricherOutput;\n\n// Get previous data from Structural Data Merger\nconst previous = $('Structural Data Merger').first().json;\n\nreturn [{\n prompt: previous.prompt,\n original_prompt: previous.original_prompt,\n semantic: previous.semantic,\n structural: previous.structural,\n enriched: {\n persona: enriched.persona || 'Assistente geral',\n qualityCriteria: enriched.qualityCriteria || [],\n examples: enriched.examples || []\n }\n}];"
},
"id": "549d3d2e-62d4-41ee-b3cf-cced48a37e8c",
"name": "Enriched Data Merger",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
512,
-48
]
},
{
"parameters": {
"jsCode": "// Get all previous data from Enriched Data Merger\nconst data = $input.first().json;\nconst semantic = data.semantic || {};\nconst structural = data.structural || {};\nconst enriched = data.enriched || {};\n\n// Format instructions as string\nconst instructionsList = Array.isArray(structural.instructions) \n ? structural.instructions.join('\\n- ') \n : structural.instructions || 'N\u00e3o especificado';\n\n// Format entities as readable list\nconst entitiesList = Array.isArray(semantic.entities) && semantic.entities.length > 0\n ? semantic.entities.join(', ')\n : 'Nenhuma entidade identificada';\n\n// Format examples\nconst examplesList = Array.isArray(enriched.examples) && enriched.examples.length > 0\n ? enriched.examples.map((ex, i) => `${i + 1}. ${ex}`).join('\\n')\n : 'Nenhum exemplo fornecido';\n\n// Format constraints if any\nconst constraintsList = Array.isArray(structural.constraints) && structural.constraints.length > 0\n ? '\\n\\n**Restri\u00e7\u00f5es**\\n- ' + structural.constraints.join('\\n- ')\n : '';\n\nconst stokePrompt = `**Situa\u00e7\u00e3o (Contexto)**\n${structural.context || enriched.persona || 'Contexto n\u00e3o informado'}\n\n**Tarefa (Instru\u00e7\u00f5es)**\n- ${instructionsList}\n\n**Objetivo**\n${semantic.intent || 'Desconhecido'}\n\n**Conhecimento (Entidades)**\n${entitiesList}${constraintsList}\n\n**Exemplos**\n${examplesList}`;\n\nreturn [{\n prompt: data.prompt,\n original_prompt: data.original_prompt,\n semantic: semantic,\n structural: structural,\n enriched: enriched,\n stoke_prompt: stokePrompt\n}];"
},
"id": "3764bdd2-cf75-408c-a808-ecea40681467",
"name": "STOKE Mapper",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
496,
272
]
},
{
"parameters": {
"modelId": {
"__rl": true,
"value": "gpt-4o",
"mode": "list",
"cachedResultName": "GPT-4O"
},
"messages": {
"values": [
{
"content": "Voc\u00ea \u00e9 um especialista em engenharia de prompts. Sua miss\u00e3o \u00e9 otimizar prompts aplicando clareza, precis\u00e3o, concis\u00e3o e estrutura adequada. Retorne APENAS o prompt otimizado em texto plano, sem JSON ou formata\u00e7\u00e3o adicional.",
"role": "system"
},
{
"content": "Otimize o prompt abaixo aplicando os princ\u00edpios de engenharia de prompts.\nReescreva de forma precisa, concisa e clara, mantendo o formato STOKE (Situa\u00e7\u00e3o, Tarefa, Objetivo, Conhecimento, Exemplos).\nMantenha todas as se\u00e7\u00f5es e informa\u00e7\u00f5es importantes.\n\nPrompt:\n{{ $json.stoke_prompt }}",
"role": "user"
}
]
},
"options": {
"temperature": 0.5
}
},
"id": "6346e14b-a18d-48b9-9341-553493d007e4",
"name": "Prompt Optimizer",
"type": "@n8n/n8n-nodes-langchain.openAi",
"typeVersion": 1.3,
"position": [
640,
272
],
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"jsCode": "// Get output from Prompt Optimizer\nconst optimizerOutput = $input.first().json;\n\n// OpenAI without jsonOutput returns: { message: { content: \"text...\" } }\nconst optimizedPrompt = optimizerOutput.message?.content || optimizerOutput.output || optimizerOutput.text || '';\n\n// Get previous data from STOKE Mapper\nconst previous = $('STOKE Mapper').first().json;\n\nreturn [{\n prompt: previous.prompt,\n original_prompt: previous.original_prompt,\n semantic: previous.semantic,\n structural: previous.structural,\n enriched: previous.enriched,\n stoke_prompt: previous.stoke_prompt,\n optimized_prompt: typeof optimizedPrompt === 'string' ? optimizedPrompt.trim() : JSON.stringify(optimizedPrompt)\n}];"
},
"id": "8a9f3e5d-1c2b-4d3e-9f8a-7b6c5d4e3f2a",
"name": "Optimizer Data Merger",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
832,
272
]
},
{
"parameters": {
"jsCode": "const data = $input.first().json;\n\nreturn [{\n status: \"success\",\n original_prompt: data.original_prompt,\n optimized_prompt: data.optimized_prompt,\n stoke_version: data.stoke_prompt,\n analysis: {\n semantic: data.semantic,\n structural: data.structural,\n enriched: data.enriched\n }\n}];"
},
"id": "0cc2139d-2518-4ee0-8d34-29488e7cdb14",
"name": "Response Formatter",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1024,
272
]
},
{
"parameters": {
"options": {
"responseCode": 200
}
},
"id": "31ec4a89-4c40-4c8f-af8d-c090822fe854",
"name": "Webhook Response",
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1,
"position": [
1232,
272
]
},
{
"parameters": {
"jsCode": "const originalPrompt = $input.first().json.body.prompt;\nconst cleanPrompt = originalPrompt\n .replace(/\\n+/g, ' ')\n .replace(/\\s+/g, ' ')\n .trim();\n\nreturn [{\n prompt: cleanPrompt,\n original_prompt: originalPrompt\n}];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-720,
160
],
"id": "4b141b59-1d8a-4d7a-8608-d1e2e68db965",
"name": "Text Preprocessor"
}
],
"connections": {
"Webhook": {
"main": [
[
{
"node": "Text Preprocessor",
"type": "main",
"index": 0
}
]
]
},
"Semantic Analyzer": {
"main": [
[
{
"node": "Semantic Data Merger",
"type": "main",
"index": 0
}
]
]
},
"Semantic Data Merger": {
"main": [
[
{
"node": "Structural Parser",
"type": "main",
"index": 0
}
]
]
},
"Structural Parser": {
"main": [
[
{
"node": "Structural Data Merger",
"type": "main",
"index": 0
}
]
]
},
"Structural Data Merger": {
"main": [
[
{
"node": "Context Enricher",
"type": "main",
"index": 0
}
]
]
},
"Context Enricher": {
"main": [
[
{
"node": "Enriched Data Merger",
"type": "main",
"index": 0
}
]
]
},
"Enriched Data Merger": {
"main": [
[
{
"node": "STOKE Mapper",
"type": "main",
"index": 0
}
]
]
},
"STOKE Mapper": {
"main": [
[
{
"node": "Prompt Optimizer",
"type": "main",
"index": 0
}
]
]
},
"Prompt Optimizer": {
"main": [
[
{
"node": "Optimizer Data Merger",
"type": "main",
"index": 0
}
]
]
},
"Optimizer Data Merger": {
"main": [
[
{
"node": "Response Formatter",
"type": "main",
"index": 0
}
]
]
},
"Response Formatter": {
"main": [
[
{
"node": "Webhook Response",
"type": "main",
"index": 0
}
]
]
},
"Text Preprocessor": {
"main": [
[
{
"node": "Semantic Analyzer",
"type": "main",
"index": 0
}
]
]
}
},
"meta": {
"templateCredsSetupCompleted": true
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
openAiApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Feradoprompt. Uses openAi. Webhook trigger; 13 nodes.
Source: https://github.com/xandeq/feradoprompt/blob/10a2b91c86f03d72364273bf2fd76ef48de609a6/n8n/workflow.json — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
This powerful n8n automation workflow is designed to execute advanced B2B lead enrichment and hyper-personalization for cold email outreach. By orchestrating a complex chain of data scraping, AI analy
Eu Clara – Funil Kiwify Completo. Uses postgres, openAi, httpRequest, gmail. Webhook trigger; 70 nodes.
This workflow bridges the gap between raw product data and revenue sales tools. It automates the entire Product Qualified Lead (PQL) lifecycle—from real-time intent routing to churn prevention—reducin
Lua Nova - Sistema Completo. Uses postgres, httpRequest, openAi. Webhook trigger; 55 nodes.
User Signup & Verification: The workflow starts when a user signs up. It generates a verification code and sends it via SMS using Twilio. Code Validation: The user replies with the code. The workflow