Skip to content
GoldRiftPublic

About

A direct messaging only material 3 expressive instagram client

Topics

Resources

Stars

18 stars

Watchers

1 watching

Forks

Repository files navigation

InstaDM

An Android Instagram Direct client with a Go protocol core.

License: AGPL-3.0 Platform: Android Go: 1.27

InstaDM is an unofficial Instagram DM client for Android. A Jetpack Compose app sits on top of a Go core that talks the Instagram messaging protocol, so the inbox, conversations, sending, and realtime delivery work without the official app. It is still experimental.

Download the latest APK from the releases page and pick the file for your phone. It runs on Android 7.0 and later, and most phones need arm64-v8a.

Warning: InstaDM is not affiliated with, endorsed by, or supported by Instagram or Meta. Third-party clients can violate Instagram's Terms of Service and may get an account restricted or banned.

Contents

Features

Android app

  • Log in on Instagram's own page in a WebView. Passwords, 2FA prompts, and checkpoints never reach the app.
  • The session is encrypted with a non-exportable Android Keystore key and kept in noBackupFilesDir, out of backups.
  • Inbox with cached previews, avatars, unread badges, group attribution, and pull to refresh. It loads 20 conversations and fetches older ones as you scroll.
  • Search for an account from the inbox and open its chat, even if you have never messaged it. Backing out without sending leaves no trace, because the thread joins the inbox only after the first message creates it.
  • Tap the avatar or name in a direct chat's header to open a profile sheet with the account's name, verification, and friendship flags. The sheet keeps the inbox selection in place on wide screens.
  • Tap an avatar in the inbox or search results, or in the account sheet, to open a zoomable photo popup.
  • Each conversation pages 30 messages and keeps your place while older pages load.
  • Send text, photos, videos, files, and voice notes, plus GIFs and stickers from the keyboard. A message appears at once, and a durable outbox row retries it with the same threading ID after a failure or a restart.
  • Share text, photos, videos, audio, or files into InstaDM from another app. Filter the inbox, pick one or more chats, add an optional note.
  • Inline images, GIFs, stickers, videos, and reels, with a full-screen viewer for attachments and shared reels.
  • Voice notes record on hold, lock on a slide up, and cancel on a slide left. They play with a waveform and seek on tap.
  • Replies by swipe or long-press, reactions by double-tap or long-press for the full set, edits with an on-demand history, unsend, and read receipts with seen ticks. A group receipt shows the pictures of the members who read the message. Tapping a quoted reply scrolls to the original message.
  • Typing indicators, with sender pictures stacked beside them in groups. The app also tells Instagram when you type, unless typing signals are off.
  • Settings cover appearance, chat behavior, background sync, notification previews, and clearing cached media. They stay on the device across logouts.
  • Read receipts can stay off while you read; sending a message still marks the thread read, so the app and Instagram agree on what you saw.
  • Reaction activity entries such as "Liked a message" stay out of the transcript, since the reaction already shows on the message. The inbox preview and the notifications still mention them.
  • Group and system entries render as centered notices rather than bubbles, with no actions and no sent or seen ticks. A failed send shows as a warning instead of as your own message.
  • Search can start a group: pick 2 to 250 accounts, name it, and open it. A group header opens a sheet to rename the group, change or remove its photo, promote or demote admins, add accounts, remove members if you are an admin, and leave. Name, photo, membership, and admin changes from other clients update live.
  • Share cards for posts, stories, reels, and pages: the preview sits on top and a tracking-free link underneath. Instagram links read /reel/…, /p/…, or /stories/…, and tapping still opens the full URL. Tapping a reel cover plays it in the viewer.
  • Realtime delivery through a foreground dataSync/remoteMessaging service, so messages, edits, deletes, reactions, receipts, and typing arrive with the app in the background. Notifications stack per conversation and carry Reply and Like actions, which go through the outbox and survive a restart. The open chat never notifies; a message in another chat shows a banner with the sender and a one-line preview.
  • Material 3 Expressive with Material You colors, a two-pane inbox at 840 dp and wider, and TalkBack-friendly controls.
  • Bounded storage: at most 10,000 messages per thread and a 250 MB media cache, with 8 MB image and 25 MB other uploads.

Note: Android does not let a normal app keep a connection alive in the background, so instant delivery needs a foreground service, and every foreground service shows an ongoing notification. That notification reports the connection state (Live when connected) and carries a Stop action, which ends background delivery until you open the app again. To avoid it, set Background sync to Periodic: WorkManager then checks the inbox every 15 minutes or more, and the open app still receives messages live.

Go core and CLI

  • Validates and normalizes cookies, and exports rotated session cookies after a successful call.
  • mailbox, thread (with older-page cursors), send, send-media, send-new, media, mark-read, react, edit, unsend, mute, pin, add-members, remove-member, leave, create-group, edit-title, edit-avatar, remove-avatar, add-admins, remove-admins, and watch.
  • A durable CLI outbox (outbox list/retry/remove) that reuses the original OTID.
  • An NDJSON watch stream that reconnects with backoff and stops on permanent errors.
  • A JSON-only gomobile wrapper (go-core/mobile) that the app embeds as igcore.aar.

Screenshots

Captured from the offline demo build on an API 37 emulator.

Light

Inbox
Inbox
Chat
Chat
Media viewer
Media viewer
Message actions
Message actions
Voice note
Voice note
Send and reply
Send and reply
Edit
Edit
Unsend
Unsend
Links and voice
Links and voice
Group chat
Group chat
Video, reel, view-once
Video, reel, view-once
Search
Search
Account menu
Account menu
Settings
Settings
Banner for another chat
Banner for another chat
Music and live location
Music and live location
Pinned messages
Pinned messages
Edit history
Edit history
Group members
Group members
Mentions
Mentions

Dark

Inbox (dark)
Inbox (dark)
Chat (dark)
Chat (dark)
Media viewer (dark)
Media viewer (dark)
Message actions (dark)
Message actions (dark)
Group chat (dark)
Group chat (dark)
Settings (dark)
Settings (dark)

Two-pane

Two-pane inbox
Two-pane inbox
Two-pane chat
Two-pane chat

Requirements

  • Go 1.27.1+ for the core and CLI.

  • JDK 25 for the Gradle daemon; the wrapper pins the toolchain.

  • Android SDK with compileSdk 37 and an NDK under $ANDROID_HOME/ndk. minSdk is 24 and targetSdk is 37.

  • gomobile and gobind on PATH:

    go install golang.org/x/mobile/cmd/gomobile@latest
    go install golang.org/x/mobile/cmd/gobind@latest
  • adb and a device or emulator for instrumented tests and real-account runs.

Toolchain versions are pinned in gradle/libs.versions.toml (Gradle 9.6, AGP 9.4, Kotlin 2.2, Compose Material 3).

Build

The Android AAR is generated locally and is not committed:

# 1. Compile the Go core into app/libs/igcore.aar
./scripts/build-android-aar.sh

# 2. Build the debug APK
./gradlew :app:assembleDebug

The APK lands in app/build/outputs/apk/debug/app-debug.apk. The debug APK is a single universal build with all four gomobile ABIs and is about 93 MB.

To test a release-optimized build on a phone alongside an installed release, use the dev build type (com.goldrift.instadm.dev, labeled InstaDM Dev). It uses R8 shrinking like release and signs with your local debug keystore, so it never replaces com.goldrift.instadm or needs the release keystore. Select the dev build variant in Android Studio and press Run, or build a single-ABI arm64-v8a APK from the terminal:

./scripts/build-dev.sh           # write build/dev/instadm-dev-<sha>-arm64-v8a.apk
./scripts/build-dev.sh --serve   # build and serve the APK over LAN with a QR code
./scripts/build-dev.sh --install # build, install over adb, and launch

scripts/build-dev.sh reuses app/libs/igcore.aar when Go sources have not changed, and rebuilds only the requested ABI when they have. Pass --host or --port to override the LAN address or TCP port for --serve.

For release, build the per-ABI APKs in one step:

./scripts/build-release.sh

It rebuilds the stripped AAR and writes one APK per ABI under app/build/outputs/apk/release/, about 21 to 23 MB each. Without signing variables the files are app-<abi>-release-unsigned.apk; with them they are app-<abi>-release.apk. The normal release path is a version tag, which runs the GitHub Actions workflow; see Releases.

The AAR script strips Go debug info (-trimpath -ldflags="-s -w"), which cuts about a third off each libgojni.so. To build a smaller AAR for one architecture, pass ABIS (any of armeabi-v7a, arm64-v8a, x86, x86_64):

ABIS=arm64-v8a ./scripts/build-android-aar.sh

Pass STRIP=0 to keep Go symbols when debugging native crashes. Plain ./gradlew :app:assembleRelease still produces a single universal APK; the release script enables -Pinstadm.abiSplits=true for the per-ABI outputs.

The script defaults ANDROID_HOME to $HOME/Android/Sdk and picks the newest NDK under $ANDROID_HOME/ndk.

Releases

Pushing a vX.Y.Z tag runs .github/workflows/release.yml. It builds the stripped AAR, signs the four APKs, and attaches instadm-<version>-<abi>.apk plus SHA256SUMS and the latest.json update manifest to the GitHub Release. versionName is the tag without v; versionCode is major*10000 + minor*100 + patch (for example v1.2.3 becomes 10203). Do not edit the version fields in app/build.gradle.kts for a release; the workflow overrides them from the tag.

InstaDM can update itself from those releases. Once a day, and when you tap Check for updates in Settings, it reads latest.json, downloads the APK for your ABI straight into the system installer, and verifies its SHA-256 before handing it over; the system then asks you to confirm the install. A found update shows as a dot on the inbox profile picture and as a row in the account sheet, where the download progress is shown. Android needs "Install unknown apps" allowed for InstaDM once. Updates only work on builds signed with the same release key, so a debug or demo build never offers one.

git tag -a v1.2.3 -m "What changed in 1.2.3"
git push origin v1.2.3

The tag annotation becomes the release body. A lightweight tag (git tag v1.2.3) falls back to GitHub's generated notes, which for a tag-only workflow is usually just a compare link. Re-running the workflow keeps notes you edited on the release page.

Create the release keystore once and add it under Settings → Secrets and variables → Actions:

keytool -genkeypair -v -keystore instadm-release.jks -alias instadm \
  -keyalg RSA -keysize 4096 -validity 10000
base64 -w0 instadm-release.jks   # INSTADM_KEYSTORE_BASE64
Secret Value
INSTADM_KEYSTORE_BASE64 base64 of the keystore
INSTADM_KEYSTORE_PASSWORD keystore password
INSTADM_KEY_ALIAS key alias
INSTADM_KEY_PASSWORD key password

The default PKCS12 keystore uses the keystore password for the key too: press Enter at the key-password prompt and store the same value in both password secrets. Different passwords require -storetype JKS, which is legacy.

Back up the keystore; a lost key means installed releases cannot be updated. x86 and x86_64 are emulator builds. Debug and release builds use different keys, so uninstall a debug build before installing a release APK, which also deletes app data.

Run the workflow manually with a version to produce signed artifacts without publishing. For a local signed build, export the same variables:

export INSTADM_KEYSTORE=instadm-release.jks INSTADM_KEYSTORE_PASSWORD=... \
  INSTADM_KEY_ALIAS=instadm INSTADM_KEY_PASSWORD=...
VERSION=1.0.0 ./scripts/build-release.sh -PversionCode=10000 -PversionName=1.0.0

Run

./gradlew :app:installDebug
adb shell am start -n com.goldrift.instadm/.MainActivity

On first launch the app shows Instagram's login page. Once sessionid, csrftoken, and ds_user_id exist, it validates them by loading the mailbox and only then persists the encrypted session.

Sign in

Normal use happens entirely in the app: the WebView is Instagram's own login UI, so two-factor prompts and checkpoints behave as they do on the web.

For development and the runtime smoke test, debuggable builds also accept a cookie file at the app-specific external path. It is read only when no encrypted session exists, so replacing it after login requires clearing app data first:

adb shell mkdir -p /sdcard/Android/data/com.goldrift.instadm/files
adb push ~/.config/instadm/cookies.json \
  /sdcard/Android/data/com.goldrift.instadm/files/cookies.json

The debug cookie file is excluded from Android backup, and the encrypted session is kept only in noBackupFilesDir.

Command-line core

go-core is usable on its own for scripted checks and real-account testing:

cd go-core

go run ./cmd/igcli mailbox --cookies ~/.config/instadm/cookies.json
go run ./cmd/igcli thread <thread-id> --cookies ~/.config/instadm/cookies.json
go run ./cmd/igcli send <thread-id> "hello" --cookies ~/.config/instadm/cookies.json
go run ./cmd/igcli watch --cookies ~/.config/instadm/cookies.json

The CLI accepts a flat JSON cookie file, a Cookie-Editor style array, a raw Cookie header, or --cookies - for stdin. See go-core/README.md for every command, flag, output shape, and the pinned upstream protocol dependency.

Repository layout

Path Contents
app/ Android app, one Gradle module, Jetpack Compose.
app/libs/igcore.aar Generated by scripts/build-android-aar.sh; not committed.
go-core/igcore/ Protocol calls and normalized JSON views.
go-core/cmd/igcli/ CLI dispatch and the file outbox.
go-core/mobile/ JSON-only gomobile API used by the app.
go-core/fixtures/ Synthetic, redacted mailbox and thread samples.
scripts/ AAR build script and demo screenshot automation.

The app keeps Room as its source of truth; the Go core owns only session and protocol state. go-core is a thin normalized layer over the pinned mautrix-meta library and does not invent endpoints or field names.

Development

Go checks, from go-core/:

go build ./...
go vet ./...
go test ./...

Android checks, from the repository root:

./gradlew :app:testDebugUnitTest
./gradlew :app:lintDebug
./gradlew :app:connectedDebugAndroidTest   # needs a device/emulator

The runtime smoke test loads the mailbox, the first thread, and an older page, then waits for a connected watch event. It skips when no cookie file exists:

./gradlew :app:connectedDebugAndroidTest \
  -Pandroid.testInstrumentationRunnerArguments.class=com.goldrift.instadm.GoBindingSmokeTest

CI only runs the tag-driven release workflow; these local checks remain the gate for normal changes. connectedDebugAndroidTest may reinstall the app and clear its external files, so real-account runs are more reliable when you install both APKs, push the cookie file, and invoke the runner directly.

Offline demo and screenshots

scripts/demo-screenshots.sh builds the offline demo app, runs it on the Medium_Phone_API_37.0 emulator, replaces the light, dark, and two-pane captures in docs/screenshots/, and regenerates the screenshot gallery above. The block between the demo-screenshots markers is generated; do not edit it by hand:

./scripts/demo-screenshots.sh

The demo is a separate build (com.goldrift.instadm.demo) with fictional conversations, generated media, and no INTERNET permission. It has its own storage sandbox, so it never reads a real session. The demo shares the app's source, so UI and feature changes arrive on the next build; only new demo content needs a change in app/src/demo. Build or install it directly with:

./gradlew :app:assembleDemo
adb install -r app/build/outputs/apk/demo/app-demo.apk

The screenshot suites live in src/androidTestDemo/ and need the demo instrumentation target, which the script passes automatically:

./gradlew :app:connectedDemoAndroidTest \
  -Pinstadm.testBuildType=demo \
  -Pandroid.testInstrumentationRunnerArguments.class=com.goldrift.instadm.demo.screenshots.DemoScreenshotTest

The test target defaults to debug, so the ordinary device tests and connectedDebugAndroidTest are unchanged. The script leaves the latest demo APK installed on the emulator when it finishes, and relinks the README gallery with the newly captured files. docs/screenshots/ is committed; the intermediate device copy lives at /sdcard/Download/instadm-demo.

Please keep real cookies and unredacted captures out of issues and pull requests; go-core/fixtures/ holds synthetic samples only.

Status and limitations

InstaDM works, but it is still early:

  • Single account only. The inbox profile picture opens an account sheet that names the signed-in account and offers settings, the available update, and log out, which discards the session and clears the local cache; an expired session still needs a manual "log in again" tap. Account switching is out of scope.
  • View-once photos and videos are deliberately never fetched; their bubbles point to the official app.
  • Music shares show the artwork, track, and artist with an inline 30 second preview and a link to the artist profile. Live-location shares show a map snapshot that opens the phone's map app at the shared spot. Neither can be sent from the app. A live location does not update, and an ended share shows a stopped notice.
  • Instagram can challenge or block an embedded browser. The login uses a desktop Chrome user agent because Instagram's mobile Bloks login page renders with a zero-height root in Android WebView.
  • The protocol is unofficial and can change at any time, so features may break without a release.
  • The shared protocol library is AGPL-3.0, so this project is too.

Open work is tracked in docs/roadmap.md.

Disclaimer

This project is provided for personal, educational use. It is not affiliated with Instagram or Meta and comes with no warranty. You are responsible for how you use it and for complying with Instagram's Terms of Service and any local law. Using an unofficial client can result in account restrictions, so test with a secondary account.

License

InstaDM is licensed under the GNU Affero General Public License, version 3 or later. See LICENSE.

Third-party components and their licenses are listed in THIRD_PARTY_NOTICES.md.

About

A direct messaging only material 3 expressive instagram client

Topics

Resources

Stars

18 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages