Skip to main content

Classify and respond to Facebook Messenger inquiries with GPT-4, Slack and Sheets

Workflow preview

Workflow preview
100%
Classify and respond to Facebook Messenger inquiries with GPT-4, Slack and Sheets preview
Open on n8n.io

Important notice

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

1. Workflow Overview

Description Streamline Facebook Messenger inbox management with an AI powered categorization and response system. ️ This workflow automatically classifies new messages as Lead, Query, or Spam...

Best for

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

Tools used

n8n-nodes-base.errortrigger, n8n-nodes-base.slack, n8n-nodes-base.stickynote, n8n-nodes-base.scheduletrigger, n8n-nodes-base.set, n8n-nodes-base.facebookgraphapi, @n8n/n8n-nodes-langchain.lmchatopenai, @n8n/n8n-nodes-langchain.agent

Source and attribution

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

Original n8n.io source

1.1 Workflow description

Title
Classify and respond to Facebook Messenger inquiries with GPT-4, Slack and Sheets
Workflow name
Classify and respond to Facebook Messenger inquiries with GPT-4, Slack and Sheets

📊 Description

Streamline Facebook Messenger inbox management with an AI-powered categorization and response system. 💬⚙️ This workflow automatically classifies new messages as Lead, Query, or Spam using GPT-4, routes them for approval via Slack, responds on Facebook once approved, and logs all interactions into Google Sheets for tracking. Perfect for support and marketing teams managing high volumes of inbound DMs. 🚀📈

What This Template Does

1️⃣ Trigger – Runs hourly to fetch new Facebook Page messages. ⏰ 2️⃣ Extract & Format – Collects sender info, timestamps, and message content for analysis. 📋 3️⃣ AI Categorization – Uses GPT-4 to identify message type (Lead, Query, Spam) and suggest replies. 🧠 4️⃣ Slack Approval Flow – Sends categorized leads and queries to Slack for quick team approval. 💬 5️⃣ Facebook Response – Posts AI-suggested replies back to the original sender once approved. 💌 6️⃣ Data Logging – Records every message, reply, and approval status into Google Sheets for analytics. 📊 7️⃣ Error Handling – Automatically alerts via Slack if the workflow encounters an error. 🚨

Key Benefits

✅ Reduces manual message triage on Facebook Messenger ✅ Ensures consistent and professional customer replies ✅ Provides full visibility via Google Sheets logs ✅ Centralizes team approvals in Slack for faster response times ✅ Leverages GPT-4 for accurate categorization and natural replies

Features

  • Hourly Facebook message fetch with Graph API
  • GPT-4 powered text classification and reply suggestion
  • Slack-based dual approval flow
  • Automated Facebook replies post-approval
  • Google Sheets logging for all categorized messages
  • Built-in error detection and Slack alerting

Requirements

Facebook Graph API credentials with page message permissions OpenAI API key for GPT-4 processing Slack API credentials with chat:write permission Google Sheets OAuth2 credentials

Environment Variables:

FACEBOOK_PAGE_ID GOOGLE_SHEET_ID GOOGLE_SHEET_NAME SLACK_CHANNEL_ID

Target Audience

  • Marketing and lead-generation teams using Facebook Pages 📣
  • Customer support teams managing Messenger queries 💬
  • Businesses seeking automated lead routing and CRM sync 🧾
  • Teams leveraging AI for customer engagement optimization 🤖

Step-by-Step Setup Instructions

1️⃣ Connect Facebook Graph API credentials and set your page ID. 2️⃣ Add OpenAI API credentials for GPT-4. 3️⃣ Configure Slack channel ID and credentials. 4️⃣ Link your Google Sheet for message logging. 5️⃣ Replace environment variable placeholders with your actual IDs. 6️⃣ Test the workflow manually before enabling automation. 7️⃣ Activate the schedule trigger for ongoing hourly execution. ✅

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 - Error Handler Trigger

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

Block 2 - Slack: Send Error Alert

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

Block 3 - Workflow Description

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

Block 4 - Data Input Note

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

Block 5 - AI Processing Note

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

Block 6 - Routing & Approval Note

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

Block 7 - Response & Logging Note

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

Block 8 - Sticky Note

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

Block 9 - Trigger – Fetch New Facebook Messages (Every Hour)

Type / Role
n8n-nodes-base.scheduleTrigger - scheduleTrigger
Config choices
Version 1.2

Block 10 - Format Incoming Message Data

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

Block 11 - Fetch Facebook Conversations (Graph API)

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

Block 12 - Model – GPT-4 Language Model

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

Block 13 - AI – Classify Message (Lead / Query / Spam)

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

Block 14 - Parse AI Output (JSON Parser)

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

Block 15 - Memory – Conversation Context Buffer

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

Block 16 - Route Messages by Category

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

Block 17 - Slack Approval – Lead Message

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

Block 18 - Check Lead Approval Status

Type / Role
n8n-nodes-base.switch - switch
Config choices
Version 3.3

Block 19 - Send AI Reply – Lead Approved

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

Block 20 - Send Fallback Reply – Lead Rejected

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

Block 21 - Log to Google Sheets – Lead Approved

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.7

Block 22 - Log to Google Sheets – Lead Rejected

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.7

Block 23 - Slack Approval – Query Message

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

Block 24 - Check Query Approval Status

Type / Role
n8n-nodes-base.switch - switch
Config choices
Version 3.3

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

3. Summary Table

Workflow Classify and respond to Facebook Messenger inquiries with GPT-4, Slack and Sheets
Complexity advanced
Nodes 29
Categories Support Chatbot, AI Summarization
Author Rahul Joshi
Published 06 Nov 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/10557/10557.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 Classify and respond to Facebook Messenger inquiries with GPT-4, Slack and Sheets do?

Description Streamline Facebook Messenger inbox management with an AI powered categorization and response system. ️ This workflow automatically classifies new messages as Lead, Query, or Spam...

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 Summarization use case.