daroczig / fbRads

Analyze and manage Facebook ads from R using this client library to access their Marketing APIs
GNU Affero General Public License v3.0
153 stars 57 forks source link

Possibility to create copies of entities? #126

Open ArbenKqiku opened 4 years ago

ArbenKqiku commented 4 years ago

Hi,

Is it possible to copy campaigns, ad sets or ads by using your package?

I saw there is an endpoint in the Facebook API, here is an example for the ad set: https://developers.facebook.com/docs/marketing-api/reference/ad-campaign/copies/#overview

Thanks.

Arben

ArbenKqiku commented 4 years ago

I was actually able to do it with a post request to copy an ad set:

token = "xyzxyzxyzxyzxyzxyzxyzxyz"
ad_set_id = "4234242343242432"
campaign_id = "4234242343242432"
name = "TESTCOPY"

URL = str_c("https://graph.facebook.com/v8.0/", ad_set_id,"?name=", name,"&campaign_id=", campaign_id, "/copies&access_token=", token)

POST(URL)
daroczig commented 4 years ago

Sorry, I won't have time in the near future to add support for this, but would appreciate a PR based on the above POST example using the internal fbad_request approach https://github.com/daroczig/fbRads/blob/master/R/fb_init.R#L56