Skip to content

feat(instagram): add Instagram integration#5568

Open
BillLeoutsakosvl346 wants to merge 8 commits into
stagingfrom
feature/instagram-integration
Open

feat(instagram): add Instagram integration#5568
BillLeoutsakosvl346 wants to merge 8 commits into
stagingfrom
feature/instagram-integration

Conversation

@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor

Adds Business Login OAuth, 23 tools, block, and publish routes for Instagram

Bill Leoutsakos and others added 3 commits July 9, 2026 17:25
Resolve UserFiles to Meta-fetchable presigned HTTPS URLs (600s TTL) via
internal publish routes, and fix OAuth scope storage plus connect-draft
wiring so Instagram Login publishing is testable end-to-end.

Co-authored-by: Cursor <cursoragent@cursor.com>
@vercel

vercel Bot commented Jul 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Jul 10, 2026 10:35pm

Request Review

@cursor

cursor Bot commented Jul 10, 2026

Copy link
Copy Markdown

PR Summary

High Risk
Adds OAuth, token storage/refresh, and server-side publishing to a third-party API over a large new surface; misconfiguration or ID handling could break connects or duplicate accounts.

Overview
Introduces a full Instagram workflow integration: Business Login OAuth, 23 Graph API tools, a workflow block, docs, and catalog entries.

OAuth and credentials use a dedicated authorize/callback flow (state cookies, short- to long-lived token exchange, accounts keyed by professional user_id). Connect flows reuse shared createConnectDraft (moved out of the generic OAuth2 authorize route). Token refresh adds Meta’s ig_refresh_token strategy; INSTAGRAM_CLIENT_ID / INSTAGRAM_CLIENT_SECRET are optional env vars.

Publishing (image, video, reel, story, carousel) runs through internal API routes that resolve uploads or public HTTPS URLs (longer presigned TTLs via resolveFileInputToUrl), create containers, poll until ready, then publish—carousel routes use higher maxDuration for parallel child polling.

Smaller doc-only updates align Ashby webhook fields, GitLab issue/MR outputs, and Gmail labels typing with current APIs.

Reviewed by Cursor Bugbot for commit c3c4f1d. Bugbot is set up for automated code reviews on this repo. Configure here.

Comment thread apps/sim/app/api/tools/instagram/publish-carousel/route.ts
Comment thread apps/sim/lib/integrations/instagram/resolve-media.ts
Comment thread apps/sim/tools/instagram/utils.ts
Comment thread apps/sim/blocks/blocks/instagram.ts
@greptile-apps

greptile-apps Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds Instagram as a new integration. The main changes are:

  • Business Login OAuth routes and callback handling.
  • Instagram block metadata, icons, registry entries, and docs.
  • Publishing routes for images, videos, reels, stories, and carousels.
  • Instagram tools for media, comments, DMs, insights, and publishing.

Confidence Score: 4/5

This is close, but the callback persistence race should be fixed before merging.

  • Carousel publishing now creates children before polling, so the URL lifetime issue is addressed for the normal flow.
  • The callback now stores the Instagram professional account id, which fixes the wrong-id fallback path.
  • The account write is still a read-then-insert without atomic dedupe, so concurrent callbacks can leave duplicate account rows and stale tokens.

apps/sim/app/api/auth/oauth2/callback/instagram/route.ts

Important Files Changed

Filename Overview
apps/sim/app/api/tools/instagram/publish-carousel/route.ts Creates child containers before polling and polls children in parallel.
apps/sim/app/api/auth/oauth2/callback/instagram/route.ts Uses the Instagram professional account id, but still needs atomic account dedupe.

Reviews (2): Last reviewed commit: "fix(instagram): normalize Graph ID outpu..." | Re-trigger Greptile

Comment thread apps/sim/app/api/tools/instagram/publish-carousel/route.ts Outdated
Comment thread apps/sim/app/api/auth/oauth2/callback/instagram/route.ts Outdated
…s, extend poll window and insights periods, use canonical user_id in OAuth callback
Comment thread apps/sim/tools/instagram/utils.ts Outdated
Comment thread apps/sim/app/api/auth/oauth2/callback/instagram/route.ts
…r_id

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread apps/sim/tools/instagram/reply_to_comment.ts
Comment thread apps/sim/tools/instagram/utils.ts
Comment thread apps/sim/tools/instagram/get_conversation_messages.ts
…ts, request message timestamps explicitly

Co-authored-by: Cursor <cursoragent@cursor.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 05f51a3. Configure here.

Comment thread apps/sim/tools/instagram/get_profile.ts Outdated
…trim() calls are safe

Co-authored-by: Cursor <cursoragent@cursor.com>
@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

@greptile

Comment thread apps/sim/app/api/auth/oauth2/callback/instagram/route.ts
Match the official Instagram look by filling the tile with the orange–pink–purple radial gradient so the white camera glyph sits on a full-bleed brand background.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant