Como Construir Um Fluxo de Trabalho Assistido por IA no N8n Com Escalonamento Humano Usando Wassenger e Slack Pronto

27 de junho de 2025

As empresas atuais usam IA extensivamente para automação do atendimento ao cliente. No entanto, a IA não é infalível — sempre haverá cenários que exigem supervisão humana.

Neste artigo, vamos explorar como você pode criar um workflow robusto no n8n que aproveita o Wassenger para automação no WhatsApp, os modelos de Chat da OpenAI, e escalona perfeitamente para assistência humana via Slack quando necessário.

👉 Disconver our new feature flows to transform your customer service today! ⚡

⚙️ O que você vai aprender:

  • Configurar o Wassenger com o n8n
  • Integrar o modelo OpenAI Chat no seu workflow n8n
  • Criar mensagens de sistema dinâmicas para o agente de IA com comportamentos definidos
  • Projetar um caminho de escalonamento para agentes humanos usando Slack

🚀 Ferramentas que vamos usar:

  • Wassenger: plataforma de automação para WhatsApp (Flows)
  • OpenAI: API de conclusão de chat com tecnologia de IA
  • Slack: ferramenta de comunicação de equipe para escalonamento humano

👉 Start your 7-day free trial on Wassenger and leverage our powerful WhatsApp automation flows to transform your customer service today! ⚡

🔧 Guia Passo a Passo:

✅ Passo 1: Configurando o Gatilho do Wassenger

  • Conecte sua conta Wassenger ao n8n.
  • Configure um nó gatilho do Wassenger para iniciar os workflows ao receber mensagens do WhatsApp.

✅ Passo 2: Adicionando o Modelo OpenAI Chat

  • Integre o nó OpenAI no n8n.
  • Defina suas credenciais do OpenAI.
  • Configure o nó de IA para receber mensagens do Wassenger e gerar respostas.

✅ Passo 3: Configurar o Agente de IA (Comportamento Personalizado)

  • Crie um prompt de sistema claro e preciso que defina as tarefas que o agente de IA pode e não pode executar (conforme fornecido anteriormente).
  • Configure o nó do agente de IA no n8n para usar esse prompt de sistema, garantindo interações precisas e relevantes.

Aqui você encontra uma mensagem de exemplo que usamos e que você pode modificar com as informações do seu negócio

You are an AI-powered Wassenger Customer Support Agent. Your primary role is to assist users by clearly, precisely, and politely answering questions related to the Wassenger platform, its API, integrations, configurations, usage instructions, and best practices.

Your tone must always be friendly, helpful, and professional.

🚩 Tasks you CAN perform: ✅ General Information:

Explain Wassenger features and functionalities clearly.

Assist users navigating through the Wassenger interface and options.

Provide clear guidance on how to use Wassenger’s API endpoints, with examples.

✅ Integrations:

Explain how Wassenger integrates with other services such as n8n, Zapier, Make, Google Sheets, CRMs, etc.

Guide users on creating automated workflows and custom integrations.

✅ Troubleshooting:

Provide solutions for common usage issues, such as connection or session problems.

Guide on best practices for avoiding common issues, such as WhatsApp number bans.

✅ Documentation and Tutorials:

Direct users to specific help-center articles and documentation.

Provide code snippets and configuration examples as documented officially.

✅ Platform Configuration:

Explain features such as chat assignment, labels, quick replies, automatic responses, etc.

Help users set up and manage departments, roles, permissions, and team settings.

🚫 Tasks you CANNOT perform (Always escalate to human agents): If users ask questions in these categories, kindly inform them clearly and politely that their request needs to be escalated to a human agent:

⚠️ Billing and Payments:

Issues with payments, invoices, refunds, cancellations, payment method changes, upgrades, downgrades, or subscription modifications.

Example reply:

"I see your query relates to billing and payments. I'm unable to access or handle payment information for security reasons. I'll escalate your request to our human support team who will assist you shortly."

⚠️ Account Ownership and Personal Data:

Changes to account ownership or sensitive data (emails, passwords, phone number transfers).

Personal data removal, export requests (GDPR-related), or account deletion.

Example reply:

"For privacy and security reasons, I can't manage personal data or account ownership requests. Let me forward your request to our support team who will help you further."

⚠️ Legal & Compliance:

GDPR and compliance-related questions or data privacy queries.

Requests related to terms of service, legal contracts, NDAs, or compliance documentation.

Example reply:

"Your question about legal or compliance topics requires specialized attention. I will escalate your request to our compliance team to assist you better."

⚠️ Advanced Technical Issues (that exceed documented knowledge):

Complex system issues, recurring API errors unexplained by standard troubleshooting steps.

Example reply:

"Your issue seems to require an in-depth technical investigation. I'll escalate this to our technical team so they can thoroughly review and assist you."

⚠️ Urgent and Business-critical Issues:

Issues that are identified by users as critical to their business operations.

Example reply:

"Given the urgency and importance of your issue, I will forward your query immediately to our dedicated support team who will reach out to you shortly."

🎯 General Escalation Procedure: Clearly state why you cannot assist.

Politely assure the user that their query will be addressed promptly by a human.

Immediately escalate the user's issue to the appropriate Wassenger team or support queue.

- When scalating the message take the info from {{ $('Wassenger Trigger').item.json.data.body }} content

✅ Passo 4: Adicionando Memória Simples

  • Inclua o nó “Simple Memory” para armazenar e recuperar o contexto da conversa, garantindo interações coerentes.

✅ Passo 5: Escalonamento Humano Usando um Workflow de Ferramenta Personalizada

  • Se a IA estiver insegura sobre a solicitação do usuário, dispare um sub-workflow.
  • Configure um nó de lógica condicional para determinar se os detalhes do usuário (como email) foram fornecidos.

✅ Passo 6: Integração com Slack para Assistência Humana

  • Use um nó Slack para notificar as equipes de suporte humano com detalhes críticos (pergunta do usuário, informações de contato).
  • Solicite ao usuário que forneça seu endereço de email se este ainda não tiver sido informado.

👉 Start your 7-day free trial on Wassenger and leverage our powerful WhatsApp automation flows to transform your customer service today! ⚡

📐 Explicação Detalhada do Sub-workflow

Explique claramente como seu sub-workflow funciona, incluindo:

  • Verificar se um email foi fornecido.
  • Enviar mensagens solicitando o email caso esteja faltando.
  • Alertar os agentes humanos no Slack de forma clara e informativa.
  • Confirmar as mensagens de escalonamento e notificações ao usuário.

📷 Workflow (JSON Incluso)

{
  "name": "Ask a human for help when the AI doesn't know the answer",
  "nodes": [
    {
      "parameters": {
        "content": "### Main workflow: AI agent using custom tool",
        "height": 486.5625,
        "width": 927.5,
        "color": 7
      },
      "id": "48f18cda-7baf-4c63-9c48-b27236ec009d",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [0, 0],
      "typeVersion": 1
    },
    {
      "parameters": {
        "content": "**This tool calls the sub-workflow below**",
        "height": 179,
        "width": 297,
        "color": 5
      },
      "id": "8102f76d-9d93-4754-9eb2-73a87f24204e",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [560, 240],
      "typeVersion": 1
    },
    {
      "parameters": {
        "content": "**Set your credentials**",
        "height": 213.44323866265472,
        "width": 150,
        "color": 2
      },
      "id": "1e3fbc3a-c7fc-4046-8b31-bc1e2880b522",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [200, 220],
      "typeVersion": 1
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "id": "6a39707e-db29-4590-b1c8-ca2e18c7c61b",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [240, 300],
      "typeVersion": 1.2,
      "credentials": {
        "openAiApi": {
          "id": "id_number",
          "name": "OpenAi account 13"
        }
      }
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $('Wassenger Trigger') }}",
        "contextWindowLength": 20
      },
      "id": "c63f495c-ec2a-4ccc-92db-89f2649fad26",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [420, 300],
      "typeVersion": 1.3
    },
    {
      "parameters": {
        "name": "dont_know_tool",
        "description": "Use this tool if you don't know the answer to the user's question, or if you're not very confident about your answer.",
        "workflowId": {
          "__rl": true,
          "value": "CotpNRS12t1hzys2",
          "mode": "list",
          "cachedResultName": "My Sub-Workflow 1"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {},
          "matchingColumns": [],
          "schema": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      },
      "id": "4ef494b9-439b-4857-9a90-96e9a542af86",
      "name": "Not sure?",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [620, 260],
      "typeVersion": 2
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $('Wassenger Trigger') }}",
        "options": {
          "systemMessage": "=You are an AI-powered Wassenger Customer Support Agent.Your primary role is to assist users by clearly, precisely, and politely answering questions related to the Wassenger platform, its API, integrations, configurations, usage instructions, and best practices.\n\nYour tone must always be friendly, helpful, and professional.\n\n🚩 Tasks you CAN perform:\n✅ General Information:\n\nExplain Wassenger features and functionalities clearly.\n\nAssist users navigating through the Wassenger interface and options.\n\nProvide clear guidance on how to use Wassenger’s API endpoints, with examples.\n\n✅ Integrations:\n\nExplain how Wassenger integrates with other services such as n8n, Zapier, Make, Google Sheets, CRMs, etc.\n\nGuide users on creating automated workflows and custom integrations.\n\n✅ Troubleshooting:\n\nProvide solutions for common usage issues, such as connection or session problems.\n\nGuide on best practices for avoiding common issues, such as WhatsApp number bans.\n\n✅ Documentation and Tutorials:\n\nDirect users to specific help-center articles and documentation.\n\nProvide code snippets and configuration examples as documented officially.\n\n✅ Platform Configuration:\n\nExplain features such as chat assignment, labels, quick replies, automatic responses, etc.\n\nHelp users set up and manage departments, roles, permissions, and team settings.\n\n🚫 Tasks you CANNOT perform(Always escalate to human agents):\nIf users ask questions in these categories, kindly inform them clearly and politely that their request needs to be escalated to a human agent:\n\n⚠️ Billing and Payments:\n\nIssues with payments, invoices, refunds, cancellations, payment method changes, upgrades, downgrades, or subscription modifications.\n\nExample reply:\n\n\"I see your query relates to billing and payments.I'm unable to access or handle payment information for security reasons.I'll escalate your request to our human support team who will assist you shortly.\"\n\n⚠️ Account Ownership and Personal Data:\n\nChanges to account ownership or sensitive data(emails, passwords, phone number transfers).\n\nPersonal data removal, export requests(GDPR-related), or account deletion.\n\nExample reply:\n\n\"For privacy and security reasons, I can't manage personal data or account ownership requests.Let me forward your request to our support team who will help you further.\"\n\n⚠️ Legal & Compliance:\n\nGDPR and compliance-related questions or data privacy queries.\n\nRequests related to terms of service, legal contracts, NDAs, or compliance documentation.\n\nExample reply:\n\n\"Your question about legal or compliance topics requires specialized attention.I will escalate your request to our compliance team to assist you better.\"\n\n⚠️ Advanced Technical Issues(that exceed documented knowledge):\n\nComplex system issues, recurring API errors unexplained by standard troubleshooting steps.\n\nExample reply:\n\n\"Your issue seems to require an in-depth technical investigation.I'll escalate this to our technical team so they can thoroughly review and assist you.\"\n\n⚠️ Urgent and Business-critical Issues:\n\nIssues that are identified by users as critical to their business operations.\n\nExample reply:\n\n\"Given the urgency and importance of your issue, I will forward your query immediately to our dedicated support team who will reach out to you shortly.\"\n\n🎯 General Escalation Procedure:\nClearly state why you cannot assist.\n\nPolitely assure the user that their query will be addressed promptly by a human.\n\nImmediately escalate the user's issue to the appropriate Wassenger team or support queue.\n\n- When scalating the message take the info from {{ $('Wassenger Trigger').item.json.data.body }} content\n\n"
        }
      },
      "id": "0cf88611-4e6f-4b7e-b7f2-0d121b6a12b0",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [300, 60],
      "typeVersion": 1.8
    },
    {
      "parameters": {
        "device": "device_id",
        "events": ["message:in:new"],
        "sampleEvent": "inbound-text"
      },
      "type": "n8n-nodes-wassenger.wassengerTrigger",
      "typeVersion": 1,
      "position": [80, 60],
      "id": "b35532e3-7e3b-443b-bb37-9e06dba415c7",
      "name": "Wassenger Trigger",
      "webhookId": "3ab2aa49-81f1-40b8-942d-151861217f5b",
      "credentials": {
        "wassengerApiKey": {
          "id": "api_key",
          "name": "Wassenger Key account 9"
        }
      }
    },
    {
      "parameters": {
        "content": "### Sub-workflow: Custom tool\nThe agent above can call this workflow.It checks if the user has supplied an email address.If they haven't it prompts them to provide one.If they have, it messages a customer support channel for help.",
        "height": 775.3931210698682,
        "width": 1118.3459011229047,
        "color": 7
      },
      "id": "b40a664b-0b76-4201-9b52-b35d7608063a",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [0, 500],
      "typeVersion": 1
    },
    {
      "parameters": {
        "content": "**Set your credentials and Slack details**",
        "height": 250.57252651663197,
        "width": 178.0499248677781,
        "color": 2
      },
      "id": "d6901508-7d25-4a79-a569-94dd1a0ca064",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [520, 700],
      "typeVersion": 1
    },
    {
      "parameters": {
        "content": "## Next steps\n\nLearn more about [Advanced AI in n8n](https://docs.n8n.io/advanced-ai/)",
        "height": 145
      },
      "id": "bcf8c374-c209-40ab-b5cc-5b73fbc27eaa",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [820, 1060],
      "typeVersion": 1
    },
    {
      "parameters": {
        "workflowInputs": {
          "values": [
            {
              "name": "chatInput"
            }
          ]
        }
      },
      "id": "be94ed3b-5f7c-4693-a1c2-152a8128d576",
      "name": "When Executed by Another Workflow",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [100, 900],
      "typeVersion": 1.1
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "e6dce436-5e85-4722-a7e4-0ceb940a5477",
              "operator": {
                "type": "string",
                "operation": "regex"
              },
              "leftValue": "={{ $('When Executed by Another Workflow').item.json.chatInput }}",
              "rightValue": "=/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\\.[a-zA-Z0-9_-]+)/gi"
            }
          ]
        },
        "options": {}
      },
      "id": "f5f4bf5f-0553-4077-9009-35358352bd07",
      "name": "Check if user has provided email",
      "type": "n8n-nodes-base.if",
      "position": [280, 900],
      "typeVersion": 2.2
    },
    {
      "parameters": {
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "name",
          "value": "#general"
        },
        "text": "={{ \"A user had a question the bot couldn't answer.Here's their message: \" + $('When Executed by Another Workflow').first().json.chatInput }}",
        "otherOptions": {}
      },
      "id": "933b12ce-69c0-4a2d-87a7-b13ca1c21a9d",
      "name": "Message Slack for help",
      "type": "n8n-nodes-base.slack",
      "position": [560, 780],
      "webhookId": "c54bea4c-bdb6-4f42-9f82-525857df5a9a",
      "typeVersion": 2.3
    },
    {
      "parameters": {
        "jsCode": "const response = {\"response\": \"Thank you for getting in touch.I've messaged a human to help.\"}\nreturn response;"
      },
      "id": "2e1e9918-584f-4787-b723-5d1756461811",
      "name": "Confirm that we've messaged a human",
      "type": "n8n-nodes-base.code",
      "position": [780, 780],
      "typeVersion": 2
    },
    {
      "parameters": {
        "jsCode": "const response = {\"response\":\"I'm sorry I don't know the answer.Please repeat your question and include your email address so I can request help.\"};\nreturn response;"
      },
      "id": "b1cc9ce5-5c68-4476-a6a2-471ea6e75455",
      "name": "Prompt the user to provide an email",
      "type": "n8n-nodes-base.code",
      "position": [560, 1020],
      "typeVersion": 2
    },
    {
      "parameters": {
        "phone": "={{ $('Wassenger Trigger').item.json.data.fromNumber }}",
        "message": "={{ $json.output }}",
        "options": {}
      },
      "type": "n8n-nodes-wassenger.wassenger",
      "typeVersion": 1,
      "position": [660, 60],
      "id": "483fb22a-1259-4b99-b0b0-909efb61a624",
      "name": "Wassenger",
      "credentials": {
        "wassengerApiKey": {
          "id": "9du3UAbFSzEaTSQE",
          "name": "WhatsApp API key"
        }
      }
    }
  ],
  "pinData": {},
  "connections": {
    "Not sure?": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Wassenger Trigger": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When Executed by Another Workflow": {
      "main": [
        [
          {
            "node": "Check if user has provided email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if user has provided email": {
      "main": [
        [
          {
            "node": "Message Slack for help",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Prompt the user to provide an email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Message Slack for help": {
      "main": [
        [
          {
            "node": "Confirm that we've messaged a human",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Wassenger",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

🚨 Melhores Práticas

  • Defina claramente os limites da IA e as regras de escalonamento.
  • Sempre forneça feedback aos usuários durante os escalonamentos.
  • Atualize regularmente os prompts de IA para melhor precisão.
  • Monitore os escalonamentos humanos de perto para ajustar os workflows de IA conforme necessário.

💡 Conclusão

Ao integrar capacidades de IA e humanas, você garante uma automação eficaz, robusta e amigável ao usuário. Essa combinação poderosa de Wassenger, n8n, OpenAI e Slack cria uma solução de atendimento ao cliente automatizada, mas com suporte humano, que é adaptável e confiável.

📚 Leitura Complementar & Recursos

Experimente criar seus workflows assistidos por IA e compartilhe suas experiências e insights com a comunidade! Se você tiver perguntas ou sugestões, comente abaixo — estamos aqui para ajudar uns aos outros a evoluir.

👉 Start your 7-day free trial on Wassenger and leverage our powerful WhatsApp automation flows to transform your customer service today! ⚡

Ready to transform your WhatsApp communication?

Start automating your customer interactions today with Wassenger

Get Started Free