Get info about the access token set in .env as FB_ACCESS_TOKEN.
API Endpoint: https://graph.facebook.com/debug_token?input_token={input-token}&access_token={valid-access-token}
Args:
params (dict): params from .env
Returns:
dict: response from the endpoint. Contains the data_access_expires_at and expires_at
Get instagram_account_id. page_id should be known and present in the params.
API Endpoint: https://graph.facebook.com/{graph-api-version}/{page-id}?access_token={your-access-token}&fields=instagram_business_account
Args:
params (dict): params from .env file. Required keys are page_id, access_token, endpoint_base
Returns:
dict: data from the endpoint. It contains instagram_business_account id
Get facebook pages for a user. access_token is required in the params.
API Endpoint: https://graph.facebook.com/{graph-api-version}/me/accounts?access_token={access-token}
Args:
params (dict): params from .env file. Required keys are access_token, endpoint_base
Returns:
object: data from the endpoint. It contains the page id, name, and category
Get long lived access token from a short lived access token. client_id, client_secret, and access_token are required in the params.
API Endpoint: https://graph.facebook.com/{graph-api-version}/oauth/access_token?grant_type=fb_exchange_token&client_id={app-id}&client_secret={app-secret}&fb_exchange_token={your-access-token}
Args:
params (dict): params from .env file. Required keys are client_id, client_secret, access_token, endpoint_base
Returns:
dict: response from the endpoint. Contains the long lived access token.
Social API Modules¶
These modules support Facebook/Instagram account setup, token maintenance, and diagnostics for the Instagram publishing pipeline.
Debug Access Token¶
Get info about the access token set in .env as FB_ACCESS_TOKEN. API Endpoint: https://graph.facebook.com/debug_token?input_token={input-token}&access_token={valid-access-token}
params (dict): params from .env
dict: response from the endpoint. Contains the data_access_expires_at and expires_at
Get Instagram Account¶
Get instagram_account_id. page_id should be known and present in the params. API Endpoint: https://graph.facebook.com/{graph-api-version}/{page-id}?access_token={your-access-token}&fields=instagram_business_account
params (dict): params from .env file. Required keys are page_id, access_token, endpoint_base
dict: data from the endpoint. It contains instagram_business_account id
Get User Pages¶
Get facebook pages for a user. access_token is required in the params. API Endpoint: https://graph.facebook.com/{graph-api-version}/me/accounts?access_token={access-token}
params (dict): params from .env file. Required keys are access_token, endpoint_base
object: data from the endpoint. It contains the page id, name, and category
Long-Lived Access Token¶
Get long lived access token from a short lived access token. client_id, client_secret, and access_token are required in the params. API Endpoint: https://graph.facebook.com/{graph-api-version}/oauth/access_token?grant_type=fb_exchange_token&client_id={app-id}&client_secret={app-secret}&fb_exchange_token={your-access-token}
params (dict): params from .env file. Required keys are client_id, client_secret, access_token, endpoint_base
dict: response from the endpoint. Contains the long lived access token.