Skip to main content

Create an intelligent Facebook Messenger chatbot with GPT-4o-mini & message memory

Workflow preview

Workflow preview
100%
Create an intelligent Facebook Messenger chatbot with GPT-4o-mini & message memory preview
Open on n8n.io

Important notice

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

1. Workflow Overview

Who is this for? Businesses and developers who want to automate customer support or engagement on Facebook Messenger using AI powered responses. What does it do? Creates an intelligent Facebook Mes...

Best for

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

Tools used

n8n-nodes-base.stickynote, n8n-nodes-base.webhook, n8n-nodes-base.if, n8n-nodes-base.respondtowebhook, n8n-nodes-base.code, n8n-nodes-base.httprequest, n8n-nodes-base.wait, @n8n/n8n-nodes-langchain.memorybufferwindow

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Tristan V.

Original n8n.io source

1.1 Workflow description

Title
Create an intelligent Facebook Messenger chatbot with GPT-4o-mini & message memory
Workflow name
Create an intelligent Facebook Messenger chatbot with GPT-4o-mini & message memory

Who is this for?

Businesses and developers who want to automate customer support or engagement on Facebook Messenger using AI-powered responses.

What does it do?

Creates an intelligent Facebook Messenger chatbot that:

  • Responds to messages using OpenAI (gpt-4o-mini)
  • Batches rapid-fire messages into a single AI request
  • Maintains conversation history (50 messages per user)
  • Shows professional UX feedback (seen indicators, typing bubbles)

How it works

  1. Webhook Verification - Handles Facebook's GET verification request
  2. Message Reception - Receives incoming messages via POST webhook
  3. Message Batching - Waits 3 seconds to collect multiple quick messages
  4. AI Processing - Sends combined message to OpenAI with conversation context
  5. Response Delivery - Formats and sends the AI response back to Messenger

Setup

  1. Configure Facebook Graph API credential with your Page Access Token
  2. Configure OpenAI API credential with your API key
  3. Set your verify token in the "Is Token Valid?" node
  4. Register the webhook URL in Facebook Developer Console

Key Features

  • Message Batching: Combines "Hey" + "Can you help" + "with my order?" into one request
  • Conversation Memory: Remembers context from previous messages
  • Echo Filtering: Prevents responding to your own messages
  • Response Formatting: Cleans markdown for Messenger's 2000-char limit

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 - Sticky Note - Overview

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 2 - Sticky Note - Webhook Verification

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 3 - Sticky Note - Message Receipt

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 4 - Sticky Note - Message Batching

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 5 - Sticky Note - AI Processing

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 6 - Sticky Note - OpenAI Setup

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 7 - Sticky Note - Response

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 8 - Sticky Note - Facebook Setup

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 9 - Facebook Verification Webhook

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

Block 10 - Facebook Message Webhook

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

Block 11 - Is Token Valid?

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

Block 12 - Respond with Challenge

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

Block 13 - Respond Forbidden

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

Block 14 - Acknowledge Event

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

Block 15 - Filter Valid Messages

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

Block 16 - Store Message for Batching

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

Block 17 - Send Seen Indicator

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

Block 18 - Wait 3 Seconds

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

Block 19 - Retrieve Batched Messages

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

Block 20 - Has Messages to Process?

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

Block 21 - Send Typing Indicator

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

Block 22 - Conversation Memory

Type / Role
@n8n/n8n-nodes-langchain.memoryBufferWindow - memoryBufferWindow
Config choices
Version 1.3

Block 23 - OpenAI Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.2

Block 24 - AI Agent

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

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

3. Summary Table

Workflow Create an intelligent Facebook Messenger chatbot with GPT-4o-mini & message memory
Complexity advanced
Nodes 27
Categories Support Chatbot, AI Chatbot
Author Tristan V
Published 21 Dec 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/11993/11993.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 Create an intelligent Facebook Messenger chatbot with GPT-4o-mini & message memory do?

Who is this for? Businesses and developers who want to automate customer support or engagement on Facebook Messenger using AI powered responses. What does it do? Creates an intelligent Facebook Mes...

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.