facebook graph api code example
Example 1: facebook integration api
DB Structure for fb :
========================
Table Structure :
---------------------------
fb_user : id, user_id, fb_user_id, access_token, data_access_expiration, expires_In, signed_Request, date_preset, created_at, updated_at
---------
fb_user_pages : id, fb_user_id, page_id, page_name, access_token, category, tasks, created_at, updated_at
---------------
fb_page_insights : id, fb_page_id, created_date, page_post_engagements, page_views_total, page_fan_adds_unique, page_impressions, created_at, updated_at
------------------
fb_page_posts : id, fb_page_id, post_id, message, created_date, likes, comments, shares, post_reach, post_engagement, created_at, updated_at
---------------
Example 2: graph api facebook google script
function getFbService() {
return OAuth2.createService('Facebook')
.setAuthorizationBaseUrl('https://www.facebook.com/dialog/oauth')
.setTokenUrl('https://graph.facebook.com/v2.6/oauth/access_token')
.setClientId('...')
.setClientSecret('...')
.setCallbackFunction('authCallback')
.setPropertyStore(PropertiesService.getUserProperties());
}