Search + K

Command Palette

Search for a command to run...

Sign In

The actor bundle exposes three focused ways to run the Facebook posts scraper and get results: two synchronous runners that wait for the actor to finish and return results, and one that starts a run and returns run metadata. Each call requires the caller’s Apify token (a top-level argument) and an InputSchema body that controls what the scraper does. Inspect InputSchema before calling to see the fields for target pages/profiles, limits, credentials, and other options.

Core concepts and how resources relate

  • An Actor run produces two common result containers: a dataset (an array of items) and a key-value store (named keys, often OUTPUT). Which container the scraper writes to depends on the Actor’s implementation and input options. The three operations expose either the dataset items or the key-value OUTPUT, or return run metadata that references those stores.

  • Every operation takes a top-level token and a body matching the InputSchema. Provide the Apify token with every call; it is not bundled inside the body.

  • The synchronous runners block until the Actor run completes (or the service returns whatever it can). The metadata runner returns a run record immediately with identifiers and status that point to the run, dataset, and key-value store.

Entry points — which operation to call first

Choose an entry point by the result you need:

  • If the user asks for scraped posts as dataset items (an array), call run-sync-get-dataset-items-apify-facebook-posts-scraper. This is the most direct way to get items in a single call: pass the token and the InputSchema that specifies targets/limits.

  • If the user expects the scraper to return a single JSON payload in the key-value store (commonly under the OUTPUT key), call run-sync-apify-facebook-posts-scraper. The response body contains whatever was stored under the key-value store by the Actor.

  • If the user only wants to start a run and get run metadata (run id, status, references to dataset or key-value store) — for example to track progress or share the run id — call runs-sync-apify-facebook-posts-scraper. The response body contains the run record; inspect it for id, timestamps, and references such as datasetId or keyValueStoreId.

Always inspect the returned status field and the body payload: status describes run outcome or state, and body contains the run metadata, dataset items, or key-value output depending on which operation was used.

Common user tasks and the exact pattern to follow

Scrape and return posts immediately as dataset items

  • Use run-sync-get-dataset-items-apify-facebook-posts-scraper with your token and an InputSchema that specifies the target page/profile and any limits (date range, max items, filters).
  • Inspect the response status to confirm completion and body for the array of items. If body is not an array, inspect it for nested fields that hold items (the Actor’s schema can vary).

Scrape and return the key-value OUTPUT JSON

  • Use run-sync-apify-facebook-posts-scraper with token and InputSchema.
  • Inspect body for the stored OUTPUT object (Actor implementations commonly place exported JSON under that key). If the expected object is missing, check the run metadata (see next pattern) to find the key-value store id.

Start a run and get run metadata

  • Use runs-sync-apify-facebook-posts-scraper with token and InputSchema.
  • Inspect the returned run record in body for id, createdAt, status, and references such as datasetId or keyValueStoreId. Use those identifiers to locate results in subsequent operations or in downstream systems that accept those IDs.

When to prefer metadata over synchronous results

  • Start a run (use runs-sync-...) when the user needs a run id to track, share, or inspect later, or when the run might be long and the caller prefers to poll or query separate systems for results. Use the synchronous runners when the user wants immediate results in a single call.

Practical checks before calling

Before invoking any operation, confirm these three things in the request:

  • token is present at the top level of the arguments.
  • InputSchema includes the required targeting/auth fields for the scraper (profile/page identifiers, session/auth fields if the scraper needs authenticated access, and result limits). The exact field names live in the operation’s input schema.
  • Decide whether you need dataset items, key-value OUTPUT, or only run metadata — pick the corresponding operation above.

Response handling notes and gotchas

  • body is typed as unknown for the two result-returning operations. Do not assume a single shape. Inspect the top-level structure in the response: it may be an array of items, an object with an items or data property, or the raw OUTPUT object. Treat the response as data to be examined rather than relying on fixed keys.

  • status is the canonical quick check for run outcome. If status shows the run failed or was interrupted, the body may be partial or empty.

  • The synchronous calls wait for completion. If a scrape takes a long time, the call will block until the Actor finishes or the service decides otherwise. If a user expects a quick reply but the scraping target is large, prefer starting a run and returning metadata.

  • The Actor may require credentials or session information (cookies, tokens) inside InputSchema to successfully scrape Facebook pages that are not public. Check InputSchema for auth-related fields and populate them when the user provides credentials.

  • The run metadata returned by runs-sync-apify-facebook-posts-scraper is the place to find run identifiers (id, datasetId, keyValueStoreId) that persistent systems or follow-up requests might need. If the immediate synchronous result is missing expected data, examine the run record for those identifiers.

Minimal decision checklist

When a user asks to scrape Facebook posts, follow this decision path:

  1. Do they want the items returned immediately? If yes, call run-sync-get-dataset-items-apify-facebook-posts-scraper.
  2. Do they want the scraper’s exported JSON (single file/object) from key-value storage? If yes, call run-sync-apify-facebook-posts-scraper.
  3. Do they only want to start a run and get its id/status? If yes, call runs-sync-apify-facebook-posts-scraper.

Always pass token and populate InputSchema fields for targets, limits, and any required auth. After the call, inspect status then inspect body to extract items, OUTPUT, or run identifiers as needed.