From e1ea3dee530616affadf29545403a685465f800a Mon Sep 17 00:00:00 2001 From: Eric Date: Thu, 20 Aug 2026 22:12:52 -0300 Subject: [PATCH] feat(n8n): monta resposta com fallback de erro e envia via sub-workflow Z-PRO Co-Authored-By: Claude Sonnet 5 --- n8n/orcamento-exames-imagem.workflow.json | 148 +++++++++++++++++++++- 1 file changed, 147 insertions(+), 1 deletion(-) diff --git a/n8n/orcamento-exames-imagem.workflow.json b/n8n/orcamento-exames-imagem.workflow.json index 2df51c8..c8710dd 100644 --- a/n8n/orcamento-exames-imagem.workflow.json +++ b/n8n/orcamento-exames-imagem.workflow.json @@ -18,7 +18,8 @@ "responseMode": "onReceived", "options": {} }, - "webhookId": "5ea5f89e-7351-4d45-a881-0055009423a0" + "webhookId": "5ea5f89e-7351-4d45-a881-0055009423a0", + "onError": "continueRegularOutput" }, { "id": "extrair-campos", @@ -176,6 +177,115 @@ } }, "onError": "continueErrorOutput" + }, + { + "id": "montar-corpo-resposta", + "name": "Montar corpo da resposta", + "type": "n8n-nodes-base.set", + "typeVersion": 3.4, + "position": [ + 640, + -120 + ], + "parameters": { + "assignments": { + "assignments": [ + { + "id": "resp-number", + "name": "number", + "type": "string", + "value": "={{ $('Extrair campos do webhook').item.json.telefone }}" + }, + { + "id": "resp-body", + "name": "body", + "type": "string", + "value": "={{ $json.output ? $json.output : 'Recebemos sua solicitação de exames! Nossa equipe vai confirmar os valores e te retornar em breve.' }}" + }, + { + "id": "resp-externalkey", + "name": "externalKey", + "type": "string", + "value": "={{ 'orcamento-' + $execution.id }}" + }, + { + "id": "resp-isclosed", + "name": "isClosed", + "type": "boolean", + "value": false + } + ] + }, + "options": {} + } + }, + { + "id": "enviar-orcamento-zpro", + "name": "Enviar orçamento (Z-PRO)", + "type": "n8n-nodes-base.executeWorkflow", + "typeVersion": 1.3, + "position": [ + 900, + -120 + ], + "parameters": { + "workflowId": { + "__rl": true, + "mode": "id", + "value": "Y4ndG7GuIUrmVRxV", + "cachedResultName": "MCP Server - Mensageria ZPRO - enviar_texto" + }, + "workflowInputs": { + "mappingMode": "defineBelow", + "value": { + "number": "={{ $json.number }}", + "body": "={{ $json.body }}", + "externalKey": "={{ $json.externalKey }}", + "isClosed": "={{ $json.isClosed }}" + }, + "matchingColumns": [], + "schema": [ + { + "id": "number", + "displayName": "number", + "required": false, + "defaultMatch": false, + "display": true, + "canBeUsedToMatch": true, + "type": "string" + }, + { + "id": "body", + "displayName": "body", + "required": false, + "defaultMatch": false, + "display": true, + "canBeUsedToMatch": true, + "type": "string" + }, + { + "id": "externalKey", + "displayName": "externalKey", + "required": false, + "defaultMatch": false, + "display": true, + "canBeUsedToMatch": true, + "type": "string" + }, + { + "id": "isClosed", + "displayName": "isClosed", + "required": false, + "defaultMatch": false, + "display": true, + "canBeUsedToMatch": true, + "type": "boolean" + } + ], + "attemptToConvertTypes": false, + "convertFieldsToString": false + } + } } ], "connections": { @@ -227,6 +337,13 @@ "type": "main", "index": 0 } + ], + [ + { + "node": "Montar corpo da resposta", + "type": "main", + "index": 0 + } ] ] }, @@ -240,6 +357,35 @@ } ] ] + }, + "AI Agent - Orçamento": { + "main": [ + [ + { + "node": "Montar corpo da resposta", + "type": "main", + "index": 0 + } + ], + [ + { + "node": "Montar corpo da resposta", + "type": "main", + "index": 0 + } + ] + ] + }, + "Montar corpo da resposta": { + "main": [ + [ + { + "node": "Enviar orçamento (Z-PRO)", + "type": "main", + "index": 0 + } + ] + ] } }, "settings": {