Facebook Messenger & Comments
Official Meta Graph API v21.0Complete A-to-Z Setup (Basic to Advanced): Meta App, Use Cases, Legal URLs, Webhooks, Page Token, Comment Auto-Reply, Private DM & App Review
How to Connect Facebook Page & Comments to Taqfu AI (Video Tutorial)
Watch the step-by-step walkthrough on YouTube or follow the written steps below.
Copy and paste these required legal URLs into Meta App > App settings → Basic:
Prerequisites: Facebook Page, Admin Access & Page ID
Before starting in Meta for Developers, make sure you have Full Control (Admin) access to the Facebook Business Page you want to connect:
- Log in with a Facebook personal profile that has Full Control (Admin) on your Facebook Page.
- Open your Facebook Page → About → Page Transparency (or Page Settings → Page setup) and copy your numeric Facebook Page ID (e.g. 1434324209757019).
- Open your Meta Business Portfolio (business.facebook.com) and confirm you have Admin access if you plan to verify your business for public App Review later.
Create Meta App & Add BOTH Required Use Cases
Open developers.facebook.com/apps to create your custom Meta App and enable BOTH Messenger and Page Comment capabilities:
- Click "My Apps" > "Create App" in the top-right corner.
- Enter your App Name (e.g. your Business or Brand AI Agent) and Contact Email, then click "Next".
- Under Use cases, select "Engage with customers on Messenger from Meta" and click "Next".
- Select your Meta Business Portfolio (or link later) and complete app creation.
- CRITICAL FOR COMMENTS: Inside your App Dashboard, go to "Use cases" (or click "Add use cases" on Dashboard) and ALSO add "Manage everything on your Page". Without this second use case, pages_manage_engagement will not appear in your app.
Fill App Settings → Basic, Legal URLs & Copy App Secret
In the left sidebar, go to App settings → Basic. Fill out every required legal & domain field using the 1-Click Copy URLs at the top of this guide:
- App domains: Paste the bare domain without https:// or trailing slash (e.g. taqfu.com).
- Privacy policy URL: Copy and paste the Privacy Policy URL from the top section above.
- Terms of Service URL: Copy and paste the Terms of Service URL from the top section above.
- User data deletion: Select "Data deletion instructions URL" and paste the Data Deletion URL from above.
- App icon & Category: Upload a 1024 x 1024 px PNG/JPG icon, select Category "Business and pages", and click "Save changes".
- Copy App Secret (Mandatory for Security): At the top of App settings → Basic, click "Show" next to "App secret", enter your password if prompted, and copy the 32-character secret. Pasting this into Taqfu prevents incoming Meta webhooks from failing X-Hub-Signature-256 HMAC verification (HTTP 401).
Enable All Required Permissions (Ready for Testing)
Open "Use cases" → "Engage with customers on Messenger from Meta" → "Permissions and features", AND "Manage everything on your Page" → "Permissions and features". Click "+ Add to App Review" on each permission below until its Status reads "Ready for testing":
- pages_messaging — Read and send Messenger replies + send 1-time Private Reply DM directly from a Facebook post comment.
- pages_read_engagement — Read Page posts, Reels/video captions, and incoming comment threads.
- pages_manage_engagement — Post automatic public AI replies back onto customer comments.
- pages_manage_metadata — Subscribe your Page programmatically to feed and messaging webhooks.
- pages_read_user_content — Read customer-generated comments and content posted on your Page.
- pages_show_list & business_management & public_profile — List your managed Pages and read basic profile info cleanly.
pages_messaging, pages_read_engagement, pages_manage_engagement, pages_manage_metadata, pages_read_user_content, pages_show_list, business_management, public_profileConfigure Messenger Webhook Callback & Page Event Subscriptions
Open Use cases → "Engage with customers on Messenger from Meta" → "Messenger API Settings":
- Under "1. Configure webhooks", click "Edit" / "Configure Webhooks".
- Callback URL: Paste your Taqfu Webhook Callback URL shown at the bottom of this guide (/api/webhook/facebook).
- Verify Token: Click "Copy" next to the unmasked Verify Token below (never copy masked dots) and paste it into Meta, then click "Verify and Save".
- Under "2. Generate access tokens", click "Add Page" (or "Add or remove Pages"), choose your Facebook Page, and complete Next → Done.
- Subscribe to Webhook Events (App Webhooks & Page Subscriptions): Make sure ALL required fields are Subscribed — especially "messages", "messaging_postbacks", "message_echoes" (auto-pauses AI for 30 mins when you reply manually!), "messaging_referrals" (ad attribution), "message_deliveries", "message_reads", "message_edits", AND "feed" (mandatory for instant Post/Reel Comment Auto-Reply!).
feed, messages, messaging_postbacks, message_echoes, messaging_referrals, message_deliveries, message_reads, message_editsGenerate Full-Permission Never-Expiring Token (Graph API Explorer)
IMPORTANT: The "Generate" button inside Messenger API Settings usually generates a token with ONLY pages_messaging (Comments Auto-Reply will stay disabled!). Follow this exact method via Graph API Explorer so both Messenger + Comments work together:
- Open Graph API Explorer (https://developers.facebook.com/tools/explorer/).
- Top-right "Meta App" dropdown: Select your Meta App (e.g. Taqfu AI Agent).
- Under "Permissions", add ALL 7 permissions: pages_messaging, pages_manage_metadata, pages_read_engagement, pages_manage_engagement, pages_read_user_content, pages_show_list, business_management.
- Click "Generate Access Token" → in the Facebook popup, select your Facebook Page and allow every permission.
- Pro Shortcut (Auto Long-Lived Page Token): Once you have the User Token (or select your Page under "User or Page" dropdown and extend it via Access Token Tool until Expires: Never), copy it — Taqfu automatically exchanges User Tokens with your App Secret via fb_exchange_token + /me/accounts to store a Never-Expiring Page Access Token!
Connect & Verify inside Taqfu Dashboard + Configure AI Catalog
Return to Taqfu Dashboard → Channels & AI → Facebook Messenger & Comments → Manage / Edit and enter all 3 credentials:
- Facebook Page ID *: Paste your numeric Page ID (from Step 1).
- Page Access Token (Long-lived) *: Paste the full-permission token from Step 6 (leaving it blank later preserves your saved token).
- Meta App Secret: Paste your App Secret from Step 3 (mandatory for custom Meta Apps so webhook HMAC signatures pass verification).
- Click "Verify & Connect" ("যাচাই ও কানেক্ট করুন"). Confirm the green status changes to "💬 Comment Auto-Reply + Inbox DM Active ✅" (no yellow permission warning).
- Catalog Sync Tip: Ensure your Products catalog and Business Settings are updated in Taqfu — when someone comments on a post/Reel, Taqfu reads the post caption, matches the exact product from your catalog, replies publicly in Bengali/English, and sends a 1-time Messenger Private Reply DM automatically.
Test Live Comment Auto-Reply, Private DM, Comments Hub & Handover
Verify every automation end-to-end using a personal profile listed in App roles → Roles (Admin / Developer / Tester):
- Comment Test (Do NOT comment "as the Page"): Switch to your personal Admin/Tester Facebook profile and write a question on any post or Reel on your Page.
- Public AI Reply + Messenger DM: Within seconds (or via Taqfu's 5-minute backup poller), Taqfu replies publicly to the comment (using respectful Muslim/non-Muslim greeting rules and polite de-escalation ending with "— তাকফু এআই" on negative feedback) AND sends a 1-time Private Reply DM into Messenger.
- Manage in Comments Hub: Open Taqfu Dashboard → Comments (?tab=comments) in the sidebar below Inbox to filter by Facebook / TikTok / Instagram and manually reply or take over any thread.
- Messenger & Human Takeover Test: Message your Page "Hi" in Messenger to test AI replies, then reply manually from Meta Business Suite to confirm message_echoes pauses AI for 30 minutes.
Advanced: App Review, Live Mode (Publish Warning) & Troubleshooting
When you are ready to roll out beyond your Admin/Tester accounts so every public user comment and external merchant works:
- CRITICAL — Do NOT click "Unpublish": On Meta's "Publish" tab, if the bottom-right button says "Unpublish", your app is ALREADY Published (Live). Never click "Unpublish" or all live Messenger/WhatsApp traffic will stop.
- Submitting App Review for All Public Customers: Before non-tester public users trigger comment webhooks, ensure each permission has API Calls > 0 (from your Step 8 tests), complete Business Verification, and submit pages_messaging, pages_read_engagement, pages_manage_engagement, pages_manage_metadata, pages_read_user_content, and pages_show_list under Review → App Review with a clear screen recording of Taqfu replying.
- Troubleshooting Quick Fixes: (1) HTTP 401 webhook errors → App Secret in Taqfu does not match App settings → Basic. (2) Yellow warning "pages_read_engagement required" → Token was generated from Messenger "Generate" button instead of Graph API Explorer (regenerate with all 7 scopes). (3) Public user comment ignored → App permissions are still at Standard Access (submit App Review) or commenter acted as the Page itself.
Checklist Before Support: App Secret matches? | Subscribed to feed + messages + message_echoes? | Token scopes include pages_read_engagement & pages_manage_engagement? | Tester account in App roles?⚡ Webhook Callback & Verify Token Info
https://taqfu.com/api/webhook/facebook🔒 For security, your unique store Verify Token is stored privately inside your account. Open Dashboard > Channels & AI > Manage to copy your store Verify Token.
• Two Use Cases Needed for Full Automation: "Engage with customers on Messenger from Meta" handles Messenger DMs & Private Replies, while "Manage everything on your Page" unlocks pages_read_engagement and pages_manage_engagement for post/Reel comment replies.
• Graph API Explorer vs Messenger Generate Button: Always generate tokens in Graph API Explorer (selecting all 7 scopes); Taqfu automatically exchanges short-lived User Tokens into a Never-Expiring Page Access Token when your App Secret is saved.
• Standard Access vs Advanced Access: While permissions are only "Ready for testing" (Standard Access), Meta fires live comment webhooks only for accounts listed under App roles (Admins / Developers / Testers). Pass App Review to unlock all public users.
• Comment as Personal Profile: Meta filters out comments posted while acting as the Page itself — always test using your personal Admin/Tester profile.
• Human Takeover (message_echoes): Subscribing to message_echoes automatically detects replies sent from Meta Business Suite or Messenger mobile app and pauses AI for 30 minutes.