Smart message batching AI-powered Facebook Messenger chatbot use Data Table

Go to Workflow
2,189 views
Built by Nguyแป…n Thiแป‡u Toร n (Jay Nguyen) Nguyแป…n Thiแป‡u Toร n (Jay Nguyen)
Created on June 05, 2026

Description

๐Ÿค– Facebook Messenger Smart Chatbot - Smart Batch, Format & History with n8n Data Table v3
Version 2026 - Adaptable to n8n v1.113+ and v2.x
by Nguyen Thieu Toan (Jay Nguyen)

๐Ÿ“– Overview

A production-ready, enterprise-grade chatbot solution for Facebook Messenger built entirely in n8n. Features intelligent message batching, session-aware conversation tracking, multi-page support, and natural AI-powered responses.

Perfect for:
๐Ÿ’ผ Customer support automation
๐Ÿ›’ E-commerce product inquiries
๐Ÿ“… Appointment scheduling & consultation booking
๐ŸŽ“ Educational assistants & training
๐Ÿค Lead qualification & sales automation

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

๐Ÿ”— Complementary Workflow

Facebook Messenger Chatbot โ€“ Smart Human Takeover, Auto Pause & Context-Aware

Adds intelligent human agent detection and automatic AI pause. When a human joins, AI pauses for configurable duration, then resumes automatically.

Why combine?
Smart Batch (v3): Multi-message batching, spam reduction
Human Takeover: AI pauses for humans, smooth collaboration

๐Ÿ‘‰ Access workflow

โšก What's New in Version 3

Major Upgrades

| Feature | Impact |
|---------|--------|
| ๐Ÿข Multi-Page Support | Manage multiple pages within one workflow |
| โฑ๏ธ Flexible Timing | Adjustable wait times instead of fixed delays |
| ๐Ÿ”’ Improved Detection | More reliable identification of system vs. user messages |
| ๐Ÿ“ฆ Smart Delivery | Sequential message handling to avoid overload |
| ๐Ÿงน Automatic Cleanup | Removes outdated records to keep storage efficient |
| ๐Ÿ“Š Better Context | Clear separation of past vs. current sessions |
| ๐Ÿ”„ Ordered Updates | Ensures actions run in the right sequence |
| ๐Ÿ“ Simplified Naming | Clearer labels for easier understanding |

Architecture Comparison:
Previous version had fixed timing, parallel updates, no multi-page handling, and no cleanup.
New version introduces flexibility, sequential processing, and scalability for real-world use.

๐ŸŽฏ Key Features

๐Ÿ”„ Smart Batching**: Groups consecutive messages within configurable window (default 7s)
๐Ÿง  Session-Aware Context**: Distinguishes old vs. current sessions for temporal awareness
๐Ÿ“‹ Full History**: Stores complete chat logs with both user and page responses
๐Ÿ‘€ Natural UX**: "Seen" marker and "Typing..." indicator for human-like feel
๐ŸŽฏ AI Integration**: Extensible prompts for domain-specific consulting (Gemini, Groq, or any LLM)
๐ŸŒ Multi-Language**: Handles Vietnamese (anh/chแป‹/em) with customizable settings
๐Ÿข Multi-Page Ready**: Single workflow serves multiple Facebook Pages simultaneously

Technical Highlights: Idempotent processing, timezone-aware timestamps (Asia/Ho_Chi_Minh), Facebook API v24.0 compatible, sequential delivery with rate limiting protection, auto cleanup (keeps last 15 rows)

๐Ÿ—๏ธ How It Works

๐Ÿ”„ General Flow

Reception & Validation โ†’ Batching & Storage โ†’ Context Aggregation
โ†“ โ†“ โ†“
Identify input Store for later use Combine with history
Filter duplicates Apply short delay Build conversation context

โ†“

AI Processing โ†’ Delivery & Cleanup
โ†“ โ†“
Generate response Format & send
Add signals Maintain records
Ensure continuity Clean old data

๐Ÿ› ๏ธ Setup Guide

Step 1: Facebook App
Create app, add Messenger, set webhook, get token, subscribe page

Step 2: Data Table
Prepare tables for messages batching

Step 3: Workflow
Import template, set context, link tables, connect AI

Step 4: Test
Activate workflow, send test messages, verify pause/resume

๐Ÿ‘ค 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, Training Programs

Contact:
๐ŸŒ nguyenthieutoan.com
๐Ÿ“˜ Facebook
๐Ÿ’ผ LinkedIn
๐Ÿฆ X (Twitter)
๐Ÿ“บ YouTube
๐Ÿ“ง [email protected]

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: 3.0 | n8n Compatibility: v1.123.0+ and v2.0.0+ | Facebook API: v24.0

Ready to transform your Facebook Messenger into an intelligent AI assistant? Import this workflow and start automating today! ๐Ÿš€

Nodes Used (4)

AI Agent
@n8n/n8n-nodes-langchain.agent
Code
n8n-nodes-base.code
Google Gemini Chat Model
@n8n/n8n-nodes-langchain.lmChatGoogleGemini
HTTP Request
n8n-nodes-base.httpRequest