Skip to main content
Socialift
Documentation sections
Setup

Setting up a Meta app for the Facebook and Instagram APIs

To call Meta APIs you need your own app on developers.facebook.com: create it with the right use cases, copy the App ID and App Secret from App settings → Basic, and for a Business-type app create a Facebook Login for Business configuration to get a config_id. Then add the redirect URI and webhooks, and pass App Review and Business Verification before serving accounts you don't manage.

Updated:

What do you get from a Meta app?

A Meta app gives you three values: the App ID (public identifier sent in the login URL), the App Secret (private: exchanging the login code for a token, signing appsecret_proof and verifying webhook signatures) and an optional Configuration ID (config_id) — a Facebook Login for Business configuration that replaces the permission list (scope) in the login URL.

One Meta app covers Facebook Pages, Instagram accounts linked to a Page, Lead Ads and the Marketing API. Instagram without a Facebook Page uses a different product and different keys — see the Instagram Login guide.

The App Secret must never reach a browser, a mobile app or a public repository. If it leaks, generate a new one in the dashboard and replace it everywhere, including the “Kalitlar” (Keys) page in the Socialift dashboard.

Key terms

Use case
The integration scenario you pick when creating the app (for example “Manage everything on your Page”). Permissions and products come from it. Use cases can't be removed after creation — only compatible ones can be added.
Facebook Login for Business
The login product for Business-type apps. Permissions are chosen in a configuration in the dashboard, and your code passes only its ID (config_id).
Standard vs Advanced Access
With Standard Access only people who have a role on the app can grant permissions. To serve Pages and accounts you don't manage, each permission needs Advanced Access through App Review.
Business Verification
Verifying your company with Meta. An app requesting Advanced Access must be connected to a verified business portfolio.

How to create and configure a Meta app

  1. Create the app

    On developers.facebook.com/apps start creating an app: enter the name and contact email, then choose use cases (for example “Manage everything on your Page”). If you need Facebook Login for Business with config_id and no listed use case fits, choose “Other” and then the Business app type.

  2. Connect a business portfolio

    The wizard offers to connect a verified or unverified business portfolio, or to create one. Connect the company that will own the integration — that's the business you'll verify later for Advanced Access.

  3. Copy the App ID and App Secret

    Both are under App settings → Basic; the App ID is also shown at the top of the dashboard. Keep the secret in environment variables or a secret manager.

  4. Add the redirect URI

    Add the Facebook Login for Business product (your use case may already include it). In its settings, put your callback address into Valid OAuth Redirect URIs. With Strict Mode, Meta requires an exact match: a different path or a query parameter not in the list is rejected.

  5. Create a configuration and copy config_id

    Under Configurations create a configuration (or start from a template): name, access token type, business assets and permissions. Choose User access token: Socialift's login flow exchanges the code for a long-lived user token and then reads Pages. System user tokens require an extra login URL parameter (override_default_response_type) that this flow doesn't send. Copy the Configuration ID.

  6. Add permissions to the use case

    On the use case customization screen, add only the permissions from the table below that your integration actually uses. Per Meta's docs, the most common App Review rejection reason is requesting a permission or feature the app doesn't need.

  7. Configure webhooks

    Your endpoint needs HTTPS with a valid certificate (self-signed isn't supported). Enter the Callback URL and Verify token, confirm, then subscribe to fields: Page object — leadgen (Lead Ads) and feed (posts and comments); Instagram object — comments, mentions and messages for Direct. Each Page must then install the app via subscribed_apps — without it no events arrive.

  8. Add roles and testers

    In the Roles panel invite administrators, developers and testers. Until App Review, permissions can be granted only by people with a role on the app (or on the business that owns it) — that's how you test with your own Pages.

  9. Pass App Review and Business Verification

    To serve Pages and accounts you don't manage, each permission needs Advanced Access. Every permission needs its own description and a screen recording (the user grants it, the app uses it); at least one successful API call with that permission within 30 days before submitting; a privacy policy URL and a 1024×1024 app icon. Advanced Access requires Business Verification.

How to add the Meta app to Socialift

  1. Open “Kalitlar” → “Meta (Facebook) app”

    In the dashboard open “Kalitlar” (Keys) and expand the “Meta (Facebook) app” card. The side block “Konsolga ko'chiring” (Copy to console) shows the Redirect URI even before you save a key — paste it into Valid OAuth Redirect URIs.

  2. Fill in the fields

    App ID and App secret are required. Configuration ID is optional: when set, the login URL carries config_id and the “Scope'lar” (Scopes) field is not used. Leave it empty for a Consumer app — then the scope list is sent (empty “Scope'lar” = default list, comma- or space-separated).

  3. Click “Saqlash va tekshirish” (Save and verify)

    Socialift asks Meta for an app access token with your ID and secret: a match marks the key as verified, a rejection shows Meta's error. This checks only the ID/secret pair — the redirect URI, config_id and permissions are checked on the first real login. The secret is stored encrypted and never returned in full; leave the field empty when editing to keep the current one.

  4. Copy the webhook and callback URLs

    After saving, the card shows Webhook URL, Webhook verify token, Deauthorize callback and Data deletion callback. Your app gets its own webhook URL, and incoming events are verified with your App Secret. Paste the webhook pair into the Webhooks settings, the deauthorize URL into the Facebook Login settings and the data deletion URL into the field under App settings → Basic.

  5. Connect an account and sync Pages

    In “Ulanishlar” (Connections) click “Ulash” (Connect) on the Facebook card, then “Page'larni sinxronlash” (Sync Pages) — your Pages and their linked Instagram accounts are added. Subscribe each Page to webhooks from Playground (the “Page'lar va webhook” section) or with fb.subscribe_page in the SDK.

Which permissions does the app need?

This is Socialift's default “Scope'lar” list. When you use config_id, choose the same permissions inside the configuration.

Which permissions does the app need? — Capability matrix by platform
PermissionWhat it allowsWhere the SDK needs it
public_profileDefault profile fields of the person logging inLogin
emailPrimary email addressLogin
pages_show_listList of Pages the person managesfb.pages
pages_read_engagementPage content and metadatafb.posts, fb.comments, fb.post_insights
pages_manage_postsCreate, edit and delete Page postsfb.publish_post, fb.delete_post
pages_manage_engagementCreate, edit and delete comments on the Pagefb.reply_comment, fb.hide_comment
read_insightsPage and post insightsfb.post_insights
pages_manage_metadataSubscribe the Page to webhooks and update its settingsfb.subscribe_page
pages_messagingThe Page's Messenger conversations; needed for the Page messages webhook fieldDefault list only — Socialift has no Messenger methods
leads_retrievalRead data collected by Lead Ads formsfb.lead_forms, fb.leads
pages_manage_adsManage ads associated with the Pagefb.lead_forms
instagram_basicInstagram profile and media via the Pageig.profile, ig.media
instagram_content_publishPublish Instagram postsig.publish
instagram_manage_commentsCreate, hide and delete Instagram commentsig.comments, ig.reply_comment
instagram_manage_insightsInstagram account and media insightsig.insights, ig.media_insights
instagram_manage_messagesRead and reply to Instagram Directig.conversations, ig.send_message
ads_readAds reporting (Ads Insights)Ads.campaigns, Ads.insights_rows
ads_managementManage ad accounts and adsAds.create_campaign, fb.ad_context
business_managementBusiness Manager APIDefault list
Notes and limits

Per Meta's docs, retrieving leads with ad-level data needs ads_management, leads_retrieval, pages_show_list, pages_read_engagement and pages_manage_ads together. Instagram Direct via a Page needs instagram_basic, instagram_manage_messages and pages_manage_metadata.

Using the keys in the Python SDK

Facebook.from_env() reads FACEBOOK_APP_ID, FACEBOOK_APP_SECRET, FACEBOOK_CONFIG_ID and META_GRAPH_VERSION from the environment.

meta_login.py
import asyncio
import secrets

from socialift import Facebook

REDIRECT_URI = "https://example.com/auth/facebook/callback"  # same as in Valid OAuth Redirect URIs


async def main() -> None:
    # FACEBOOK_APP_ID, FACEBOOK_APP_SECRET, FACEBOOK_CONFIG_ID, SOCIALIFT_LICENSE_KEY
    async with Facebook.from_env() as fb:
        state = secrets.token_urlsafe(32)  # store in the session, compare in the callback
        print(fb.login_url(redirect_uri=REDIRECT_URI, state=state))

        code = input("code: ")
        token = await fb.exchange_code(code, redirect_uri=REDIRECT_URI)
        print(await fb.granted_scopes(token.access_token))  # permissions actually granted
        for page in await fb.pages(token.access_token):
            await fb.subscribe_page(page.id, page.access_token, fields=["leadgen", "feed"])


asyncio.run(main())

Explicitly: Facebook(app_id="...", app_secret="...", config_id="..."). With config_id, login_url sends config_id instead of scope; without it, the scopes list.

The redirect_uri in exchange_code must match the one in the login URL character for character.

Common mistakes

  • The redirect URI differs from Valid OAuth Redirect URIs (http vs https, trailing /, an extra query parameter).
  • Instagram app ID/secret entered in the Meta card (or the other way round) — they are different keys.
  • The configuration uses a System user access token — Socialift's login flow expects a User access token.
  • Configuration ID is set, but permissions are being changed in “Scope'lar” — in that case change them in the configuration.
  • Webhooks are configured at app level, but the Page isn't subscribed via subscribed_apps — no events arrive.
  • Testing before App Review with an account that has no role on the app — permissions aren't granted.
  • Advanced Access requested for permissions the app doesn't use — App Review rejects it.
  • The App Secret sits in frontend code or in a repository.

Frequently asked questions

Where do I find the Facebook App ID and App Secret?

In the Meta App Dashboard under App settings → Basic; the App ID is also shown at the top of the dashboard. Keep the App Secret on the server only — in Socialift it's stored encrypted on the “Kalitlar” (Keys) page.

What is config_id and do I need it?

config_id is the ID of a Facebook Login for Business configuration: permissions, token type and assets are chosen in the dashboard, and your code passes only the ID. It's recommended for Business-type apps. For a Consumer app leave it empty and request permissions via scope.

Can I test without App Review?

Yes. Under Standard Access, people with a role on the app (administrator, developer, tester) can grant permissions, so you can fully test with your own Pages and accounts. App Review and Advanced Access are needed only to connect accounts you don't manage.

Why aren't Page webhooks arriving?

Most often the Page hasn't installed the app via subscribed_apps — app-level settings alone aren't enough. Also check HTTPS with a valid certificate, the verify token match and that the token has pages_manage_metadata.

Do I need a separate app for Instagram?

Not for Instagram via a Page — the same Meta app with instagram_* permissions is enough. For Instagram Login without a Facebook Page, the same Meta app has a separate Instagram app ID and secret, which go into the “Instagram Login app” card on the “Kalitlar” (Keys) page.

What happens if I delete the Meta key in “Kalitlar”?

If accounts were connected through it, Socialift lists them and warns you, because their tokens don't work without that app's secret. Choosing “Baribir o'chirish va uzish” (Delete and disconnect anyway) removes the key and disconnects them. Unchecking “Faol” (Active) instead moves new connections to the Socialift key while existing ones keep working.

Sources

  1. Meta: Create an App
  2. Meta: Facebook Login for Business
  3. Meta: Permissions Reference
  4. Meta: Webhooks for Pages
  5. Meta: App Review submission guide
  6. Meta: Business Verification

Related pages