UniSearch
META GRAPH API v20.0 & REAL-TIME WEBHOOKS

Facebook Messenger Connector Guide

Connect your Facebook Business Pages to UniSearch for sub-second Tantivy full-text search across customer inquiries, page messages, voice notes, and media attachments.

Integration Architecture Overview

Enterprise ingestion pipeline with bidirectional webhooks and delta syncing

UniSearch integrates with the official Meta Graph API to index customer messaging history, Marketplace inquiries, and leads. Incoming customer messages are delivered instantly via HTTPS Webhooks verified with SHA-256 HMAC signatures, while historical conversations and attachments are backfilled via background workers.

Protocol & API Version Meta Graph API v20.0
Sync Mechanism Real-Time Webhooks + Delta Polling
Required Permissions pages_messaging, pages_read_engagement
Direct Link Protocol https://m.me/<page_id>
1

Create a Meta Developer App

Meta requires an application registered in the Meta for Developers console to generate API credentials and subscribe to page webhooks.

  1. Log in to Meta for Developers using your Facebook account.
  2. Click My Apps in the top right, then select Create App.
  3. Select Other as the use case, click Next, then choose Business as the App Type.
  4. Enter an App Display Name (e.g. UniSearch Ingestion Connector) and choose your Meta Business Portfolio.
  5. Click Create App to enter the App Dashboard.
2

Add the Messenger Product

Once your app is created, add the Messenger messaging capability to your App:

  1. In the left sidebar of your App Dashboard, click Add Product (or Use Cases).
  2. Locate Messenger and click Set Up.
  3. The Messenger settings panel will now appear in your left navigation menu under Messenger → Settings (or Messenger API Settings).
App Development Mode: While testing, you can use your app in Development Mode without completing Meta App Review. Messages sent to and from your Page by App Admins, Developers, or Testers will index immediately!
3

Generate a Long-Lived / Permanent Page Access Token

To retrieve messages and conversations, UniSearch requires a Page Access Token for your business page:

  1. Go to Messenger → Settings → Access Tokens.
  2. Click Add or Remove Pages to select the Facebook Pages you manage.
  3. Click Generate Token next to your Page. Check "I understand" and copy the generated token.
  4. Take note of your numerical Page ID (visible next to the Page name).
Permanent System User Token (Recommended for Enterprise):
Standard Page Tokens expire after 60 days. To obtain a token that never expires:
  • Go to business.facebook.com → Settings → Users → System Users.
  • Create a System User with the Admin role.
  • Click Generate New Token, select your App, and choose 60 days or Never as token expiration.
  • Check permissions: pages_messaging, pages_read_engagement, and pages_show_list.
4

Configure Real-Time Webhooks

Meta Webhooks notify UniSearch the instant a customer sends a message or submits a postback, eliminating polling delays:

  1. In your Meta App Dashboard, navigate to Messenger → Settings → Webhooks (or Webhooks in the left sidebar).
  2. Click Add Callback URL (or Edit Callback URL).
  3. Paste the UniSearch Callback URL:
HTTPS WEBHOOK CALLBACK URL
https://unisearch.cloud/api/cloud/messenger/webhook
  1. Enter a Verify Token of your choice (e.g. unisearch_messenger_token). Make sure to remember this token.
  2. Click Verify and Save. Meta will immediately send a challenge to UniSearch. You will see a green checkmark upon success!
  3. Under Subscription Fields, click Manage and check:
    • messages (Customer messages, attachments, audio memos)
    • messaging_postbacks (Button clicks and lead form submissions)
    • message_deliveries and message_reads (Status watermarks)
  4. Under Webhooks for Page, click Subscribe next to your Facebook Page!
5

Save & Connect in UniSearch Settings

Now connect your Facebook Page in the UniSearch Settings Hub:

  1. Log into your UniSearch account and go to Settings → Storage & Messaging.
  2. Click Add Storage Provider and select Facebook Messenger Business from the dropdown.
  3. Enter your Page ID and paste the Page Access Token.
  4. (Optional) Enter your App Secret (found in Meta App Dashboard under App settings → Basic) for cryptographically verified SHA-256 HMAC webhook payloads.
  5. Enter the Webhook Verify Token you configured in Step 4.
  6. Click Test Graph API Token to verify permissions and connection.
  7. Click Save Messenger Account.
Connection Active! UniSearch will automatically schedule an initial historical sync and begin indexing real-time incoming messages immediately.

Frequently Asked Questions & Troubleshooting

Can UniSearch transcribe voice notes sent over Facebook Messenger?
Yes! UniSearch automatically detects audio memo attachments (AAC/M4A/MP3), passes them through the automated Whisper speech-to-text pipeline, and indexes the resulting transcripts for full-text search.
Why did the Webhook Verification challenge fail?
Ensure that the Verify Token in Meta matches the Verify Token in UniSearch Settings, or use the default token unisearch_messenger_token. Also confirm your UniSearch host is reachable via HTTPS.
How do I preview attachments from Messenger search results?
Search results for Messenger display an on-demand "Preview Attachment" button for supported images, PDFs, videos, and documents, fetching media securely via Graph API signed CDN URLs.
Can I connect multiple Facebook Pages?
Yes. You can add each Facebook Page as a separate repository in UniSearch Settings under Storage & Messaging. Each Page has its own watermark and search facet filter.
Go to Settings & Connect Messenger