Skip to content

Instagram channel cannot connect Meta apps that require Unified Login #1716

Open

Description

@gitpascal

Summary

New Meta apps can require Instagram API with Unified Login. ChatbotX's instagram-direct channel currently starts the legacy direct Instagram OAuth flow at https://www.instagram.com/oauth/authorize and has no way to supply Meta's Unified Login config_id.

For such apps, connecting the channel fails with:

Invalid Request: Request parameters are invalid: Invalid platform app

Meta's generated login URL instead uses https://www.facebook.com/dialog/oauth with client_id, config_id, response_type=code, and override_default_response_type=true.

Reproduction

  1. Create a new Meta app for which Meta exposes Unified Login rather than the previous Instagram Login flow.
  2. Configure the callback and webhook URLs for ChatbotX.
  3. Add the app ID and secret as ChatbotX Instagram platform credentials.
  4. Try to connect an instagram-direct channel.

The legacy Instagram authorization URL is opened and Meta rejects the app as an invalid platform app.

Expected behavior

ChatbotX should support Meta's Unified Login flow without breaking existing credentials that still use the direct Instagram OAuth flow.

Proposed compatibility approach

I have prepared an implementation that:

  • adds an optional Unified Login Configuration ID to Instagram platform credentials;
  • uses facebook.com/dialog/oauth only when that ID is configured, keeping the existing direct flow as the fallback;
  • exchanges the authorization code through the Graph API;
  • resolves the business user and paginates assigned_instagram_accounts;
  • lets the user select the Instagram account when multiple accounts are returned;
  • stores and uses the business access token plus the selected Instagram account ID for messaging, profiles, media, comments, webhook subscription, and sync;
  • uses the Unified Login webhook fields and skips the legacy ig_refresh_token path;
  • requires no database migration because the new credential field is optional in the encrypted credential payload.

Validation completed

  • Instagram integration: 30 test files, 134 tests passed
  • Database credential tests: 19 passed
  • TypeScript checks passed for the Instagram integration, database package, and builder
  • New tests cover the Unified OAuth URL, token exchange, business-user/account resolution, pagination, and backward compatibility

A live Meta OAuth smoke test is still pending, so I will open the implementation as a draft PR and keep the legacy path unchanged.

Meta documentation:

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions