AutomationFlowsData & Sheets › Escalar Humano - Neo Vertex

Escalar Humano - Neo Vertex

02. Escalar humano - Neo Vertex. Uses executeWorkflowTrigger, httpRequest, postgres. Event-driven trigger; 17 nodes.

Event trigger★★★★☆ complexity17 nodesExecute Workflow TriggerHTTP RequestPostgres
Data & Sheets Trigger: Event Nodes: 17 Complexity: ★★★★☆ Added:

This workflow follows the Execute Workflow Trigger → HTTP Request recipe pattern — see all workflows that pair these two integrations.

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 →

Download .json
{
  "name": "02. Escalar humano - Neo Vertex",
  "nodes": [
    {
      "parameters": {
        "workflowInputs": {
          "values": [
            {
              "name": "telefone"
            },
            {
              "name": "nome"
            },
            {
              "name": "motivo"
            },
            {
              "name": "resumo_conversa"
            },
            {
              "name": "horario_sugerido"
            },
            {
              "name": "id_conta"
            },
            {
              "name": "id_conversa"
            },
            {
              "name": "url_chatwoot"
            },
            {
              "name": "owner_whatsapp"
            }
          ]
        }
      },
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "typeVersion": 1.1,
      "position": [
        260,
        540
      ],
      "id": "20000000-0001-4001-8001-000000000001",
      "name": "Gatilho"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "20000000-0a01-4a01-8a01-000000000001",
              "name": "etiqueta_motivo",
              "value": "={{ ({ pedido_humano: 'pediu-humano', horario_marcado: 'aguardando-horario', fora_escopo: 'fora-escopo', desrespeito: 'desrespeito' })[$json.motivo] || 'lead-novo' }}",
              "type": "string"
            },
            {
              "id": "20000000-0a02-4a02-8a02-000000000002",
              "name": "rotulo_motivo_humano",
              "value": "={{ ({ pedido_humano: 'Pediu falar com humano', horario_marcado: 'Hor\u00e1rio escolhido pelo lead', fora_escopo: 'Demanda fora de escopo', desrespeito: 'Desrespeito / linguagem ofensiva' })[$json.motivo] || $json.motivo }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        460,
        540
      ],
      "id": "20000000-0002-4002-8002-000000000002",
      "name": "Mapear motivo"
    },
    {
      "parameters": {
        "url": "={{ $('Gatilho').item.json.url_chatwoot }}/api/v1/accounts/{{ $('Gatilho').item.json.id_conta }}/conversations/{{ $('Gatilho').item.json.id_conversa }}/labels",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "chatwootApi",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        660,
        540
      ],
      "id": "20000000-0003-4003-8003-000000000003",
      "name": "Listar etiquetas da conversa"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "={{ $('Gatilho').item.json.url_chatwoot }}/api/v1/accounts/{{ $('Gatilho').item.json.id_conta }}/conversations/{{ $('Gatilho').item.json.id_conversa }}/labels",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "chatwootApi",
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "labels",
              "value": "={{ $json.payload.append('agente-off').append($('Mapear motivo').item.json.etiqueta_motivo).unique() }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        880,
        540
      ],
      "id": "20000000-0004-4004-8004-000000000004",
      "name": "Aplicar etiquetas"
    },
    {
      "parameters": {
        "operation": "upsert",
        "schema": {
          "__rl": true,
          "mode": "list",
          "value": "public"
        },
        "table": {
          "__rl": true,
          "value": "nv_status_atendimento",
          "mode": "list"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "telefone": "={{ $('Gatilho').item.json.telefone }}",
            "agente_pausado": true,
            "atualizado_em": "={{ $now }}"
          },
          "matchingColumns": [
            "telefone"
          ],
          "schema": [
            {
              "id": "telefone",
              "displayName": "telefone",
              "required": true,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "lock_conversa",
              "displayName": "lock_conversa",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "boolean",
              "canBeUsedToMatch": false,
              "removed": true
            },
            {
              "id": "agente_pausado",
              "displayName": "agente_pausado",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "boolean",
              "canBeUsedToMatch": false
            },
            {
              "id": "atualizado_em",
              "displayName": "atualizado_em",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "dateTime",
              "canBeUsedToMatch": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 2.6,
      "position": [
        1100,
        540
      ],
      "id": "20000000-0005-4005-8005-000000000005",
      "name": "Pausar agente"
    },
    {
      "parameters": {
        "schema": {
          "__rl": true,
          "mode": "list",
          "value": "public"
        },
        "table": {
          "__rl": true,
          "value": "nv_leads",
          "mode": "list"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "telefone": "={{ $('Gatilho').item.json.telefone }}",
            "nome": "={{ $('Gatilho').item.json.nome }}",
            "empresa": "",
            "area_interesse": "",
            "motivo_escala": "={{ $('Gatilho').item.json.motivo }}",
            "horario_sugerido": "={{ $('Gatilho').item.json.horario_sugerido }}"
          },
          "matchingColumns": [
            "id"
          ],
          "schema": [
            {
              "id": "id",
              "displayName": "id",
              "required": false,
              "defaultMatch": true,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "telefone",
              "displayName": "telefone",
              "required": true,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "nome",
              "displayName": "nome",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "empresa",
              "displayName": "empresa",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "area_interesse",
              "displayName": "area_interesse",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "motivo_escala",
              "displayName": "motivo_escala",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "horario_sugerido",
              "displayName": "horario_sugerido",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "criado_em",
              "displayName": "criado_em",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "dateTime",
              "canBeUsedToMatch": true,
              "removed": true
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 2.6,
      "position": [
        1320,
        540
      ],
      "id": "20000000-0006-4006-8006-000000000006",
      "name": "Registrar lead no CRM"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "={{ $('Gatilho').item.json.url_chatwoot }}/api/v1/accounts/{{ $('Gatilho').item.json.id_conta }}/contacts/search",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "chatwootApi",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "q",
              "value": "={{ $('Gatilho').item.json.owner_whatsapp }}"
            },
            {
              "name": "include",
              "value": "contact_inboxes"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1540,
        540
      ],
      "id": "20000000-0007-4007-8007-000000000007",
      "name": "Buscar contato Nelson",
      "alwaysOutputData": true,
      "onError": "continueRegularOutput"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "20000000-0c01-4c01-8c01-000000000001",
              "leftValue": "={{ $json.payload && $json.payload.length > 0 }}",
              "rightValue": "",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        1760,
        540
      ],
      "id": "20000000-0008-4008-8008-000000000008",
      "name": "Contato existe?"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "={{ $('Gatilho').item.json.url_chatwoot }}/api/v1/accounts/{{ $('Gatilho').item.json.id_conta }}/contacts",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "chatwootApi",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"name\": \"Nelson (Dono Neo Vertex)\",\n  \"phone_number\": \"{{ $('Gatilho').item.json.owner_whatsapp }}\",\n  \"inbox_id\": 5\n}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1980,
        680
      ],
      "id": "20000000-0009-4009-8009-000000000009",
      "name": "Criar contato Nelson",
      "alwaysOutputData": true,
      "onError": "continueRegularOutput"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "20000000-0a03-4a03-8a03-000000000003",
              "name": "id_contato_nelson",
              "value": "={{ $('Contato existe?').item.json.payload[0].id }}",
              "type": "string"
            },
            {
              "id": "20000000-0a04-4a04-8a04-000000000004",
              "name": "source_id",
              "value": "={{ $('Contato existe?').item.json.payload[0].contact_inboxes && $('Contato existe?').item.json.payload[0].contact_inboxes.length ? $('Contato existe?').item.json.payload[0].contact_inboxes[0].source_id : '' }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1980,
        420
      ],
      "id": "20000000-000a-400a-800a-00000000000a",
      "name": "Extrair contato existente"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "20000000-0a05-4a05-8a05-000000000005",
              "name": "id_contato_nelson",
              "value": "={{ $json.payload.contact.id }}",
              "type": "string"
            },
            {
              "id": "20000000-0a06-4a06-8a06-000000000006",
              "name": "source_id",
              "value": "={{ $json.payload.contact_inbox ? $json.payload.contact_inbox.source_id : '' }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        2200,
        680
      ],
      "id": "20000000-000b-400b-800b-00000000000b",
      "name": "Extrair contato criado"
    },
    {
      "parameters": {
        "mode": "combine",
        "combineBy": "combineAll",
        "options": {}
      },
      "type": "n8n-nodes-base.merge",
      "typeVersion": 3.2,
      "position": [
        2400,
        540
      ],
      "id": "20000000-000c-400c-800c-00000000000c",
      "name": "Merge contato"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "={{ $('Gatilho').item.json.url_chatwoot }}/api/v1/accounts/{{ $('Gatilho').item.json.id_conta }}/conversations",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "chatwootApi",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"source_id\": \"{{ $json.source_id || $('Gatilho').item.json.owner_whatsapp }}\",\n  \"inbox_id\": 5,\n  \"contact_id\": {{ $json.id_contato_nelson }},\n  \"status\": \"open\"\n}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        2600,
        540
      ],
      "id": "20000000-000d-400d-800d-00000000000d",
      "name": "Criar conversa alerta",
      "alwaysOutputData": true,
      "onError": "continueRegularOutput"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "={{ $('Gatilho').item.json.url_chatwoot }}/api/v1/accounts/{{ $('Gatilho').item.json.id_conta }}/conversations/{{ $json.id }}/messages",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "chatwootApi",
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "content",
              "value": "=[ALERTA] Lead aguardando atendimento humano.\n\nNome: {{ $('Gatilho').item.json.nome || '(n\u00e3o informado)' }}\nTelefone: {{ $('Gatilho').item.json.telefone }}\nMotivo: {{ $('Mapear motivo').item.json.rotulo_motivo_humano }}\n\nResumo da conversa:\n{{ $('Gatilho').item.json.resumo_conversa }}\n\n{{ $('Gatilho').item.json.horario_sugerido ? `Hor\u00e1rio sugerido pelo lead: ${$('Gatilho').item.json.horario_sugerido}\\n\\n` : '' }}A IA j\u00e1 foi pausada nesta conversa (etiqueta agente-off aplicada). Para reativar, remova a etiqueta agente-off na conversa do lead."
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        2800,
        540
      ],
      "id": "20000000-000e-400e-800e-00000000000e",
      "name": "Enviar alerta no WhatsApp do Nelson"
    },
    {
      "parameters": {
        "content": "## 02. Escalar humano - Neo Vertex\n\nSub-workflow chamado pela tool `Escalar_humano` do agente principal.\n\nFluxo:\n1. Mapeia motivo -> etiqueta secund\u00e1ria\n2. Lista etiquetas da conversa do lead\n3. Aplica etiquetas (agente-off + motivo)\n4. Pausa o agente para esse telefone na tabela nv_status_atendimento\n5. Registra o lead no CRM (nv_leads)\n6. Busca ou cria o contato do Nelson (+5521972808355) na inbox 5\n7. Cria uma conversa nova com o Nelson nessa inbox\n8. Envia mensagem formatada [ALERTA] avisando que tem lead esperando\n\nSem emoji decorativo no texto do alerta \u2014 s\u00f3 o tag [ALERTA] inicial.",
        "height": 360,
        "width": 700,
        "color": 7
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        200,
        160
      ],
      "id": "20000000-000f-400f-800f-00000000000f",
      "name": "Sticky Note Header"
    },
    {
      "parameters": {
        "content": "## Pausar IA + registrar CRM",
        "height": 320,
        "width": 940,
        "color": 4
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        440,
        420
      ],
      "id": "20000000-0010-4010-8010-000000000010",
      "name": "Sticky Note Pausar"
    },
    {
      "parameters": {
        "content": "## Localizar/criar contato Nelson e enviar alerta",
        "height": 460,
        "width": 1500,
        "color": 5
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1500,
        320
      ],
      "id": "20000000-0011-4011-8011-000000000011",
      "name": "Sticky Note Nelson"
    }
  ],
  "connections": {
    "Gatilho": {
      "main": [
        [
          {
            "node": "Mapear motivo",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mapear motivo": {
      "main": [
        [
          {
            "node": "Listar etiquetas da conversa",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Listar etiquetas da conversa": {
      "main": [
        [
          {
            "node": "Aplicar etiquetas",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aplicar etiquetas": {
      "main": [
        [
          {
            "node": "Pausar agente",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Pausar agente": {
      "main": [
        [
          {
            "node": "Registrar lead no CRM",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Registrar lead no CRM": {
      "main": [
        [
          {
            "node": "Buscar contato Nelson",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Buscar contato Nelson": {
      "main": [
        [
          {
            "node": "Contato existe?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Contato existe?": {
      "main": [
        [
          {
            "node": "Extrair contato existente",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Criar contato Nelson",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extrair contato existente": {
      "main": [
        [
          {
            "node": "Merge contato",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Criar contato Nelson": {
      "main": [
        [
          {
            "node": "Extrair contato criado",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extrair contato criado": {
      "main": [
        [
          {
            "node": "Merge contato",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge contato": {
      "main": [
        [
          {
            "node": "Criar conversa alerta",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Criar conversa alerta": {
      "main": [
        [
          {
            "node": "Enviar alerta no WhatsApp do Nelson",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "00000000-0000-4000-8000-000000000002",
  "id": "NV02EscalarHumanoId",
  "tags": []
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

02. Escalar humano - Neo Vertex. Uses executeWorkflowTrigger, httpRequest, postgres. Event-driven trigger; 17 nodes.

Source: https://github.com/Neo-Vertex/NeoVertex/blob/0ecc264ffa67b27d2f6bdf747f6fd03878a5bec8/n8n/02_escalar_humano.json — original creator credit. Request a take-down →

More Data & Sheets workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Data & Sheets

Reagendamiento_v2. Uses executeWorkflowTrigger, redis, httpRequest, n8n-nodes-evolution-api. Event-driven trigger; 89 nodes.

Execute Workflow Trigger, Redis, HTTP Request +3
Data & Sheets

Agendamiento_v2. Uses n8n-nodes-evolution-api, redis, httpRequest, executeWorkflowTrigger. Event-driven trigger; 59 nodes.

N8N Nodes Evolution Api, Redis, HTTP Request +3
Data & Sheets

Cancelacion_v2. Uses executeWorkflowTrigger, redis, httpRequest, n8n-nodes-evolution-api. Event-driven trigger; 46 nodes.

Execute Workflow Trigger, Redis, HTTP Request +3
Data & Sheets

Save_Extraction. Uses executeWorkflowTrigger, postgres, httpRequest. Event-driven trigger; 22 nodes.

Execute Workflow Trigger, Postgres, HTTP Request
Data & Sheets

Youtube Searcher. Uses splitInBatches, httpRequest, manualTrigger, executeWorkflowTrigger. Event-driven trigger; 21 nodes.

HTTP Request, Execute Workflow Trigger, Postgres +1