Meta v23.0 · Facebook Login for Business · IG_API_ONBOARDING

📸 Instagram Graph API — PHP All-in-One

Enter your Meta app credentials, click Connect Instagram, authorize the account, and instantly see profile data, posts, analytics, and a generated reel script — all on this single PHP page.

Correct scopes: instagram_basic, instagram_content_publish, instagram_manage_comments, instagram_manage_insights, pages_show_list, pages_read_engagement  |  ✅ Required: Business-type Meta app + Instagram Business/Creator account + linked Facebook Page

⚙️ 1. App configuration

🔗 Connect Instagram

Credentials are stored in the PHP session only. Never expose App Secret in client-side code.

📋 2. Setup steps

Step 1
Create a Business app

Go to developers.facebook.com → Create App → Business type.

Step 2
Add Facebook Login product

Add Facebook Login for Business in your app dashboard.

Step 3
Set Redirect URI

Add this page's URL to Valid OAuth Redirect URIs in Meta → Facebook Login → Settings.

Step 4
Convert Instagram account

Switch to Business or Creator account in Instagram → Settings → Account type.

Step 5
Link to Facebook Page

In Instagram settings, connect the account to a Facebook Page you manage.

Step 6
Save credentials & connect

Enter App ID, Secret, Redirect URI above → Save → Connect Instagram.

🔑 3. Permissions (scopes)

instagram_basic instagram_content_publish instagram_manage_comments instagram_manage_insights pages_show_list pages_read_engagement
PermissionWhy needed
instagram_basicRead profile, media, and linked account info
instagram_manage_insightsRead reach, impressions, profile views, follower trends
pages_show_listList Pages to find linked Instagram Business account
pages_read_engagementRead Page engagement and content metrics
instagram_manage_commentsRead and reply to post comments
instagram_content_publishSchedule and publish posts (optional)
⚠️ App must be Business type in Meta. Consumer-type apps cannot use these scopes.

📡 4. Connection status

Connected
IG Account ID
Posts loaded
0
Long-lived token

👤 5. Profile

No profile data. Connect your account first.

📊 6. Analytics

Analytics will appear once your account is connected and posts are loaded.

🖼️ 7. Media posts (last 25)

CaptionTypeLikesCommentsTotal engagementPostedLink
No media loaded yet. Connect your account first.