Skip to main content

Meta Business Integration (Instagram, Facebook, Messenger)

Reward your community for engaging with your brand on Instagram, Facebook, and Messenger. Track mentions, comments, likes, shares, and messages, and reward users with LTZ tokens automatically.

Overview

The Meta Loyalty Integration uses Meta's Business API and webhooks to monitor engagement across Instagram, Facebook Pages, and Messenger. Events are processed in real-time and trigger rewards through the Loyalteez platform.

FeatureDescription
Real-timeWebhook-based event processing (no polling needed)
Multi-platformSupports Instagram, Facebook Pages, and Messenger
AutomaticEvents processed automatically via webhooks
Partner Portal IntegrationCredentials configured in Partner Portal (BYOK)
ConfigurableSet reward amounts and limits in Partner Portal

Supported Event Types

Instagram Events

Event TypeDescriptionPoints (Default)Detection Method
instagram_mentionUser mentions @YourBrand50Webhook: mentions
instagram_commentUser comments on your post40Webhook: comments
instagram_tagged_postUser tags your brand in a post75Webhook: tagged_media
instagram_story_mentionUser mentions your brand in a story60Webhook: story_mentions

Facebook Events

Event TypeDescriptionPoints (Default)Detection Method
facebook_page_likeUser likes your Facebook page50Webhook: feed
facebook_commentUser comments on your post40Webhook: feed
facebook_shareUser shares your post100Webhook: feed

Messenger Events

Event TypeDescriptionPoints (Default)Detection Method
messenger_messageUser sends a message to your brand25Webhook: messages

Prerequisites

Before setting up the Meta integration, ensure you have:

  1. Meta Business Account - Required for Instagram Business features
  2. Instagram Business or Creator Account - Must be linked to a Facebook Page
  3. Facebook Page - Required for Instagram Business and Messenger
  4. Meta Developer App - Create at developers.facebook.com
  5. Webhooks Product Enabled - Enable in your Meta Developer App
  6. Required Permissions:
    • instagram_basic
    • instagram_manage_comments
    • pages_read_engagement
    • pages_manage_metadata
    • pages_messaging (for Messenger)

Quick Start

1. Create Meta Developer App

  1. Go to Meta for Developers
  2. Click Create App
  3. Select Business as the app type
  4. Fill in app details and create the app

2. Configure App Settings

  1. In your app dashboard, go to Settings → Basic
  2. Note your App ID and App Secret
  3. Add Webhooks product to your app
  4. Configure Valid OAuth Redirect URIs if needed

3. Generate Long-Lived Access Token

  1. Go to Tools → Graph API Explorer
  2. Select your app and Facebook Page
  3. Generate a User Access Token with required permissions
  4. Exchange for a Long-Lived Page Access Token (60+ days)
    • Use: GET /oauth/access_token?grant_type=fb_exchange_token&client_id={app-id}&client_secret={app-secret}&fb_exchange_token={short-lived-token}
caution

Store your App Secret and Access Token securely. Never commit them to git!

4. Configure in Partner Portal

  1. Log in to Partner Portal
  2. Navigate to Settings → Profile
  3. Expand the Meta Business authentication method section
  4. Enter:
    • Instagram Username (without @)
    • Facebook Page ID (numeric, found in Page Settings → About)
    • Meta App ID
    • Meta App Secret
    • Meta Access Token (long-lived Page Access Token)
  5. Click Test Connection to verify credentials
  6. Click Save Profile to auto-deploy the integration
info

The integration is automatically deployed when you save your profile with valid credentials. No manual deployment needed!


Webhook Configuration

After saving your credentials, the deployment service will:

  1. Configure your brand in the Meta loyalty router
  2. Provide a webhook URL: https://meta-deployment-service.taylor-cox1199.workers.dev/api/meta/webhook
  3. You'll need to subscribe to webhooks in Meta Developer Portal

Subscribe to Webhooks

  1. Go to Meta Developer Portal → Your App → Webhooks
  2. Click Add Callback URL
  3. Enter: https://meta-deployment-service.taylor-cox1199.workers.dev/api/meta/webhook
  4. Set Verify Token (contact Loyalteez support for the token)
  5. Subscribe to:
    • Instagram: mentions, comments, story_mentions
    • Page: feed, messages
  6. Click Verify and Save

Event Processing Flow


Configuration Reference

Required Credentials

FieldDescriptionWhere to Find
Instagram UsernameYour Instagram Business/Creator usernameInstagram profile
Facebook Page IDNumeric ID of your Facebook PagePage Settings → About → Page ID
Meta App IDYour Developer App IDApp Settings → Basic
Meta App SecretYour Developer App SecretApp Settings → Basic
Meta Access TokenLong-lived Page Access TokenGraph API Explorer → Exchange Token

Webhook Subscriptions

ObjectFieldsPurpose
instagrammentions, comments, story_mentionsInstagram engagement tracking
pagefeed, messagesFacebook Page and Messenger events

Troubleshooting

Webhook Not Receiving Events

  1. Verify webhook subscription in Meta Developer Portal
  2. Check webhook status in Partner Portal → Settings
  3. Verify access token has required permissions
  4. Check webhook logs in Meta Developer Portal → Webhooks → Recent Requests

Events Not Triggering Rewards

  1. Verify event types are enabled in Automation Settings
  2. Check reward limits and cooldown periods
  3. Review event logs in Partner Portal → Analytics
  4. Ensure user has valid email (if required by event type)

Invalid Credentials Error

  1. Regenerate access token if expired
  2. Verify App ID and Secret are correct
  3. Check token permissions include all required scopes
  4. Ensure Instagram account is linked to Facebook Page

API Reference

Deployment Service Endpoints

EndpointMethodDescription
/api/meta/deployPOSTConfigure brand integration
/api/meta/statusGETCheck deployment status
/api/meta/testPOSTTest credentials
/api/meta/webhookGET/POSTWebhook verification and receiver

Webhook Event Format

{
"object": "instagram",
"entry": [{
"id": "instagram_business_account_id",
"time": 1234567890,
"changes": [{
"field": "mentions",
"value": {
"media_id": "123456789",
"comment_id": "987654321",
"from": {
"id": "user_id",
"username": "username"
}
}
}]
}]
}

Best Practices

  1. Use Long-Lived Tokens - Exchange short-lived tokens for 60+ day tokens
  2. Monitor Rate Limits - Meta API has rate limits; webhooks help avoid polling
  3. Test in Development - Use Meta's Test Users feature for testing
  4. Set Appropriate Rewards - Balance engagement value with token economics
  5. Monitor Webhook Health - Check webhook status regularly in Partner Portal

Support

For issues or questions: