Skip to main content

Automated Facebook message response with GPT-4o and Airtable inventory matching

Workflow preview

Automated Facebook message response with GPT-4o and Airtable inventory matching preview
Open on n8n.io

Important notice

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

Overview

๐Ÿ“˜ Description

This workflow automates AI-driven Facebook Messenger product inquiry handling, connecting Facebook DMs with Airtable inventory and returning instant automated replies based on product availability. It runs hourly, fetches new messages, extracts the latest customer query, uses GPT-4o to identify the product and intent, merges this with the Airtable inventory dataset, performs an AI-assisted product match, and replies automatically inside the same Facebook conversation. Invalid or malformed messages are logged to Google Sheets for review.

โš™๏ธ What This Workflow Does (Step-by-Step)

โ–ถ๏ธ Trigger โ€“ Fetch New Facebook Messages (Every Hour) Schedules hourly polling of new conversations from Facebook Messenger.

๐ŸŸฆ Fetch Facebook Conversation List (Graph API) Retrieves conversation threads from the connected Facebook Page.

๐Ÿ’ฌ Fetch Facebook Conversation Messages (Graph API) Loads message details (content, sender, timestamp) for the selected conversation.

๐Ÿ“ฉ Extract Latest Facebook Message (Code) Sorts all messages and picks the latest one โ†’ this is the message analyzed by AI.

๐Ÿ” Validate Record Structure (IF) Ensures the incoming message has required fields. Valid โ†’ AI analysis Invalid โ†’ logged to Google Sheets.

๐Ÿ“„ Log Invalid Records to Google Sheet Stores malformed or unprocessable messages for audit and correction.

๐Ÿง  Configure GPT-4o โ€” Message Classification Model Defines AI model used to extract product details and intent from the customerโ€™s message.

๐Ÿค– AI โ€“ Extract Product & Customer Intent AI identifies: product name (standardized) customer intent (availability, pricing, inquiry) cleaned query always returns structured JSON No inventory lookup happens here.

๐Ÿ“ฆ Fetch Inventory Records from Airtable Pulls complete product inventory list to cross-match with customer request.

๐Ÿ” Merge AI Output With Inventory Dataset Combines: AI-interpreted message data Airtable inventory records This prepares a unified object for product lookup.

๐Ÿ“ Build Combined AI + Inventory Payload (Code) Constructs { ai: {...}, inventory: [...] } for the product-matching AI agent.

๐Ÿง  Configure GPT-4o โ€” Product Matching Model Sets strict rules for identifying whether the requested product exists in inventory.

๐Ÿค– AI โ€“ Match Requested Product in Inventory AI checks: exact / close match to product name whether item exists generates structured JSON reply text + confidence score.

๐Ÿงน Parse AI Product Match JSON (Code) Ensures the AI output is valid JSON before making decisions.

๐Ÿ” Check If Product Exists (IF) If found โ†’ sends โ€œproduct availableโ€ reply If not โ†’ sends โ€œproduct not foundโ€ reply.

๐Ÿ“จ Send Facebook Reply โ€” Product Found (Graph API) Sends a personalized Messenger reply including matched product details.

๐Ÿ“จ Send Facebook Reply โ€” Product Not Found (Graph API) Replies politely informing customer that the product is not available.

๐Ÿงฉ Prerequisites

  • Facebook Graph API access token
  • Airtable API token
  • Azure OpenAI GPT-4o credentials
  • Google Sheets OAuth

๐Ÿ’ก Key Benefits

โœ” Fully automated Facebook DM handling โœ” AI-powered product identification even with typos or unclear wording โœ” Real-time product availability responses โœ” Unified Airtable-driven catalog lookup โœ” Automatic fallback for invalid messages โœ” Zero manual intervention for customer support

๐Ÿ‘ฅ Perfect For

  • Ecommerce stores
  • Catalog-based product businesses
  • Teams handling large volumes of Facebook DM inquiries
  • Businesses wanting instant customer replies without agents