feat(n8n): extrai campos do webhook e filtra mensagens de imagem

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Eric
2026-08-20 22:06:29 -03:00
co-authored by Claude Sonnet 5
parent fb336d4278
commit e61d8895ff
+128 -1
View File
@@ -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",