FACEBOOK LEAD SCRAPER
Monitors a Facebook photography group every 6 hours, finds posts from people looking to hire a photographer, and delivers leads to Telegram with AI-drafted comment and DM copy ready to paste.
How It Works
-
Scrape
Playwright opens the Facebook group and collects new posts on a 6-hour schedule, running headlessly after an initial one-time manual login.
-
Classify
Claude Haiku reads each post and decides whether it's a hire-seeking lead, and what category it falls under — maternity, families, couples, headshots, event, or other.
-
Draft
Claude Sonnet writes a tailored public comment and a private DM for each qualifying lead, personalised to the post category and portfolio links.
-
Deliver
A Telegram message is sent with the post link and both pieces of copy ready to paste. You tap the link, review the drafts, and paste — nothing sends automatically.
Configuration
All tunable settings live in config.py:
| Setting | Description |
|---|---|
| FB_GROUP_URL | The Facebook group to monitor |
| CHECK_INTERVAL_HOURS | How often to scrape (default: 6) |
| PORTFOLIO_URLS | Per-category portfolio links included in drafted responses |
| PHOTOGRAPHER_NAME | Your name, used in response prompts |
| PHOTOGRAPHER_LOCATION | Your location, used in response prompts |
Project Structure
main.py — entry point, scheduler, Telegram delivery
fb_monitor.py — Playwright scraper for the Facebook group
classifier.py — Claude Haiku: is this post a lead? what category?
responder.py — Claude Sonnet: drafts comment + DM copy
state.py — persists seen post IDs to state.json (deduplication)
config.py — all tunables in one place
get_chat_id.py — utility to find your Telegram chat ID
Notes
- Deduplication: Post IDs are written to
state.jsonbefore classification runs, so a post is never surfaced twice — even if the bot restarts mid-run. - Login: On first run, a headed browser window opens for manual Facebook login. The session is saved to
fb_session.json— all subsequent runs are headless and fully automated. - Always-on (macOS): The bot is managed as a LaunchAgent so it survives reboots and restarts automatically.