Facebook Automation
Use when automating Facebook: Marketplace data extraction, account creation, or signup flows.
Support files (shared with browser-automation):
references/facebook-marketplace-graphql.md— Facebook Marketplace scraping via direct GraphQL API (no browser), doc IDs, variable structure, response parsingreferences/facebook-signup-2026.md— Current Facebook signup form DOM: input selectors, birthday/gender comboboxes, dialog workaroundstemplates/scraper.py— Complete Facebook Marketplace scraper (copy, configure, run)templates/extract_cookies.py— Chrome/Edge cookie extraction helper (run from Windows, not WSL)templates/create_account.py— Facebook account creator: Playwright + temp email + 5sim/SMSPool auto-SMS verification
Facebook Marketplace Scraping (GraphQL — No Browser)
Skip browser automation entirely and use direct GraphQL API requests.
- Endpoint:
POST https://www.facebook.com/api/graphql/with url-encoded body - Query:
MarketplaceFeedStoriesPaginationQuery— requiresfb_dtsgtoken (extracted from homepage HTML) + valid cookies (c_user,xs,fr) - Filters: Encode price, recency, location, and category in the
paramsJSON string inside variables - Pagination: Use
end_cursorfrompage_infoas the next request's cursor - Doc IDs: Rotate periodically — extract fresh ones from browser DevTools Network tab when auth errors appear
Rate limiting defense: Randomized 1-3s delays between requests, rotate __req counter, cap 5 pages per search query.
Facebook Account Creation (SMS Auto-Verification)
Facebook signup automation requires handling their checkpoint/phone verification wall (~85-95% of new accounts).
Flow: signup form fill → email confirmation (mail.tm/GuerrillaMail) → checkpoint detection → auto-purchase phone number → enter number → poll for SMS code → enter code → account created.
Key selectors for Facebook signup form (as of mid-2026):
First name: input[name="firstname"]
Last name: input[name="lastname"]
Email: input[name="reg_email__"]
Email confirm: input[name="reg_email_confirmation__"] (sometimes appears)
Password: input[name="reg_passwd__"]
Birthday: select[name="birthday_month"], select[name="birthday_day"], select[name="birthday_year"]
Gender: input[name="sex"][value="2"] (male), input[name="sex"][value="1"] (female)
Submit: button[name="websubmit"]
Phone verification detection: Check for "checkpoint" in URL or keywords in page content.
Pitfalls
- Facebook scraping accounts need aging: Newly created accounts used immediately for scraping get flagged quickly. Warm accounts for 1+ weeks with normal browsing before using for Marketplace scraping. The GraphQL API is authenticated — stale or flagged cookies result in empty responses, not clear error messages.
- Facebook doc ID rotation: The GraphQL
doc_idparameter changes periodically. When requests return auth errors despite valid cookies, the doc ID is the first suspect — open Marketplace in a real browser, check the Network tab for current values.