https://unhcr-mena.github.io/facebookapi/
Facebook Marketing API allows advertisers to target audiences by demographic groups. Facebook ad campaigns have a three-level structure.
An R package fbRads is available to wrap the API and allow for analysis of potential audience that falls within specific targeting criteria.
Another R package allows to conduct quota sampling via Facebook advertisements: fbSample. This has been used in the paper: Quota Sampling Using Facebook Advertisements Can Generate Nationally Representative Opinion Estimates.