Skip to content

ig: add support for login and push notifications with android API - #361

Merged
iFixRobots merged 26 commits into
mainfrom
codex/instagram-native-push
Sep 22, 2026
Merged

iFixRobots merged 26 commits into
mainfrom
codex/instagram-native-push

Conversation

@iFixRobots

@iFixRobots iFixRobots commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Add a native Instagram login flow that uses one session for messages and push notifications. The flow is available for both cloud and on-device connections.

  • Sign in once, including verification, and use that session for messaging and push registration.
  • Register native push through Beeper's existing relay so Instagram can wake an on-device connection while Beeper is in the background.
  • Save the session and push keys so reconnecting and renewing registration don't require another login.
  • Reuse the existing message processing and sync handling. Keep existing web sessions working.
  • Use req/uTLS for the native TLS and HTTP/2 profile, and the official FlatBuffers library for stream requests and responses.

Validation includes a fresh Android login, self-hosted login and restart, sending and receiving with native sessions, and background notifications on Android and iOS. Fresh iOS setup remains unverified because the SMS never arrived. A fresh install of Instagram's own Android app reproduced that nondelivery too.

Rollout requires enabling instagram-native for the cloud and local login flows.

Related: SDK update · req receive-window fix

@iFixRobots iFixRobots changed the title ig: add native FCM registration ig: support native push notifications Sep 18, 2026
@iFixRobots iFixRobots changed the title ig: support native push notifications ig: add native push for on-device connections Sep 18, 2026
@iFixRobots
iFixRobots marked this pull request as ready for review September 18, 2026 16:50
@iFixRobots
iFixRobots marked this pull request as draft September 18, 2026 18:37
@iFixRobots iFixRobots changed the title ig: add native push for on-device connections ig: use one native login for messages and push notifications Sep 18, 2026
@iFixRobots
iFixRobots marked this pull request as ready for review September 18, 2026 23:16
@Fizzadar
Fizzadar requested a review from highesttt September 19, 2026 07:03
@Fizzadar

Copy link
Copy Markdown
Member

@highesttt can you test this out as well please? Isn’t this the login flow that wasn’t giving cookies that worked with the rest of the bridge (mobile only cookies or something)?

Comment thread pkg/igconnector/client.go Outdated
Comment thread pkg/messagix/dgw/conn.go
Comment thread pkg/messagix/dgw/basestream.go
Comment thread pkg/instameow/socket.go Outdated
Comment thread pkg/messagix/httpclient/instagram_tls.go Outdated
Comment thread pkg/instameow/native_socket.go Outdated
Comment thread pkg/instameow/login_mobile.go Outdated
Select the captured TLS profile from native login state, use the normal gateway for native streams, and restore the shared login request retries.
@iFixRobots
iFixRobots marked this pull request as draft September 19, 2026 17:59
@iFixRobots
iFixRobots marked this pull request as ready for review September 20, 2026 13:43
Msg("Captured Instagram web two-factor challenge")
if info.EncryptedContext != "" && (method == "SMS" || method == "WHATSAPP") {
if err := c.sendInstagramWebTwoFactorCode(ctx, c.webTwoFactor); err != nil {
return nil, err

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Was this something actually missing from the web login code, or was it just for the mixed native+web login thing that was removed? (also are there any other leftovers of that mixed login flow?)

Comment thread pkg/instameow/native_socket.go Outdated
Comment thread pkg/messagix/bloks/bloks.go
@iFixRobots

Copy link
Copy Markdown
Contributor Author
  1. Was the SMS request missing from web login? Any mixed-login leftovers?

It was missing from web login too. I found it during the mixed-flow work, but Instagram’s website makes a separate request to send the first SMS. We were showing the code field without making that request, so that fix stays.

There were leftovers I should have removed. Those are gone now.

  1. What were the manual FlatBuffers checks for?

I kept them after switching to the generated decoder and missed that the surrounding DGW handler already catches decoding failures and reconnects. I removed the whole wrapper. It now uses the generated decoder directly.

  1. Keep the source-version comment.

Agreed and done.

@tulir

tulir commented Sep 21, 2026

Copy link
Copy Markdown
Member

I renamed the new login flow to android since instagram-native will be even more confusing if we ever add ios (and there's no need for the instagram- prefix anymore with IG and FB fully split up)

Everything mostly looks good now, but @highesttt should also review the login parts

@tulir tulir changed the title ig: use one native login for messages and push notifications ig: add support for login and push notifications with android API Sep 21, 2026

@highesttt highesttt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks reasonable, tested on multiple accounts from different countries, works well

@iFixRobots
iFixRobots merged commit bd10396 into main Sep 22, 2026
11 checks passed
@iFixRobots
iFixRobots deleted the codex/instagram-native-push branch September 22, 2026 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants