Meta Messaging Overview
The Meta messaging module adds Instagram DM and Facebook Messenger as messaging channels. Both channels share a single OAuth connection, webhook endpoint, and Graph API client through a unified Meta platform foundation.
What’s Included
Section titled “What’s Included”- OAuth connection flow — Connect a Facebook Page (and linked Instagram Business account) via Settings → Integrations
- Unified webhook — Single endpoint handles events from both Messenger and Instagram DM
- Inbound messages — Automatic contact resolution, profile enrichment, and attachment processing
- Outbound messages — Send text and attachments through the compose bar
- Delivery/read receipts — Watermark-based status tracking from Meta
Module Structure
Section titled “Module Structure”src/mods/meta/├── api/│ ├── meta_connection_api.rs # OAuth URL, status, disconnect│ ├── meta_oauth_callback_api.rs # OAuth callback handler│ └── meta_webhook_api.rs # Webhook verify + event dispatch├── conf/│ └── meta_messaging_core_conf.rs # App credentials from core_conf├── services/│ ├── meta_graph_service.rs # Graph API HTTP client│ ├── meta_send_service.rs # Send messages via Graph API│ └── meta_token_service.rs # Token exchange + pending cache└── types/ ├── meta_connection_types.rs # Connection status, OAuth state └── meta_webhook_types.rs # Webhook payload typesDatabase Tables
Section titled “Database Tables”Four migrations create the Meta schema:
| Table | Purpose |
|---|---|
organization_meta_settings | Stores page access token, Page ID, IG account ID per org |
contact_facebook | Maps contacts to Facebook PSIDs |
contact_instagram | Maps contacts to Instagram IGSIDs |
core_conf (extended) | Adds meta_messaging_app_id, meta_messaging_app_secret, meta_messaging_verify_token |
Channel Types
Section titled “Channel Types”Two new variants added to MessageChannel in message_channel_type.rs:
pub enum MessageChannel { // ... existing variants FacebookMessenger, InstagramDm,}Both channels appear in the compose bar, conversation feed filters, and dashboard charts.
System Configuration
Section titled “System Configuration”Set these values in Admin → System Config before connecting:
| Field | Description |
|---|---|
meta_messaging_app_id | Facebook App ID from Meta Developer Portal |
meta_messaging_app_secret | Facebook App Secret — used for token exchange and webhook signature verification |
meta_messaging_verify_token | Custom string for webhook hub verification |
No environment variables are required — all configuration is database-backed.