From e61d8895ff956bba4b04225c441fa14327d8f930 Mon Sep 17 00:00:00 2001 From: Eric Date: Thu, 20 Aug 2026 22:06:29 -0300 Subject: [PATCH] feat(n8n): extrai campos do webhook e filtra mensagens de imagem Co-Authored-By: Claude Sonnet 5 --- n8n/orcamento-exames-imagem.workflow.json | 129 +++++++++++++++++++++- 1 file changed, 128 insertions(+), 1 deletion(-) diff --git a/n8n/orcamento-exames-imagem.workflow.json b/n8n/orcamento-exames-imagem.workflow.json index 23a3362..2bdfdc8 100644 --- a/n8n/orcamento-exames-imagem.workflow.json +++ b/n8n/orcamento-exames-imagem.workflow.json @@ -19,9 +19,136 @@ "options": {} }, "webhookId": "5ea5f89e-7351-4d45-a881-0055009423a0" + }, + { + "id": "extrair-campos", + "name": "Extrair campos do webhook", + "type": "n8n-nodes-base.set", + "typeVersion": 3.4, + "position": [ + -360, + 0 + ], + "parameters": { + "assignments": { + "assignments": [ + { + "id": "campo-sessionid", + "name": "sessionId", + "type": "string", + "value": "={{ $json.body.protocol }}" + }, + { + "id": "campo-telefone", + "name": "telefone", + "type": "string", + "value": "={{ $json.body.number }}" + }, + { + "id": "campo-nomecontato", + "name": "nomeContato", + "type": "string", + "value": "={{ $json.body.contactName }}" + }, + { + "id": "campo-imagemurl", + "name": "imagemUrl", + "type": "string", + "value": "={{ $json.body.mediaUrl || $json.body.fileUrl || $json.body.file || '' }}" + }, + { + "id": "campo-tipomidia", + "name": "tipoMidia", + "type": "string", + "value": "={{ $json.body.mediaType || $json.body.type || '' }}" + } + ] + }, + "options": {} + } + }, + { + "id": "if-e-imagem", + "name": "É mensagem de imagem?", + "type": "n8n-nodes-base.if", + "typeVersion": 2.3, + "position": [ + -120, + 0 + ], + "parameters": { + "conditions": { + "options": { + "version": 2, + "leftValue": "", + "caseSensitive": true, + "typeValidation": "strict" + }, + "combinator": "and", + "conditions": [ + { + "id": "cond-tem-imagem", + "leftValue": "={{ $json.imagemUrl }}", + "rightValue": "", + "operator": { + "type": "string", + "operation": "notEmpty", + "singleValue": true + } + } + ] + }, + "options": {} + } + }, + { + "id": "noop-nao-imagem", + "name": "Não é imagem - encerra", + "type": "n8n-nodes-base.noOp", + "typeVersion": 1, + "position": [ + 120, + 160 + ], + "parameters": {} } ], - "connections": {}, + "connections": { + "Webhook - Foto Exame": { + "main": [ + [ + { + "node": "Extrair campos do webhook", + "type": "main", + "index": 0 + } + ] + ] + }, + "Extrair campos do webhook": { + "main": [ + [ + { + "node": "É mensagem de imagem?", + "type": "main", + "index": 0 + } + ] + ] + }, + "É mensagem de imagem?": { + "main": [ + [], + [ + { + "node": "Não é imagem - encerra", + "type": "main", + "index": 0 + } + ] + ] + } + }, "settings": { "executionOrder": "v1", "saveDataErrorExecution": "all",