Skip to main content

Facebook Pages Data Source

Follow the instructions below to create a new data flow that ingests data from a Facebook Pages source in Nexla.
fb_pages_api.png

Facebook Pages

Create a New Data Flow

  1. To create a new data flow, navigate to the Integrate section, and click the New Data Flow button. Then, select the desired flow type from the list, and click the Create button.

  2. Select the Facebook Pages connector tile from the list of available connectors. Then, select the credential that will be used to connect to the Facebook Pages instance, and click Next; or, create a new Facebook Pages credential for use in this flow.

  3. In Nexla, Facebook Pages data sources can be created using pre-built endpoint templates, which expedite source setup for common Facebook Pages endpoints. Each template is designed specifically for the corresponding Facebook Pages endpoint, making source configuration easy and efficient.
    • To configure this source using a template, follow the instructions in Configure Using a Template.

    Facebook Pages sources can also be configured manually, allowing you to ingest data from Facebook Pages endpoints not included in the pre-built templates or apply further customizations to exactly suit your needs.
    • To configure this source manually, follow the instructions in Configure Manually.

Configure Using a Template

Nexla provides pre-built templates that can be used to rapidly configure data sources to ingest data from common Facebook Pages endpoints. Each template is designed specifically for the corresponding Facebook Pages endpoint, making data source setup easy and efficient.

Endpoint Settings

  • Select the endpoint from which this source will fetch data from the Endpoint pulldown menu. Available endpoint templates are listed in the expandable boxes below. Click on an endpoint to see more information about it and how to configure your data source for this endpoint.

    Fetch Page Information

    This endpoint fetches information about a specific page. You can also use this endpoint to view the current page access token. Use this endpoint when you need to access page information, page data, or page attributes from your Facebook Pages account.

    • Enter the Page ID for which you want to fetch information in the Page ID field. This is the unique identifier of the Facebook page you want to fetch information for. The default value is 399554767050919 if not specified.

    • Enter the page attributes you want to fetch in the Page Attributes to Fetch field. This should be a comma-separated list of field names (e.g., id,about,name,description). Click on the documentation link to view all available fields. The default value is id,about if not specified.

    • Enter the Facebook API version in the API Version field. This is the Facebook API version to use for requests (e.g., v19.0). The default value is v19.0 if not specified.

    • The endpoint uses GET requests to https://graph.facebook.com/{api_version}/{page_id}?fields={fields} where {api_version} is the API Version, {page_id} is the Page ID, and {fields} is the Page Attributes to Fetch you provide. The endpoint URL is automatically constructed based on the Facebook Graph API base URL, the API version, the page ID, and the fields.
    • The endpoint does not use pagination and returns the complete page information in a single request.
    • The endpoint will return information for the specified page. The response data is extracted from the root-level object in the API response ($), and Nexla will process the entire response structure.

    Page IDs can be found in your Facebook Business Manager or from the page URL. The Page Attributes to Fetch should be a comma-separated list of field names. Click on the documentation link to view all available fields. You can also use this endpoint to view the current page access token. The endpoint uses a static URL (iteration.type: static.url) and does not require pagination. The response data path is $, which extracts the entire root-level object from the API response. For detailed information about fetching page information and available fields, see the Facebook Graph API documentation.

    Generate Page Access Token

    This endpoint generates a Page Access Token for accessing page information using Facebook APIs. For a system user, this is a forever token that has to be generated once. You can use this Nexla template for fetching the page access token and update the credential. Use this endpoint when you need to generate a page access token for a specific page.

    • Enter the Page ID for which you want to generate an access token in the Page ID field. This is the unique identifier of the Facebook page for which you want to generate an access token.

    • The endpoint uses GET requests to https://graph.facebook.com/{page_id}?fields=access_token where {page_id} is the Page ID you provide. The endpoint URL is automatically constructed based on the Facebook Graph API base URL and the page ID.
    • The endpoint does not use pagination and returns the page access token in a single request.
    • The endpoint will return the page access token for the specified page. The response data is extracted from the root-level object in the API response ($), and Nexla will process the entire response structure.

    Page IDs can be found in your Facebook Business Manager or from the page URL. For a system user, this is a forever token that has to be generated once. You can use this Nexla template for fetching the page access token and update the credential. The endpoint uses a static URL (iteration.type: static.url) and does not require pagination. The response data path is $, which extracts the entire root-level object from the API response. For detailed information about generating page access tokens, see the Facebook Pages API documentation.

    Fetch Page Insights

    This endpoint fetches insights for a Facebook Page. Click on documentation URL for available metrics and breakdowns. Use this endpoint when you need to access page performance metrics, analytics data, or insights information from your Facebook Pages account.

    • Enter the Page ID for which you want to fetch insights in the Page ID field. This is the unique identifier of the Facebook page for which you want to fetch insights. The default value is 399554767050919 if not specified.

    • Enter the metrics you want to fetch in the Metrics to Fetch field. This should be a comma-separated list of metric names (e.g., page_impressions_unique,page_views_total,page_engaged_users). Click on the documentation link to view all available metrics. The default value is page_impressions_unique,page_views_total,page_engaged_users if not specified.

    • Select the aggregation period from the Aggregation period dropdown menu. This is the period of aggregation for the metric. Available options are:

      • day: Daily aggregation (default)
      • week: Weekly aggregation
      • days_28: 28-day aggregation
      • month: Monthly aggregation
      • lifetime: Lifetime aggregation

      The default value is day if not specified.

    • Enter any other allowed request parameters in the Other Request Parameters field. This should be a comma-separated list of additional parameters for specifying date ranges and/or segmentation (e.g., &date_preset=yesterday). The default value is &date_preset=yesterday if not specified.

    • Enter the Facebook API version in the API Version field. This is the Facebook API version to use for requests (e.g., v19.0). The default value is v19.0 if not specified.

    • The endpoint uses GET requests to https://graph.facebook.com/{api_version}/{page_id}/insights?access_token={page_access_token}&metric={metric}&period={period}{other_params} where {api_version} is the API Version, {page_id} is the Page ID, {page_access_token} is the Page Access Token from the credential, {metric} is the Metrics to Fetch, {period} is the Aggregation period, and {other_params} is the Other Request Parameters you provide. The endpoint URL is automatically constructed based on the Facebook Graph API base URL and all the parameters.
    • The endpoint uses URL-based pagination, automatically fetching additional pages as needed. When a response includes a paging.next value, Nexla automatically uses it as the URL for the subsequent request to fetch the next page of results.
    • The endpoint will return insights for the specified page. The response data is extracted from the data array in the API response ($.data[*]), with each insight record processed individually.

    Page IDs can be found in your Facebook Business Manager or from the page URL. The Metrics to Fetch should be a comma-separated list of metric names. Click on the documentation link to view all available metrics and breakdowns. The Page Access Token from your credential is automatically included in the request. The endpoint uses URL-based pagination (iteration.type: paging.next.url) through the paging.next mechanism. The response data path is $.data[*], which extracts all items from the data array in the API response. For detailed information about fetching page insights, available metrics, and breakdowns, see the Facebook Graph API documentation.

Endpoint Testing

Once the selected endpoint template has been configured, Nexla can retrieve a sample of the data that will be fetched according to the current settings. This allows users to verify that the source is configured correctly before saving.

  • To test the current endpoint configuration, click the Test button to the right of the endpoint selection menu. Sample data will be fetched & displayed in the Endpoint Test Result panel on the right.

  • If the sample data is not as expected, review the selected endpoint and associated settings, and make any necessary adjustments. Then, click the Test button again, and check the sample data to ensure that the correct information is displayed.

Configure Manually

Facebook Pages data sources can be manually configured to ingest data from any valid Facebook Pages API endpoint. Manual configuration provides maximum flexibility for accessing endpoints not covered by pre-built templates or when you need custom API configurations.

With manual configuration, you can also create more complex Facebook Pages sources, such as sources that use chained API calls to fetch data from multiple endpoints or sources that require custom authentication headers or request parameters.

API Method

  1. To manually configure this source, select the Advanced tab at the top of the configuration screen.

  2. Select the API method that will be used for calls to the Facebook Pages API from the Method pulldown menu. The most common methods are:

    • GET: For retrieving data from the API
    • POST: For sending data to the API or triggering actions
    • PUT: For updating existing data
    • PATCH: For partial updates to existing data
    • DELETE: For removing data

API Endpoint URL

  1. Enter the URL of the Facebook Pages API endpoint from which this source will fetch data in the Set API URL field. This should be the complete URL including the protocol (https://) and any required path parameters. Facebook Pages API endpoints typically follow the pattern https://graph.facebook.com/{api_version}/{endpoint_path} where {api_version} is the Facebook API version (e.g., v19.0).

Ensure the API endpoint URL is correct and accessible with your current credentials. You can test the endpoint using the Test button after configuring the URL. The endpoint requires System User Access Token authentication via the Authorization: Bearer {token} header, which is handled automatically by your credential configuration. For certain page-specific operations, a Page Access Token may also be required. For detailed information about Facebook Pages API endpoints and available APIs, see the Facebook Pages API documentation.

Path to Data

  1. Enter the JSON path that identifies the location of the relevant data within the API response in the Path to Data field. JSON paths use dot notation to navigate through nested JSON structures.

    • For example, if your API response has the structure {"data": [...]}, you would enter $.data[*] to extract all items from the data array.
    • Use $[*] to extract all items from a root-level array.
    • Use $ to extract the entire root-level object.

JSON paths are case-sensitive and must match the exact structure of your API response. Facebook Pages API responses may use different structures like data arrays or root-level objects depending on the endpoint. Use the Test button to verify that your JSON path correctly extracts the desired data from the API response.

Save the Data Source

  1. Once all configuration steps have been completed, click the Save button to save your data source configuration.

  2. The data source will now be available in your data flow and will begin ingesting data according to the configured schedule and endpoint settings.