This repository provides an end-to-end automation pipeline for Instagram outreach, lead generation, and engagement. It allows you to scrape posts and comments from Instagram profiles, extract potential leads, and send personalized DMs—all with minimal manual effort.
- Profile Management: Organize target profiles by niche in
profiles.json. - Post Scraping: Fetch recent posts and metadata for each profile using the Decodo API.
- Comment Scraping: Collect comments from each post to identify potential leads.
- Automated DM Sending: Send DMs to selected users using the official Instagram API via
instagrapi. - Session Management: Caches Instagram login sessions for convenience.
- Edit
profiles.json: Add your target Instagram profiles, grouped by niche. - Run
post_scraper.py: Scrape recent posts (up to 60–72 per profile) to get posts with high engagement metrics, which are customizable. Outputs*_posts.csvfiles. - Run
comment_scraper.py: Scrape comments from each post. Outputscomments_*.csvfiles. - Prepare
targets.csv: Add usernames and messages for DMing (can be automated or manual). - Run
dm.py: Send DMs to all users intargets.csv.
profiles.json— Stores Instagram profiles grouped by niche.post_scraper.py— Scrapes posts for each profile and saves to CSV.comment_scraper.py— Scrapes comments from posts and saves to CSV.dm.py— Sends DMs to users listed intargets.csv.targets.csv— List of target usernames and messages to send.requirements.txt— Python dependencies.*_posts.csv— Output: Posts scraped for each profile.comments_*.csv— Output: Comments scraped for each post.
- Clone the repository:
git clone <your-repo-url> cd Cold-DM-Agent
- Create and activate a virtual environment:
python3 -m venv .venv source .venv/bin/activate - Install dependencies:
pip install -r requirements.txt pip install instagrapi
- Set up environment variables:
- Create a
.envfile with your Decodo API key:DECODO_AUTH=Basic <your-decodo-api-key>
- Create a
- Scrape Posts:
python post_scraper.py
- Scrape Comments:
python comment_scraper.py
- Prepare
targets.csv:- Add usernames and messages (one per line, comma-separated).
- Send DMs:
python dm.py
- All scripts are interactive and will prompt for required input.
- Make sure your Decodo API key is valid and you comply with Instagram's terms of service.
- For large-scale outreach, always throttle requests to avoid being rate-limited or banned.
MIT License