Skip to main content

Smart human takeover & auto pause AI-powered Facebook Messenger chatbot

Workflow preview

Workflow preview
100%
 Smart human takeover & auto pause AI-powered Facebook Messenger chatbot preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

Facebook Messenger Chatbot Smart Human Takeover, Auto Pause & Context Aware Adaptable to n8n 1.113+ and 2.x by Nguyen Thieu Toa...

Best for

  • Support Chatbot automation workflows
  • AI Chatbot automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.webhook, n8n-nodes-base.set, n8n-nodes-base.code, @n8n/n8n-nodes-langchain.lmchatgooglegemini, n8n-nodes-base.wait, n8n-nodes-base.splitinbatches, n8n-nodes-base.if, n8n-nodes-base.datatable

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Nguyễn Thiệu Toàn (Jay Nguyen).

Original n8n.io source

1.1 Workflow description

Title
Smart human takeover & auto pause AI-powered Facebook Messenger chatbot
Workflow name
Smart human takeover & auto pause AI-powered Facebook Messenger chatbot

🤖 Facebook Messenger Chatbot - Smart Human Takeover, Auto Pause & Context-Aware

Adaptable to n8n 1.113+ and 2.x

by Nguyen Thieu Toan (Jay Nguyen)


📖 Overview

An intelligent Facebook Messenger chatbot that automatically detects human agent intervention and pauses AI responses accordingly. Features smart pause management, full context preservation, and seamless handoff between AI and human support.

Perfect for:

  • 💼 Customer support with AI + human escalation
  • 🎯 Sales conversations requiring manual intervention
  • 🛠️ Technical support needing human expertise
  • 🤝 Any chatbot requiring human oversight capability

Requirements: n8n v1.113.0+, Facebook App with Messenger, Google Gemini API key (or compatible LLM)


🔗 Complementary Workflow

Smart Facebook Messenger Chatbot – Message Batching & History

Enhances Messenger automation with intelligent batching, conversation tracking, and context-aware responses.
Messages are grouped, stored, and processed with full history for smoother interactions.

Why combine?

  • 🧩 Smart Batch (v3): Efficient multi-message handling, reduced spam
  • 📜 Conversation History: Maintains context across sessions
  • 🤖 AI Responses: Natural, context-aware replies
  • Scalability: Sequential processing for reliable delivery

👉 Access workflow Smart Facebook Messenger Chatbot – Message Batching & History


⚡ Key Features

Core Capabilities

Feature Description
🔍 Human Takeover Detection Automatically detects when admin/human sends messages from page via metadata checking
⏸️ Smart Auto-Pause Bot pauses for configurable duration (default 60s) when human joins conversation
📝 Context Preservation Saves both AI and human responses in conversation history for seamless continuity
📋 Whitelist Management Tracks paused users with timestamp-based auto-resume (no manual intervention needed)
🔄 Seamless Handoff Smooth transition between AI and human, then automatic resume after timeout
🏢 Multi-Page Support Single workflow handles multiple Facebook Pages via page_id differentiation
📊 Full History Context AI sees both previous AI and human responses when resuming

Technical Highlights

  • ✅ Metadata-based detection (message.metadata == "bot_rep")
  • ✅ Timestamp-based pause management (auto-expires)
  • ✅ Upsert operation for whitelist (updates if exists, inserts if new)
  • ✅ Composite key indexing (user_id + page_id)
  • ✅ Zero manual cleanup required
  • ✅ Full conversation context preserved across handoffs

🏗️ How It Works

┌──────────────────────────────────────────────────────────┐
│ 1. Message Intake                                        │
│ • The system receives incoming messages from different   │
│   sources and identifies their type.                     │
└──────────────────────────────────────────────────────────┘
                         ↓
┌──────────────────────────────────────────────────────────┐
│ 2. Human Interaction Recognition                         │
│ • Detects when a human is involved and records the event │
│ • Adjusts automated handling accordingly.                │
└──────────────────────────────────────────────────────────┘
                         ↓
┌──────────────────────────────────────────────────────────┐
│ 3. Pause & Resume Control                                │
│ • Temporarily pauses automation when needed              │
│ • Resumes once conditions are met.                       │
└──────────────────────────────────────────────────────────┘
                         ↓
┌──────────────────────────────────────────────────────────┐
│ 4. Automated Response                                    │
│ • Processes messages with context                        │
│ • Generates and delivers appropriate replies.            │
└──────────────────────────────────────────────────────────┘

🛠️ Setup Guide

Step 1: Facebook App Setup

Step 2: Data Storage Preparation

Step 3: Workflow Configuration

Step 4: Testing


👤 About the Author

Nguyen Thieu Toan (Nguyễn Thiệu Toàn / Jay Nguyen)

AI Automation Specialist | n8n Workflow Expert | Business Optimization Consultant

Services: AI Automation Solutions, n8n Workflow Development, Custom Chatbot Implementation, Team Training Programs

Contact:

GenStaff Company: genstaff.net | [email protected]


📄 License

After purchase, use in commercial/personal projects. No redistribution or resale. Keep author attribution when sharing.

Last Updated: December 18, 2025 | Version: 1.0 | n8n Compatibility: v1.123.0+ and v2.0.0+ | Facebook API: v23.0/v24.0


Ready to enable intelligent human-AI collaboration in your Facebook Messenger? Import this workflow and transform your chatbot today! 🚀

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Facebook Webhook

Type / Role
n8n-nodes-base.webhook - webhook
Config choices
Version 2.1

Block 2 - Set Context

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 3 - Format for Facebook Output

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 4 - Google Gemini Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatGoogleGemini - lmChatGoogleGemini
Config choices
Version 1

Block 5 - Get 15 newest rows

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 6 - Delay Between Messages

Type / Role
n8n-nodes-base.wait - wait
Config choices
Version 1.1

Block 7 - Loop Over Items

Type / Role
n8n-nodes-base.splitInBatches - splitInBatches
Config choices
Version 3

Block 8 - Comparison time

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 9 - Is still Pause?

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.3

Block 10 - Merge History and Find Min_ID

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 11 - User is Reciepient

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 12 - User is Sender

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 13 - Insert to Paused List

Type / Role
n8n-nodes-base.dataTable - dataTable
Config choices
Version 1.1

Block 14 - Remove from Paused List

Type / Role
n8n-nodes-base.dataTable - dataTable
Config choices
Version 1.1

Block 15 - Confirm Webhook

Type / Role
n8n-nodes-base.respondToWebhook - respondToWebhook
Config choices
Version 1.5

Block 16 - Is from page?

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.3

Block 17 - Is from AI?

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.3

Block 18 - Insert human rep

Type / Role
n8n-nodes-base.dataTable - dataTable
Config choices
Version 1.1

Block 19 - Seen

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.3

Block 20 - Insert To Processed

Type / Role
n8n-nodes-base.dataTable - dataTable
Config choices
Version 1.1

Block 21 - Insert To Unprocessed

Type / Role
n8n-nodes-base.dataTable - dataTable
Config choices
Version 1.1

Block 22 - Get history message

Type / Role
n8n-nodes-base.dataTable - dataTable
Config choices
Version 1.1

Block 23 - Send Typing

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.3

Block 24 - Process Merged Message

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 3.1

Showing the first 24 of 40 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Smart human takeover & auto pause AI-powered Facebook Messenger chatbot
Complexity advanced
Nodes 40
Categories Support Chatbot, AI Chatbot
Author Nguyễn Thiệu Toàn (Jay Nguyen)
Published 18 Dec 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/11920/11920.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Smart human takeover & auto pause AI-powered Facebook Messenger chatbot do?

Facebook Messenger Chatbot Smart Human Takeover, Auto Pause & Context Aware Adaptable to n8n 1.113+ and 2.x by Nguyen Thieu Toa...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Support Chatbot, AI Chatbot use case.