This API runs an Apify Instagram comment-scraper Actor and returns either run metadata, the Actor’s dataset items, or the Actor’s key-value OUTPUT. The three operations map to three distinct workflows: start-and-return-metadata (start a run and get its IDs), run-and-wait-for-dataset, and run-and-wait-for-key-value-output. Know which workflow the user wants before calling anything — the operations behave differently and return different kinds of data.
How the domain is organized
The domain is simple and centered on a single Actor run unit. Three result surfaces appear in responses and are the things you will use to fulfill user requests:
- Run metadata — identifiers and run-level state. This is what you get when you need to track or reference a run later (run id, status, and references to outputs).
- Dataset items — structured records the Actor writes to its dataset. Use this when you want a list/array of scraped comment records.
- Key-value OUTPUT — a single file or JSON stored in the Actor’s key-value store under the key
OUTPUT. Use this when the Actor produces a summary file, a single JSON blob, or a specific file the Actor documents asOUTPUT.
These three surfaces are separate: a run can produce both a dataset and a key-value OUTPUT. The operations expose each surface differently: one operation gives run metadata immediately, the other two execute the Actor and wait for completion returning either dataset items or the OUTPUT value.
Entry points — what to call first
Decide what the user wants to receive and call one of the operations below. Each operation requires the Apify token (token) and the Actor input (body):
-
If the user wants immediate run identifiers (to poll later or to show a run link), call
runs-sync-apify-instagram-comment-scraper. It starts the run and returns run metadata in its response. -
If the user asked for the scraped comments as structured records to include in the reply, call
run-sync-get-dataset-items-apify-instagram-comment-scraper. It executes the Actor, waits for completion, and returns the Actor’s dataset items in the response body. -
If the user asked for the Actor’s
OUTPUTentry (often a single JSON or file) — for example, a single consolidated JSON file — callrun-sync-apify-instagram-comment-scraper. It executes the Actor, waits for completion, and returns theOUTPUTfrom the key-value store in the response body.
Always confirm whether the user needs the run tracked (a run id) or wants the results in your reply. Use runs-sync-... when they need tracking; use run-sync-... when they want results immediately embedded in the response.
Typical user requests and how to fulfill them
When users ask common tasks, choose the matching entry point and ensure the Actor input (body) contains the target details the Actor expects (Instagram post URL or shortcode, limits, proxy settings if required, etc.). If required inputs are missing, ask the user for them before calling.
Common requests and the sequence to satisfy them:
-
"Scrape comments for this Instagram post and show them here": call
run-sync-get-dataset-items-apify-instagram-comment-scraperwith the Actor input containing the post URL/shortcode and any limits (max comments). Return the dataset items from the response body. -
"Run the scraper and give me the consolidated JSON file the Actor writes": call
run-sync-apify-instagram-comment-scraperwith the Actor input; return theOUTPUTvalue the operation returns. -
"Start a run and give me the run id so I can check later": call
runs-sync-apify-instagram-comment-scraper. Extract the run id / status / any dataset or key-value references from the returned run metadata and present them to the user. -
"Start a run but keep it private / use a proxy / limit to N comments": include the corresponding fields in the Actor input
body(the Actor defines the allowed fields). If the user does not specify required input fields (target post, credentials, or proxy preferences), prompt for those specifics.
What to inspect in responses
Responses differ by operation, so inspect these common places for actionable data:
-
Run metadata responses (from
runs-sync-apify-instagram-comment-scraper): look for a run identifier and any references to outputs (dataset id, key-value store keys). Those identifiers let you tie follow-up actions or report status. -
Dataset responses (from
run-sync-get-dataset-items-apify-instagram-comment-scraper): expect an array of items under the response body. Use that array directly as the scraped comments. If the returned array is empty, surface that to the user and consider whether the input targeted a valid post. -
Key-value
OUTPUTresponses (fromrun-sync-apify-instagram-comment-scraper): the response body will contain whatever the Actor stored underOUTPUT(commonly a JSON object or file contents). Treat it as the canonical single-file output the Actor produced.
If a response contains fields that look like dataset IDs or key names, those are the handles to reference the same outputs in other workflows or when reporting run details to the user.
Input expectations and clarifying questions to ask users
The body must conform to the Actor’s input schema. The operation signatures do not list the schema fields here, so when a user asks to run the scraper, ensure these minimal items are available or ask for them explicitly:
- The Instagram target: a post URL, shortcode, or profile identifier (ask which exact post/profile to scrape).
- Any limits: maximum number of comments to return, whether to include replies, date ranges, or language filters.
- Proxy/auth preferences: whether to use a proxy or APIFY_PROXY configuration (if the user’s environment or the Actor requires it).
- Output preference: whether the user wants dataset items (structured list) or the Actor’s
OUTPUTfile.
If a user asks vaguely ("scrape comments for this profile"), ask the single most important clarifier first: the exact post(s) or profile and the maximum number of comments desired.
Non-obvious behaviors and gotchas
-
Operation semantics differ by name:
runs-syncstarts and returns run metadata immediately;run-sync-*variants execute the Actor and wait for the run to complete before returning results. Don’t confuse the two when a user expects immediate result content versus a run id for tracking. -
The
tokenparameter is required and is passed as an operation argument (not inside the Actorbody). Provide a valid Apify token; missing or invalid tokens will prevent any run from starting. -
A single run can produce both dataset items and a key-value
OUTPUT. Choose the operation that returns the surface you need. If unsure which one the Actor writes, prefer asking the user whether they want a list of items or the consolidatedOUTPUTfile. -
Synchronous runs can take time. Very long or blocked runs may cause the synchronous call to take correspondingly longer; if the user wants only a run id to check later, prefer
runs-sync-apify-instagram-comment-scraperso the call returns promptly with metadata. -
If responses contain empty datasets or empty
OUTPUT, this can mean: the Actor ran but found no comments for the provided target, the target was invalid/restricted, or the Actor failed to access the target (rate-limited or blocked). Surface the empty result and ask the user whether to retry with different input (proxy, credentials, broader target). -
Do not assume field names in the Actor input. The Actor defines the exact input schema. When the user cannot provide structured input, ask them to describe the post/profile and desired limits; translate their answers into the Actor
bodyonly if the required field names are known or documented.
Minimal call patterns (what to call for common intents)
-
Provide scraped comments inline in the assistant reply:
run-sync-get-dataset-items-apify-instagram-comment-scraperwithtokenandbodycontaining the target and options. -
Provide the Actor’s single-file result (e.g., consolidated JSON):
run-sync-apify-instagram-comment-scraperwithtokenandbody. -
Start a run and return identifiers for later checking:
runs-sync-apify-instagram-comment-scraperwithtokenandbody.
Final guidance on interactions
When the user asks to run this scraper, first clarify the target and output preference. Choose the operation that exactly matches the requested outcome (metadata vs dataset vs key-value OUTPUT). Provide the Apify token in the token argument and include the Actor input in body. After the call, inspect the returned run id, dataset items, or OUTPUT contents and report those to the user, or ask follow-up questions if results are empty or ambiguous.