AI-Driven Facebook DM Response System with Inventory Lookup - n8n Workflow

Automate Facebook Messenger replies using this powerful n8n workflow. Integrates GPT-4o for intent extraction, matches requests against Airtable inventory, and sends instant, accurate responses.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

E-commerce businesses managing inventory and customer inquiries on Facebook.
Support teams looking to automate initial product availability checks.
Users seeking advanced AI integrations within a powerful n8n workflow.
Developers needing robust n8n templates for social media and database integration.

Overview

This sophisticated automation solves the problem of delayed customer response times on social media, especially concerning product availability. By leveraging GPT-4o's natural language processing capabilities, this n8n workflow instantly interprets customer intent from a Facebook message. It then cross-references the request against a live Airtable inventory database. The primary value lies in its ability to provide real-time, accurate product information, drastically improving customer experience and reducing the manual load on support staff. This specific n8n workflow utilizes multiple AI steps to ensure high accuracy in both intent classification and final inventory matching, making it one of the most powerful n8n templates for customer support automation.

How it Works

The process starts with the n8n trigger, which runs hourly.


  1. Fetch & Validate: The Schedule Trigger acts as the primary n8n trigger, initiating the n8n workflow hourly. It fetches the latest Facebook conversations and messages. A validation step ensures the record structure is clean; if invalid, it is logged in Google Sheets for manual review.

  2. Latest Message Extraction: A custom Code n8n node extracts the single, most recent customer message from the conversation thread.

  3. AI Intent Classification: The message is sent to a GPT-4o Langchain n8n node, which uses prompt engineering to interpret the customer's raw message, extracting the requested product name and explicit customer intent (e.g., price inquiry, availability).

  4. Data Retrieval: Simultaneously, the full product catalog is efficiently fetched from the Airtable inventory records.

  5. Data Fusion: The AI interpretation and the full inventory list are combined using the Merge and subsequent Code n8n nodes, creating a single, comprehensive data payload.

  6. AI Inventory Match: A second GPT-4o Langchain n8n node analyzes the combined payload, performing a lookup against the inventory list. It determines if a match exists and formulates a detailed, human-friendly reply text.

  7. Auto-Reply: The final decision is processed by an If n8n node. If the product is found (found: true), the Product Found reply is sent via the Facebook Graph API. If not found, the Product Not Found reply is delivered, completing the automated n8n workflow execution. This seamless connection of services demonstrates the power of this n8n workflow.

Installation Guide


  1. Import the n8n workflow: Copy the provided JSON code and import it into your n8n instance via the Workflows section.

  2. Facebook Setup: Configure the two required Facebook Graph API credentials. You will need a Page Access Token and the associated Page ID for reading conversations and posting replies. Ensure the account has necessary pagesmessaging and pagesread_engagement permissions.

  3. Airtable Setup: Provide credentials for the Airtable Personal Access Token. Specify the correct Base ID and the Inventory Table ID in the Fetch Inventory Records from Airtable n8n node.

  4. AI Setup: Configure the Azure Open AI credentials used by the GPT-4o n8n node (specifically C3WzT18XqF8OdVM6). The workflow relies on the gpt-4o model for advanced analysis.

  5. Google Sheets (Optional): Set up the Google Sheets OAuth2 credential if you wish to utilize the logging feature for invalid messages. Update the Document ID and Sheet Name in the corresponding n8n node.

  6. Activate: Save the n8n workflow and set it to active. The n8n trigger will begin running hourly.

Node Details

Trigger – Fetch New Facebook Messages (Schedule Trigger n8n node): Function: Starts the n8n workflow execution every hour. Key Configuration: Set to run once per hour. This node acts as the essential starting n8n trigger.
Fetch Facebook Conversation List (Facebook Graph API n8n node): Function: Retrieves recent conversation threads from the connected Facebook Page.
AI – Extract Product & Customer Intent (Langchain Agent n8n node): Function: Uses GPT-4o to interpret the customer's raw message and extract structured data (product name, intent). Key Configuration: Defined system message instructs the AI to return clean JSON output only, vital for the subsequent steps in the n8n workflow.
Fetch Inventory Records from Airtable (Airtable n8n node): Function: Connects to Airtable to fetch all available records from the specified Inventory table, providing the dataset for lookup.
AI – Match Requested Product in Inventory (Langchain Agent n8n node): Function: Compares the extracted customer query data against the full Airtable inventory dataset to generate a final, structured response object and the specific reply text to be sent. This is a crucial n8n node for decision-making.
Check If Product Exists (If n8n node): Function: Acts as flow control, routing the automation based on the AI's final found status (True or False).


  • Send Facebook Reply (Facebook Graph API n8n node): Function: Sends the automated, AI-generated response message back to the customer on Facebook Messenger. Key Configuration: Uses the messages edge and dynamically targets the recipient ID derived from the initial message extraction, showcasing dynamic configuration within the n8n node.

Related n8n Workflows

Free

Nodes: 10 Nodes
Updated: December 26 2025
View all
Created by

Rahul Joshi is a seasoned technology leader specializing in the n8n automation tool and AI-driven workflow automation. With deep expertise in building open-source workflow automation and self-hosted automation platforms, he helps organizations eliminate manual processes through intelligent n8n ai agent automation solutions.

Featured*