Instagram account maintenance bot — find non-followers, clean up likes, track growth, detect ghost followers, and score engagement before taking action.
Built with instagrapi, an unofficial Python library that uses Instagram's private mobile API.
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
cp .env.example .env # fill in your IG username & password
python main.py get-me # verify login worksA dark-themed control panel at http://localhost:5050 — no terminal required for day-to-day use.
python dashboard/app.pyTabs:
| Tab | What you see |
|---|---|
| Overview | Follower/following/post counts, candidate file status cards |
| Workflows | Every workflow as a clickable button; Actions show Dry Run / Live toggle |
| Growth | Chart.js line chart of followers & following over time |
python main.py --list # show all workflows
python main.py find-non-followers # analyze
python main.py dry-run # preview all candidate files
python main.py unfollow-non-followers --limit 5 # dry-run (safe)
python main.py unfollow-non-followers --live --limit 5 # real run
python main.py track-growth # log a growth snapshot
python main.py find-ghost-followers --limit 50 # detect disengaged followers
python main.py check-engagement --limit 30 # score non-followers before unfollowing| Workflow | What it does |
|---|---|
get-me |
Quick profile check — followers, following, post count |
inspect |
Read-only account overview |
dry-run |
Preview all candidate JSON files without touching the account |
| Workflow | Output file | What it does |
|---|---|---|
find-non-followers |
non_follower_candidates.json |
Accounts you follow that don't follow back |
find-liked-posts |
like_candidates.json |
Your recently liked posts (Instagram caps at ~50) |
find-posts-by-date |
post_delete_candidates.json |
Your posts older than N days |
track-growth |
logs/growth_log.csv |
Appends a timestamped snapshot of follower/following/posts/ratio |
find-ghost-followers |
ghost_follower_candidates.json |
Followers with zero engagement across your last N posts |
check-engagement |
engagement_scores.json |
Scores non-followers by likes (+1) and comments (+2) on your posts |
| Workflow | What it does |
|---|---|
bulk-unlike |
Unlike recently liked posts directly |
bulk-unlike-candidates |
Unlike from like_candidates.json |
bulk-unfollow |
Unfollow accounts directly |
bulk-unfollow-non-followers |
Unfollow from non_follower_candidates.json |
bulk-remove-followers |
Remove accounts from your followers list |
bulk-delete-posts |
Delete posts from post_delete_candidates.json |
Fetches your last N posts, collects all accounts that liked or commented, then flags followers with zero interaction as "ghosts." Configure in ig_config.py:
GHOST_FOLLOWER_MIN_POSTS = 10 # minimum posts to analyze
GHOST_FOLLOWER_ENGAGEMENT_THRESHOLD = 0 # zero interactions = ghostBefore bulk-unfollowing non-followers, score each account by their activity on your posts:
- Likes = +1 point
- Comments = +2 points
Accounts above MIN_ENGAGEMENT_SCORE_TO_KEEP are saved to a "keep" list automatically. Results saved to engagement_scores.json.
Run track-growth on a schedule (cron or manually) to build a time-series of your account metrics. The dashboard's Growth tab charts this data automatically from logs/growth_log.csv.
Non-follower detection skips accounts you followed within the last FOLLOW_BACK_GRACE_DAYS days (default: 7), giving new follows time to reciprocate before appearing as candidates.
Add keywords to BIO_WHITELIST_KEYWORDS in ig_config.py to permanently protect accounts from candidate files regardless of follow-back status.
- All action workflows default to dry-run — nothing changes until you add
--live - Randomized delays (5–15s) between actions to avoid spam detection
- Stop immediately if
ChallengeRequired— handle in the Instagram app first - Every action is logged to
logs/as CSV protected_accounts.jsonhard-protects specific accounts from all workflows- Keep daily unfollow counts under 150–200
Every destructive workflow follows the same safe pattern:
- Analyze → generates a
*_candidates.jsonfile (read-only, nothing changes) - Review → open the JSON, delete entries you want to keep
- Act → dry-run first, then
--live
This bot uses Instagram's private API. Use responsibly:
- Don't run multiple sessions simultaneously
- If Instagram requests phone verification, stop and verify manually
- Delete
session.jsonand re-authenticate if you getLoginRequirederrors