WhatsApp - Human Takeover
AI-generatedOverview
This node detects when a human takes over a WhatsApp conversation from a bot and manages the bot's response accordingly. It is useful in scenarios where automated bot responses need to be paused when a human agent is interacting with the client, either automatically for a set time or manually via a control flag. It can also detect specific keywords from the client to trigger human takeover. For example, if a client types "help" or "urgent," the node can detect this and switch the conversation to a human agent, pausing the bot's responses.
Use Case Examples
- Automatically pause bot responses for 10 minutes when a human replies, then resume bot responses.
- Manually control bot pause and resume using a flag in the workflow.
- Detect keywords like "atendente" or "problema" to trigger human takeover.
Properties
| Name | Meaning |
|---|---|
| Ativar Detecção | Enable or disable detection of human takeover. If disabled, the bot always responds. |
| Modo de Controle | How the bot resumes responding after human takeover: automatically after a timer or manually via a flag. |
| Tempo de Bloqueio (minutos) | Duration in minutes for which the bot remains paused before resuming automatically (only if automatic mode is selected). |
| Nome da Flag de Controle | Name of the flag used to control bot resumption manually (only if manual mode is selected). |
| Ativar Detecção por Palavras-Chave | Enable detection of specific keywords typed by the client to trigger human takeover. |
| Palavras-Chave (uma por linha) | List of keywords or phrases that trigger human takeover when detected in client messages (case-insensitive). |
Output
JSON
humanTakeoverdetected- Indicates if human takeover was detected in the message.firstTime- Indicates if this is the first detection of human takeover for the session.mode- Mode of control for the takeover ('automatic' or 'manual').chatId- Identifier of the chat where takeover was detected.detectedAt- Timestamp when human takeover was detected.timeoutMinutes- Timeout duration in minutes for automatic mode.flagName- Name of the control flag for manual mode.triggeredBy- Reason for takeover detection ('keyword' or human reply).detectedKeyword- The keyword that triggered the takeover, if applicable.waiting- Indicates if the client is waiting for a human agent.remainingMinutes- Remaining minutes before bot resumes in automatic mode.requestedAgain- Indicates if the client requested human takeover again while already in a session.message- Additional message or instructions related to the takeover state.
Troubleshooting
- Ensure the global variable 'humanTakeoverSessions' is not cleared or overwritten by other nodes or workflows, as it stores active session states.
- If the bot does not resume after the timeout in automatic mode, verify that the system time is correct and that the timeoutMinutes parameter is set properly.
- In manual mode, ensure the flag name matches exactly and that the flag is properly set/unset in the workflow to control bot resumption.
- Keyword detection is case-insensitive but requires exact substring matches; ensure keywords are correctly configured and separated by new lines.