Skip to main content
Socialift
Guide

How to connect Instagram to a CRM

Connecting Instagram to a CRM takes five things: a professional (Business or Creator) account, a Meta app with the right permissions, an OAuth flow, an HTTPS endpoint for webhooks and code that writes events into the CRM. A linked Facebook Page is required only for the Facebook Login path and Lead Ads. Below is each stage with the practical detail.

Published: Updated:

The short answer

Pick the login path: Instagram Login (no Page, instagram_business_manage_messages) or Facebook Login with a linked Page (instagram_manage_messages, plus leads_retrieval for Lead Ads). Build the OAuth flow, subscribe to webhooks, then submit App Review with a screen recording. After that each new Direct message and lead reaches your endpoint as an event, and your code writes it into the CRM.

Step by step

  1. Prepare the account

    Switch the Instagram account to Business or Creator — personal accounts are not supported. Link a Facebook Page only if you use Facebook Login or need Lead Ads.

  2. Create the Meta app

    Open an app in Meta for Developers, add the Instagram and Webhooks products, and store the app secret somewhere safe.

  3. Request permissions

    instagram_manage_messages (or instagram_business_manage_messages with Instagram Login) for conversations; leads_retrieval, pages_manage_ads and ads_management for leads; pages_show_list, pages_read_engagement and pages_manage_metadata for Pages and webhooks. Ask only for what you use.

  4. Write the OAuth flow

    A “Connect Instagram” button in the CRM sends the user to the chosen login dialog (Facebook or Instagram). Exchange the returned code for a token on the server: with Facebook Login store the Pages and each linked Instagram account ID, with Instagram Login store the Instagram user ID.

  5. Wire up the webhook

    Expose an HTTPS endpoint with a valid certificate, answer the hub.challenge check (verify_challenge), verify X-Hub-Signature-256 on the raw body (verify_request) and subscribe each Page to your app (fb.subscribe_page). Comment webhooks need Advanced Access and the app in Live mode.

  6. Map the events

    New conversation → contact and deal; lead form → lead; comment → task. Tag every record with its source.

  7. Close the reply loop

    Let reps answer from inside the CRM. That works within the 24-hour window — surface the window in the UI. Outside the window a human_agent tag allows replies for up to 7 days (requires the Human Agent feature); ig.send_message() sends no tag.

OAuth callback — Pages and Instagram accounts

Facebook Login path: the code is exchanged for a token and each Page is stored with its linked Instagram account.

callback.py
import asyncio
from socialift import Facebook

async def main(code: str):
    # FACEBOOK_APP_ID, FACEBOOK_APP_SECRET, SOCIALIFT_LICENSE_KEY — env
    async with Facebook.from_env() as fb:
        token = await fb.exchange_code(code, redirect_uri="https://your-domain/cb")
        for page in await fb.pages(token.access_token):
            # the Page, its token (store it encrypted) and the linked Instagram account
            crm.save_connection(page.id, page.access_token, page.instagram_id)

asyncio.run(main("CODE_FROM_CALLBACK"))

Turning conversations into CRM contacts

sync.py
import asyncio, os
from socialift import Instagram

async def main():
    async with Instagram.via_facebook(app_secret=os.environ["FACEBOOK_APP_SECRET"]) as ig:
        chats = await ig.conversations(page_token, page_id=PAGE_ID, ig_user_id=IG_USER_ID)
        for chat in chats["data"]:
            c = chat["contact"]
            if not c:
                continue
            crm.upsert_contact(external_id=c["id"], name=c.get("name") or c.get("username"),
                               source="instagram_direct", followers=c.get("follower_count"),
                               is_follower=c.get("is_user_follow_business"))

asyncio.run(main())

Profile fields are not always returned (for example, when the user has blocked you), which is why the code uses c.get(...).

The mistakes people make most

  • The account is still personal (not Business or Creator) — the API does not work at all.
  • App Review was skipped: what worked for accounts with a role on the app fails for other customers.
  • The app was never set to Live or the Page was never subscribed — webhooks do not arrive.
  • The webhook signature was computed over re-serialised JSON.
  • Events were not deduplicated — duplicate deals appeared in the CRM.
  • The 24-hour window was ignored — replies bounced back unsent.
  • Token expiry was not tracked — the integration stopped silently.

How long it takes

The technical part — OAuth, webhooks and event mapping — depends on your CRM. The slowest step is usually App Review, and Meta's review time is outside your control.

So the right order is: build and test the integration with accounts that have a role on your app (Standard Access), record the screencast, then submit App Review for Advanced Access.

← Back to blog

Frequently asked questions

Do I need a developer to connect Instagram to a CRM?

Yes. The process requires a Meta app, OAuth and a webhook endpoint — it cannot be done without technical knowledge, unless a ready plugin exists for your CRM.

Can several Instagram accounts feed one CRM?

Yes. With Facebook Login each account comes through its Page and Page token; with Instagram Login each account has its own Instagram user token. Store them as separate connections on the CRM side.

Does Instagram return historical conversations?

Within limits: ig.conversations() lists chats and ig.messages() reads them, but Meta returns details only for the 20 most recent messages per conversation, and Requests-folder chats inactive for 30 days are not returned.

Should I use Instagram Login or Facebook Login?

If you only need Direct and comments, Instagram Login is enough and no Facebook Page is required. If you also need Lead Ads, or your customers' accounts are already linked to Pages, choose Facebook Login: the leadgen event and leads_retrieval work through the Page.

Does a Socialift trial token unlock this whole integration?

Yes, for the first 30 days: a trial token unlocks every SDK feature — Direct, Lead Ads, insights, publishing and the webhook helpers. After that the token renews in 30-day periods from your balance and its features depend on the token's plan — “Tekshirish va muhitlar” (Check and environments) under “Tokenlar” (Tokens) in the dashboard shows the exact list. The dashboard Playground works regardless of plan.

Sources

  1. Meta: Instagram API with Instagram Login
  2. Meta: Instagram Platform overview (permissions)
  3. Meta: Retrieving leads (Lead Ads)
  4. Meta: Instagram webhooks
  5. Meta: Conversations API
  6. Meta: Human Agent feature

Related pages