Configuring Facebook Extractor
###1. Create config and authorize fb account
After creating a config of keboola.ex-facebook
component, authorize your facebook account in ui of created configuration
List ad accounts via call POST https://docker-runner.keboola.com/docker/keboola.ex-facebook/action/accounts with sapi token(x-storageapi-token) in the header and body:
{
"configData": {
"authorization": {
"oauth_api": {
"id": "<configId>"
}
}
}
}
replace the <configId> with actual id of created config of keboola.ex-facebook. You should get response as following:
[
{
"category": "Software",
"name": "Keboola",
"id": "177057932317550",
"perms": [
"ADMINISTER",
"EDIT_PROFILE",
"CREATE_CONTENT",
"MODERATE_CONTENT",
"CREATE_ADS",
"BASIC_ADMIN"
]
},
{
"category": "Community",
"name": "Hudebny SH",
"id": "222838661196260",
"perms": [
"ADMINISTER",
"EDIT_PROFILE",
"CREATE_CONTENT",
"MODERATE_CONTENT",
"CREATE_ADS",
"BASIC_ADMIN"
]
}
]
Here extracts selected page insights for over last 1000 days(query name page), all feed posts and comments(query name scrape) and selected posts insights(query name posts)
{
"accounts": {
"177057932317550": {
"id": "177057932317550",
"name": "Keboola",
"category": "Software"
}
},
"api-version": "v2.8",
"queries": [
{
"id": 1,
"name": "page",
"type": "nested-query",
"query": {
"limit": "1",
"path": "",
"fields": "insights.since(1000 days ago).metric(page_views_total, page_fan_removes, page_fan_adds, page_fans, page_negative_feedback, page_consumptions, page_engaged_users, page_impressions_by_story_type, page_impressions_organic, page_impressions_paid, page_impressions, page_stories_by_story_type, page_impressions_by_locale_unique)",
"ids": "177057932317550"
}
},
{
"id": 2,
"name": "scrape",
"type": "nested-query",
"query": {
"path": "feed",
"fields": "caption,message,created_time,type,description,comments{message,created_time,from}",
"ids": "177057932317550"
}
},
{
"id": 3,
"name": "posts",
"type": "nested-query",
"query": {
"path": "feed",
"fields": "insights.since(now).metric(post_negative_feedback, post_engaged_users, post_consumptions, post_impressions_fan, post_impressions_paid, post_impressions, page_posts_impressions_organic, page_posts_impressions_paid, page_posts_impressions)",
"ids": "177057932317550"
}
}
]
}
to download the whole feed including posts likes, comments and subcomments and its likes, update the fields parameter of the scrape query as follows:
"fields": "caption,message,created_time,type,description,likes{name,username},comments{message,created_time,from,likes{name,username},comments{message,created_time,from,likes{name,username}}}"
to incrementally download only posts created past few days ago, use since parameter as follows:
{
"id": 2,
"name": "scrape",
"type": "nested-query",
"query": {
"path": "feed",
"since" "14 days ago",
"fields": "caption,message,created_time,type,description",
"ids": "177057932317550"
}
}