Skip to content
Scalekit Docs
Talk to an Engineer Dashboard

Connect AI agents to Instagram

Scalekit connector
Open markdown

The Instagram connector lets your AI agent act in each user's Instagram account. Each user signs in to Instagram once, and Scalekit stores and refreshes their tokens, so your agent never handles credentials. It comes with 30 tools.

Tools
30
What they doRead · write · destructive
21 · 8 · 121 read8 write1 destructive
Users sign in with
OAuth app
Your own Instagram app

Setup

  1. Install the SDK

    Terminal window
    npm install @scalekit-sdk/node dotenv
  2. Set your credentials

    Add your Scalekit credentials to your .env file. Find values in app.scalekit.com > Developers > API Credentials.

    .env
    SCALEKIT_ENVIRONMENT_URL=<your-environment-url>
    SCALEKIT_CLIENT_ID=<your-client-id>
    SCALEKIT_CLIENT_SECRET=<your-client-secret>
  3. Create the Instagram connection

    In AgentKit > Connections, create an Instagram connection and copy its redirect URI. The name you give it is the connection_name your code passes. See Configure connections.

  4. Register an OAuth app

    Instagram connections use your own OAuth app. Register one with Instagram and add the redirect URI you copied.

    Then enter the app's Client ID and Client Secret on the Instagram connection.

    Console steps with screenshots

    Create a Meta app with Facebook Login enabled so Scalekit can authorize access to your Instagram Business or Creator account on behalf of your users. You’ll register the Scalekit redirect URI in the app, then add the app’s ID and secret to your Scalekit connection.

    1. Create or open a Meta app

      • Go to the Meta for Developers dashboard.

      • Select an existing app or click Create App and choose the Business app type.

        Meta app dashboard showing app ID, app mode, and available products

    2. Add the Instagram Graph API and Facebook Login products

      • From the app’s Add Product page, add Instagram Graph API so the app can read and publish content on Instagram Business and Creator accounts.

      • Add Facebook Login as well, since Scalekit uses it to run the OAuth authorization flow.

        App switcher dropdown for selecting or creating a Meta app

    3. Copy the redirect URI from Scalekit

      • In the Scalekit dashboard, go to AgentKit > Connections > Create Connection. Find Instagram and click Create.

      • Click Use your own credentials and copy the redirect URI. It looks like https://<SCALEKIT_ENVIRONMENT_URL>/sso/v1/oauth/<CONNECTION_ID>/callback.

    4. Add the redirect URI to Facebook Login settings

      • In your Meta app, go to Facebook Login > Settings.

      • Paste the redirect URI you copied into Valid OAuth Redirect URIs and save changes.

        Facebook Login settings showing the Valid OAuth Redirect URIs list

    5. Copy your App ID and App secret

      • Go to App settings > Basic.

      • Copy the App ID and click Show to reveal and copy the App secret.

        App settings Basic page showing App ID and App secret fields

    6. Add credentials in Scalekit

      • Return to the connection you created in Scalekit and enter:

        • Client ID — your Meta app’s App ID
        • Client Secret — your Meta app’s App secret
      • Click Save.

  5. Authorize a user and make your first call

    quickstart.mts
    import { ScalekitClient } from '@scalekit-sdk/node'
    import 'dotenv/config'
    import { createInterface } from 'node:readline/promises'
    const scalekit = new ScalekitClient(
    process.env.SCALEKIT_ENVIRONMENT_URL,
    process.env.SCALEKIT_CLIENT_ID,
    process.env.SCALEKIT_CLIENT_SECRET,
    )
    const actions = scalekit.actions
    const connector = 'instagram'
    const identifier = 'user_123'
    // Generate an authorization link for the user
    const { link } = await actions.getAuthorizationLink({ connectionName: connector, identifier })
    console.log('Authorize Instagram:', link)
    const rl = createInterface({ input: process.stdin, output: process.stdout })
    await rl.question('Press Enter after authorizing...')
    rl.close()
    // Make your first call
    const result = await actions.executeTool({
    connector,
    identifier,
    toolName: 'instagram_comment_replies_list',
    toolInput: { comment_id: 'YOUR_COMMENT_ID' },
    })
    console.log(result)
    Terminal window
    npx tsx quickstart.mts

    Each user signs in once. See Authorize a user for the full flow and statuses.

Tools

Pass the exact name to execute_tool
Try in PlaygroundRequest a tool
  • instagram_account_insights_getGet account-level Instagram insights (impressions, reach, profile views, follower count) over a period or date range.Read-only

    Get Account Insights

    Get account-level Instagram insights (impressions, reach, profile views, follower count) over a period or date range.

    Inputs

    ig_user_idstringrequired
    The Instagram professional account ID.
    metricstringrequired
    Comma-separated list of metric names to retrieve.
    periodstring
    Aggregation period for the metrics.
    sinceinteger
    Start of the date range (Unix timestamp).
    untilinteger
    End of the date range (Unix timestamp).
  • instagram_business_discovery_getLook up the public profile and recent media of any other Instagram professional (Business or Creator) account by username, without needing to connect that account.Read-only

    Get Business Discovery

    Look up the public profile and recent media of any other Instagram professional (Business or Creator) account by username, without needing to connect that account. Returns username, name, website, followers_count, media_count, biography, profile_picture_url, and recent media summaries for the target account. Use this for competitor or influencer research. Use instagram_user_get_profile instead when looking up the connected account's own profile. Requires the connected account's ig_user_id and the instagram_basic permission; the target account must itself be a public Business or Creator account.

    Inputs

    ig_user_idstringrequired
    The connected Instagram professional account's ID performing the lookup.
    target_usernamestringrequired
    The Instagram username of the other public Business or Creator account to look up (without the @ symbol).
  • instagram_comment_replies_listList replies to a specific Instagram comment, cursor-paginated.Read-only

    List Comment Replies

    List replies to a specific Instagram comment, cursor-paginated.

    Inputs

    comment_idstringrequired
    The Instagram comment ID to list replies for.
    afterstring
    Pagination cursor to fetch the next page of results.
    fieldsstring
    Comma-separated list of fields to return per reply.
    limitinteger
    Max number of replies to return per page.
  • instagram_comments_listList top-level comments on an Instagram media object, cursor-paginated.Read-only

    List Media Comments

    List top-level comments on an Instagram media object, cursor-paginated.

    Inputs

    media_idstringrequired
    The Instagram media ID to list comments on.
    afterstring
    Pagination cursor to fetch the next page of results.
    fieldsstring
    Comma-separated list of fields to return per comment.
    limitinteger
    Max number of comments to return per page.
  • instagram_content_publishing_limit_getCheck how much of the Instagram account's daily content publishing quota has been used.Read-only

    Get Content Publishing Limit

    Check how much of the Instagram account's daily content publishing quota has been used. Returns the configured quota (config) and current usage count (quota_usage) — accounts can typically publish up to 25 posts within a rolling 24-hour window. Use this before a bulk-publishing run to confirm quota is available, avoiding failed instagram_media_publish calls. Requires the account's ig_user_id and the instagram_content_publish permission.

    Inputs

    ig_user_idstringrequired
    The Instagram professional account ID to check the publishing quota for.
    fieldsstring
    Comma-separated list of fields to return. Defaults to config and quota_usage.default config,quota_usage
  • instagram_conversation_messages_listList the messages within a single Instagram Direct conversation.Read-only

    List Conversation Messages

    List the messages within a single Instagram Direct conversation. Returns the conversation id along with a messages array containing each message's id, created_time, from, to, and text. Use this after instagram_conversations_list to read a specific thread's message history. Requires the conversation_id from instagram_conversations_list and the instagram_manage_messages permission.

    Inputs

    conversation_idstringrequired
    The ID of the conversation to fetch messages for, from instagram_conversations_list.
    fieldsstring
    Comma-separated list of fields to return, typically the nested messages field expansion.default messages{id,created_time,from,to,message}
  • instagram_conversations_listList Instagram Direct conversations for a connected professional account.Read-only

    List Conversations

    List Instagram Direct conversations for a connected professional account. Returns a paginated array of conversations with id, updated_time, and participants. Use this to see who has messaged the account. Use instagram_conversation_messages_list to fetch the messages inside one conversation. Requires the instagram_manage_messages permission.

    Inputs

    ig_user_idstringrequired
    The Instagram professional account ID whose Direct conversations should be listed.
    fieldsstring
    Comma-separated list of conversation fields to return per item.default id,updated_time,participants
    limitinteger
    Maximum number of conversations to return in this page.default 25
  • instagram_hashtag_recent_media_listList the most recent public media posts tagged with a given Instagram hashtag.Read-only

    List Hashtag Recent Media

    List the most recent public media posts tagged with a given Instagram hashtag. Returns a paginated array of media objects with id, caption, media_type, media_url, permalink, and timestamp. Use this to monitor fresh activity around a hashtag. Use instagram_hashtag_top_media_list for the hashtag's most popular posts instead. Requires the hashtag_id from instagram_hashtag_search and the account's ig_user_id.

    Inputs

    hashtag_idstringrequired
    The ID of the hashtag to fetch recent media for, from instagram_hashtag_search.
    ig_user_idstringrequired
    The Instagram professional account ID performing the query.
    fieldsstring
    Comma-separated list of media fields to return per item.default id,caption,media_type,media_url,permalink,timestamp