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 →
{
"name": "WF3 - Simulador de pedidos (Sabor & Cia)",
"nodes": [
{
"parameters": {
"rule": {
"interval": [
{
"field": "minutes",
"minutesInterval": 2
}
]
}
},
"id": "a1a1a1a1-0001-4000-8000-000000000001",
"name": "A cada 2 minutos",
"type": "n8n-nodes-base.scheduleTrigger",
"typeVersion": 1.2,
"position": [
-400,
0
]
},
{
"parameters": {
"jsCode": "// Simula chegada irregular de pedidos: s\u00f3 ~40% das execu\u00e7\u00f5es\n// do cron realmente vira pedido. A escolha da unidade acontece\n// DEPOIS, com base no que o servidor disser que est\u00e1 aberto.\nconst CHANCE_DE_DISPARAR = 0.4;\nif (Math.random() > CHANCE_DE_DISPARAR) {\n return [];\n}\n\n// ~90% iFood, ~5% Rappi, ~5% pr\u00f3prio \u2014 mesma distribui\u00e7\u00e3o do seed\nconst r = Math.random();\nconst plataforma = r < 0.9 ? \"ifood\" : r < 0.95 ? \"rappi\" : \"proprio\";\n\nreturn [{ json: { plataforma } }];"
},
"id": "a1a1a1a1-0002-4000-8000-000000000002",
"name": "Sorteia disparo e plataforma",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-160,
0
]
},
{
"parameters": {
"method": "GET",
"url": "https://iaplicada-sabor-cia.vercel.app/api/status",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"options": {}
},
"id": "a1a1a1a1-0003-4000-8000-000000000003",
"name": "Consulta status da rede",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
80,
0
],
"credentials": {
"httpHeaderAuth": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"jsCode": "// O servidor \u00e9 a fonte de verdade: s\u00f3 unidades ABERTAS agora e\n// com itens dispon\u00edveis no card\u00e1pio podem receber pedido.\nconst { plataforma } = $(\"Sorteia disparo e plataforma\").first().json;\nconst unidades = ($json.unidades || []).filter(\n (u) => u.aberta && (u.cardapio || []).length > 0\n);\nif (unidades.length === 0) {\n return []; // rede fechada \u2014 nenhum pedido nasce fora do hor\u00e1rio\n}\n\nconst u = unidades[Math.floor(Math.random() * unidades.length)];\n\nconst embaralhado = [...u.cardapio].sort(() => Math.random() - 0.5);\nconst quantidadeItens = 1 + Math.floor(Math.random() * Math.min(4, embaralhado.length));\nconst itens = embaralhado.slice(0, quantidadeItens).map((p) => ({\n produto_id: p.produto_id,\n quantidade: 1 + Math.floor(Math.random() * 3),\n}));\n\nreturn [{ json: { unidade_id: u.unidade_id, plataforma, itens } }];"
},
"id": "a1a1a1a1-0004-4000-8000-000000000004",
"name": "Monta pedido pela vitrine",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
320,
0
]
},
{
"parameters": {
"method": "POST",
"url": "https://iaplicada-sabor-cia.vercel.app/api/pedidos/simular",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
},
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={{ JSON.stringify($json) }}",
"options": {}
},
"id": "a1a1a1a1-0005-4000-8000-000000000005",
"name": "Envia pedido simulado",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
560,
0
],
"credentials": {
"httpHeaderAuth": {
"name": "<your credential>"
}
}
}
],
"connections": {
"A cada 2 minutos": {
"main": [
[
{
"node": "Sorteia disparo e plataforma",
"type": "main",
"index": 0
}
]
]
},
"Sorteia disparo e plataforma": {
"main": [
[
{
"node": "Consulta status da rede",
"type": "main",
"index": 0
}
]
]
},
"Consulta status da rede": {
"main": [
[
{
"node": "Monta pedido pela vitrine",
"type": "main",
"index": 0
}
]
]
},
"Monta pedido pela vitrine": {
"main": [
[
{
"node": "Envia pedido simulado",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"executionOrder": "v1"
}
}
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.
httpHeaderAuth
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
WF3 - Simulador de pedidos (Sabor & Cia). Uses httpRequest. Scheduled trigger; 5 nodes.
Source: https://github.com/matheusvfarah/iaplicada-sabor-cia/blob/09f06144aa3dd0e13400a4c5795b431e8488ee08/automations/simulador-pedidos.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.
Birthday Automation - Production (Fixed). Uses stopAndError, httpRequest, emailSend, bannerbear. Scheduled trigger; 86 nodes.
This template runs two scheduled workflows to govern Microsoft Entra ID (Azure AD) guest accounts by detecting stale users via Microsoft Graph, staging deletions in SharePoint with a 72-hour window, n
Jira-Allure-Auto-Qa. Uses httpRequest, jira. Scheduled trigger; 68 nodes.
Spotify-Sync-Surrealdb-V1. Uses httpRequest, n8n-nodes-surrealdb, spotify. Scheduled trigger; 62 nodes.
As n8n instances scale, teams often lose track of sub-workflows—who uses them, where they are referenced, and whether they can be safely updated. This leads to inefficiencies like unnecessary copies o