Skip to navigation

Which product-launch Reel questions have answers, and how do I check their replies?

To find which questions under a product-launch Reel already have answers, fetch the Reel’s top-level comments with instagram.fetch_post_comments_v2, passing the Reel’s numeric media pk as media_id, and export the comments to comments.csv. Shortlist the questions about accessories, cleaning or cup types. For each shortlisted question, fetch the replies with instagram.fetch_comment_replies, using the question’s comment ID as the parent. Then mark each question as answered, needs_context or no_answer_observed in this review.

For example, when a viewer asks “Can I use a short cup?”, keep the quote and the Reel link. When a reply mentions a height limit, pair the reply with the question and check the height limit against the product documentation.

Move one question toward an action

  1. Confirm the Reel. Reuse the media ID from the saved post details, as described in the post-to-comment handoff.
  2. Save the root comments. Review the chosen pages of comments.csv and select the product-use questions, keeping each question’s original wording beside your summary.
  3. Retrieve replies for selected questions. A reply preview under a root comment does not show the whole thread. When a question needs context, prepare a reply request for the question’s root comment and save the reply branch in its own folder.
  4. Check whether a reply answers the question. Read the question and the returned replies. Support each decision in resolution.json with an actual reply ID and a verbatim excerpt.
  5. Hand off the follow-up work. For each question, state what needs checking and who should handle the check. Creating resolution.json does not reply to viewers or close any issue.

To hand the review to an assistant connected to BeatAPI, use a prompt like:

Review accessory and cleaning questions on this launch Reel. Preserve original wording and read selected reply threads when context is needed. Separate answers supported by replies, questions needing more context and questions with no answer observed in this collection, with next actions.

Read the deliverables

OutputUse
comments.csvOne row per observed root comment ID, with the comment text and its source request
replies.csvThe observed replies to one selected root comment
coverage.json in each output folderThe Reel and root comment, saved pages, counts and stop reason
resolution.jsonThe manual decision, the supporting reply excerpt and any missing context

answered requires a saved reply whose text supports the answer. needs_context means the saved replies are not enough to decide. no_answer_observed describes only the saved sample. Check every answer against the product information before you use the answer.

Steps 1–7 below cover retrieval, export, replies and review. The Python scripts only process saved files; each save_call.sh run makes one data request. Reuse saved responses when available.

1. Start with the media ID and a page budget

Use the original numeric-string pk from the saved post detail that matches the Reel’s shortcode, not the URL shortcode and not the generic id column of the snapshot CSV. The URL-to-comments handoff reads data.data.pk for v2 or the matching data.items[].pk for v3 and builds the complete first-page request. Reuse the post detail saved in the post-snapshot guide instead of paying for another conversion. Record in your request log which Reel the media ID belongs to: the comment response does not identify the Reel on its own.

Request root comments with data:instagram.fetch_post_comments_v2; current rates are on the pricing page. Decide how many pages to buy, and count root-comment requests, selected-reply requests and optional detail requests separately. Row counts come from the actual responses; the local export makes no requests.

2. Save the first page and its request log

Write request-1.json with your verified numeric media ID in place of the sample ID:

{"action":"instagram.fetch_post_comments_v2","params":{"media_id":"3766120364183949816","sort_order":"recent"}}

Save the following script as save_call.sh, then run bash save_call.sh request-1.json root-call-1 once per page within your approved page budget. Each run sends one paid request and does not retry; curl -q ignores local curlrc retry and redirect settings. The output folder must not exist yet.

set -eu
request="$1"
folder="$2"
test -f "$request"
: "${BEATAPI_API_KEY:?Set BEATAPI_API_KEY locally}"
mkdir "$folder"
cp "$request" "$folder/request.json"
date -u +'%Y-%m-%dT%H:%M:%SZ' > "$folder/collected-at.txt"
curl -q --fail-with-body -sS https://api.beatapi.io/v1/social-data/call \
-H "Authorization: Bearer $BEATAPI_API_KEY" \
-H 'Content-Type: application/json' \
--data-binary "@$folder/request.json" \
-D "$folder/headers.txt" -o "$folder/response.json" \
-w '%{http_code}\n' > "$folder/http-status.txt"
python3 - "$folder" <<'PYTHON'
import json,pathlib,sys
p=pathlib.Path(sys.argv[1]);request=json.loads((p/'request.json').read_text())
status=int((p/'http-status.txt').read_text().strip())
if status!=200:raise ValueError('Stop and inspect the failed call')
entry={'action':request['action'],'params':request['params'],'http_status':status,
'collected_at':(p/'collected-at.txt').read_text().strip(),
'response_file':str((p/'response.json').resolve())}
(p/'entry.json').write_text(json.dumps(entry,ensure_ascii=False,indent=2),encoding='utf-8')
PYTHON

save_call.sh keeps the exact submitted request, the response headers and body, the local UTC request-start time and the HTTP status. save_call.sh writes entry.json only after HTTP 200, and instagram_comments.py still checks the response envelope. Copy each generated entry.json object into the pages.json array. The example below illustrates the expected pages.json format. If curl, the network or HTTP fails, stop and keep the folder; do not run save_call.sh into the same folder again. Never put authorization headers in the log.

[{"action":"instagram.fetch_post_comments_v2","params":{"media_id":"3766120364183949816","sort_order":"recent"},"http_status":200,"collected_at":"2026-11-16T18:00:00Z","response_file":"root-call-1/response.json"}]

3. Export saved pages and prepare the next request

Save the following script as instagram_comments.py. The script reads direct /v1/social-data/call JSON, not a trimmed MCP preview. A relative response_file path resolves against the folder of pages.json; save_call.sh already records an absolute path. The script checks that all pages share one media ID and one explicit sort order, that collection times carry a timezone and run in order, and that the cursor chain is unbroken. A response without data.comments stops the export instead of passing as an empty page. comments.csv keeps the first observation of each root comment; the raw pages keep later variants unchanged. Replies are never added to root comment counts.

import csv, hashlib, json, pathlib, sys
from datetime import datetime
manifest_file, target = map(pathlib.Path, sys.argv[1:3])
entries = json.loads(manifest_file.read_text(encoding="utf-8"))
ACTION = "instagram.fetch_post_comments_v2"
if not isinstance(entries, list) or not 1 <= len(entries) <= 10:
raise ValueError("Supply 1–10 ordered saved pages; this is the helper's cap")
rows, previews, evidence, seen, cursors, requests = [], [], [], set(), set(), set()
raw_pages = []
expected, media, sort, previous_time = None, None, None, None
stop = "saved_pages_exhausted"
def ident(v):
if type(v) is int and v > 9007199254740991:
raise ValueError("Unsafe numeric ID; require an originally string-encoded ID")
if isinstance(v, bool) or not isinstance(v, (str, int)) or not str(v).isascii() or not str(v).isdigit() or not any(c != "0" for c in str(v)):
raise ValueError("Expected a decimal ID")
return str(v)
def safe(v):
if v is None:
return ""
if not isinstance(v, (str, int, float, bool)):
raise ValueError("Unexpected structured CSV field")
s = str(v)
return "'" + s if s.startswith(("=", "+", "-", "@", "\t", "\r", "\n")) else s
def scalar(v):
if v is not None and (isinstance(v, bool) or not isinstance(v, (str, int))):
raise ValueError("Unexpected count/timestamp type")
if type(v) is int and abs(v) > 9007199254740991:
raise ValueError("Unsafe numeric timestamp; retain original evidence")
return v
def count(v):
if v is None:
return None
if type(v) is int and 0 <= v <= 9007199254740991:
return v
if isinstance(v, str) and v.isascii() and v.isdigit():
return v
raise ValueError("Expected a nonnegative safe integer or original digit string count")
for index, entry in enumerate(entries):
if stop != "saved_pages_exhausted":
raise ValueError("Manifest continues after a terminal page")
if type(entry.get("http_status")) is not int or not 100 <= entry["http_status"] <= 599:
raise ValueError("HTTP status must be an integer from the actual request")
params = entry["params"]
if entry["action"] != ACTION or set(params) - {"media_id", "sort_order", "min_id"}:
raise ValueError("Wrong action or unknown parameters")
current_media, current_sort = ident(params["media_id"]), params["sort_order"]
if current_sort not in ("recent", "popular"):
raise ValueError("Set recent or popular explicitly")
stamp = datetime.fromisoformat(entry["collected_at"].replace("Z", "+00:00"))
if stamp.tzinfo is None or previous_time and stamp < previous_time:
raise ValueError("Use chronological timezone-aware collection times")
previous_time = stamp
if index == 0:
media, sort = current_media, current_sort
if "min_id" in params:
raise ValueError("First page must omit min_id")
elif (current_media, current_sort) != (media, sort) or params.get("min_id") != expected:
raise ValueError("Mixed target, sort, or broken cursor chain")
source = manifest_file.parent / entry["response_file"]
raw = source.read_bytes()
raw_pages.append(raw)
response = json.loads(raw)
ev = {"page": index + 1, "source": str(source), "sha256": hashlib.sha256(raw).hexdigest(),
"collected_at": entry["collected_at"], "params": params, "http_status": entry["http_status"]}
evidence.append(ev)
if entry["http_status"] != 200:
error = response.get("error", {})
if not isinstance(error, dict) or not isinstance(error.get("code"), str) or not error["code"]:
raise ValueError("Non-200 entry requires a gateway error envelope")
ev.update(request_id=error.get("request_id"), error_code=error.get("code"))
stop = "gateway_failed"
continue
if response.get("status") != "succeeded" or response.get("action") != ACTION or response.get("error") is not None:
raise ValueError("Saved response is not the requested successful action")
request = response.get("request_id")
if not isinstance(request, str) or not request.strip() or request in requests:
raise ValueError("Missing/reused request ID")
requests.add(request)
ev["request_id"] = request
data = response.get("data")
if not isinstance(data, dict) or not isinstance(data.get("comments"), list):
raise ValueError("Expected data.comments, not an empty-result fallback")
page_ids = []
for comment in data["comments"]:
cid = ident(comment["pk"])
page_ids.append(cid)
if not isinstance(comment.get("text"), str):
raise ValueError("Expected comment text")
children = comment.get("preview_child_comments")
if children is not None and not isinstance(children, list):
raise ValueError("Unexpected preview container")
if children:
previews.append({"media_id": media, "root_comment_id": cid, "request_id": request,
"preview_child_comments": children})
likes = count(comment.get("comment_like_count"))
reply_count = count(comment.get("child_comment_count"))
created = scalar(comment.get("created_at"))
created_utc = scalar(comment.get("created_at_utc"))
if cid in seen:
continue
seen.add(cid)
rows.append({"media_id": media, "comment_id": cid, "text": comment["text"],
"likes": likes,
"created_at_raw": created,
"created_at_utc_raw": created_utc,
"reported_reply_count": reply_count,
"preview_objects": len(children) if children is not None else None,
"request_id": request, "collected_at": entry["collected_at"], "source_page": index + 1})
ev.update(returned_root_objects=len(page_ids), reported_comment_count=count(data.get("comment_count")))
more, cursor = data.get("has_more_headload_comments"), data.get("next_min_id")
if not isinstance(more, bool):
stop = "missing_more_flag"
elif not more:
stop = "provider_end"
elif not page_ids:
stop = "empty_page_with_more"
elif not isinstance(cursor, str) or not cursor:
stop = "missing_cursor"
elif cursor in cursors:
stop = "repeated_cursor"
else:
cursors.add(cursor)
expected = cursor
next_request = {"action": ACTION, "params": {"media_id": media, "sort_order": sort, "min_id": expected}} if stop == "saved_pages_exhausted" and len(entries) < 10 else None
if stop == "saved_pages_exhausted" and len(entries) == 10:
stop = "helper_page_cap"
target.mkdir(exist_ok=False)
columns = ["media_id", "comment_id", "text", "likes", "created_at_raw", "created_at_utc_raw", "reported_reply_count", "preview_objects", "request_id", "collected_at", "source_page"]
with (target / "comments.csv").open("x", encoding="utf-8-sig", newline="") as f:
writer = csv.DictWriter(f, fieldnames=columns)
writer.writeheader()
writer.writerows({k: safe(v) for k, v in row.items()} for row in rows)
with (target / "reply-previews.jsonl").open("x", encoding="utf-8") as f:
for item in previews:
f.write(json.dumps(item, ensure_ascii=False) + "\n")
for index, raw in enumerate(raw_pages):
(target / ("raw-page-%02d.json" % (index + 1))).write_bytes(raw)
report = {"media_id": media, "sort_order": sort, "unique_root_comments": len(rows),
"stop_reason": stop, "all_comments_collected": False, "reply_coverage": "previews_only",
"duplicate_policy": "first_observation_csv_all_observations_raw", "pages": evidence}
(target / "coverage.json").write_text(json.dumps(report, ensure_ascii=False, indent=2), encoding="utf-8")
if next_request:
(target / "next-request.json").write_text(json.dumps(next_request, ensure_ascii=False, indent=2), encoding="utf-8")
print(json.dumps({"roots": len(rows), "stop": stop, "next_request_prepared": bool(next_request)}))

4. Continue only within your budget

Run python3 instagram_comments.py pages.json review-1. If review-1/next-request.json exists, the file carries the previous page’s next_min_id as the next min_id, byte-for-byte as a string. Do not parse and rewrite next-request.json, do not change its escaping by hand, and do not reuse the file with another media ID or sort order. To buy the next page, run bash save_call.sh review-1/next-request.json root-call-2. Append root-call-2/entry.json as another object in the pages.json array, then export into a new folder such as review-2. Do not edit a saved request or rebuild a cursor by hand, and never append a page after a terminal page.

Stop when you reach your budget or when the export reports provider_end, an empty page with more=true, a repeated or missing cursor, a missing boolean more flag, or a gateway failure. For each stop condition, instagram_comments.py writes no next-request.json. A missing field is a schema discrepancy to report, not zero comments: keep the response and its request ID for support, and do not automatically try another paid endpoint. A successful empty comments: [] with more=false produces a header-only CSV and records the end state.

5. Deliver the evidence, not “all comments”

comments.csv has one row per observed root comment ID with the original text (escaped against spreadsheet formulas), likes, raw timestamps, reported reply count, preview object count, request ID and collection time. In Excel, import the media and comment IDs as text to avoid precision loss. Zero stays zero and missing values stay blank. Raw timestamps are not converted to an assumed timezone or unit. Usernames and profile images are left out of the sheet on purpose.

reply-previews.jsonl keeps the documented preview objects under the root comment they appeared under; the file adds no inner reply fields and does not represent a full thread. coverage.json records every page, the page hash, the reported total and the stop reason; raw-page-*.json holds the original bytes. All of these source files can contain personal data, so limit access and share a separately redacted copy. The provider’s reported total does not promise how many comments can be retrieved, and provider_end does not show that deleted, hidden or private comments were captured.

For launch feedback, label the rows of comments.csv by hand with decision, topic and an exact source quote. Exclude promotions and duplicates with a reason, and report the number of reviewed and unreviewed root comments and the number of Reels. Count complaints within the reviewed sample only; the count does not measure customers, purchases, prevalence or product defects. Check any quote that begins with a formula character against the raw JSON, not the escaped CSV cell. Read the reply coverage answer before promising anything about replies.

Evidence and scope

The Comments V2 response carries comment IDs, text, counts, timestamps and cursor fields under data. Check the data field paths in a saved response before exporting a new batch, and replace the placeholder IDs and timestamps in the examples with your verified request values.

6. Expand one selected root into a reply evidence sheet

When a root comment contains an unresolved product question, take the root comment’s comment_id from comments.csv. Keep the root export folder unchanged: instagram_replies.py checks the root page’s source hash, the request ID and the presence of the root comment before accepting reply pages. Preview objects are not merged into the reply count.

Request replies with data:instagram.fetch_comment_replies, passing the same media ID and the selected root comment’s pk as comment_id. Save each root comment’s replies as a separate branch, and estimate the cost of the pages you choose with the current pricing.

Save the first reply request as reply-request-1.json, with your selected media ID and root comment ID in place of the sample IDs. Run bash save_call.sh reply-request-1.json reply-call-1, then put reply-call-1/entry.json into the reply-pages.json array:

{"action":"instagram.fetch_comment_replies","params":{"media_id":"3766120364183949816","comment_id":"17871667485468098"}}
[{"action":"instagram.fetch_comment_replies","params":{"media_id":"3766120364183949816","comment_id":"17871667485468098"},"http_status":200,"collected_at":"2026-11-16T18:10:00Z","response_file":"reply-call-1/response.json"}]

Replace the placeholder IDs and timestamps above with your actual request values. Save the following script as instagram_replies.py, then run python3 instagram_replies.py review-2 reply-pages.json replies-1, with your actual root export folder in place of review-2.

import csv, hashlib, json, pathlib, sys
from datetime import datetime
root_export, manifest_file, target = map(pathlib.Path, sys.argv[1:4])
root_report = json.loads((root_export / "coverage.json").read_text(encoding="utf-8"))
with (root_export / "comments.csv").open(encoding="utf-8-sig", newline="") as f:
root_rows = list(csv.DictReader(f))
entries = json.loads(manifest_file.read_text(encoding="utf-8"))
ACTION = "instagram.fetch_comment_replies"
if not isinstance(entries, list) or not 1 <= len(entries) <= 10:
raise ValueError("Supply 1–10 ordered saved pages; this is the helper's cap")
rows, previews, evidence, seen, cursors, requests = [], [], [], set(), set(), set()
raw_pages = []
expected, media, root_id, previous_time = None, None, None, None
stop = "saved_pages_exhausted"
def ident(v):
if type(v) is int and v > 9007199254740991:
raise ValueError("Unsafe numeric ID; require an originally string-encoded ID")
if isinstance(v, bool) or not isinstance(v, (str, int)) or not str(v).isascii() or not str(v).isdigit() or not any(c != "0" for c in str(v)):
raise ValueError("Expected a decimal ID")
return str(v)
def safe(v):
if v is None:
return ""
if not isinstance(v, (str, int, float, bool)):
raise ValueError("Unexpected structured CSV field")
s = str(v)
return "'" + s if s.startswith(("=", "+", "-", "@", "\t", "\r", "\n")) else s
def scalar(v):
if v is not None and (isinstance(v, bool) or not isinstance(v, (str, int))):
raise ValueError("Unexpected count/timestamp type")
if type(v) is int and abs(v) > 9007199254740991:
raise ValueError("Unsafe numeric timestamp; retain original evidence")
return v
def count(v):
if v is None:
return None
if type(v) is int and 0 <= v <= 9007199254740991:
return v
if isinstance(v, str) and v.isascii() and v.isdigit():
return v
raise ValueError("Expected a nonnegative safe integer or original digit string count")
for index, entry in enumerate(entries):
if stop != "saved_pages_exhausted":
raise ValueError("Manifest continues after a terminal page")
if type(entry.get("http_status")) is not int or not 100 <= entry["http_status"] <= 599:
raise ValueError("HTTP status must be an integer from the actual request")
params = entry["params"]
if entry["action"] != ACTION or set(params) - {"media_id", "comment_id", "min_id"}:
raise ValueError("Wrong action or unknown parameters")
current_media, current_root = ident(params["media_id"]), ident(params["comment_id"])
stamp = datetime.fromisoformat(entry["collected_at"].replace("Z", "+00:00"))
if stamp.tzinfo is None or previous_time and stamp < previous_time:
raise ValueError("Use chronological timezone-aware collection times")
previous_time = stamp
if index == 0:
media, root_id = current_media, current_root
matches = [row for row in root_rows if row["media_id"] == media and row["comment_id"] == root_id]
if len(matches) != 1 or root_report["media_id"] != media:
raise ValueError("Select one observed root from the previous export")
root_row = matches[0]
page_number = int(root_row["source_page"])
root_raw = (root_export / ("raw-page-%02d.json" % page_number)).read_bytes()
root_page = root_report["pages"][page_number - 1]
if hashlib.sha256(root_raw).hexdigest() != root_page["sha256"]:
raise ValueError("Root source hash mismatch")
root_response = json.loads(root_raw)
if root_response.get("action") != "instagram.fetch_post_comments_v2" or root_response.get("status") != "succeeded" or root_response.get("request_id") != root_row["request_id"] or root_response.get("error") is not None:
raise ValueError("Invalid root source identity")
if str(root_page["params"]["media_id"]) != media or not any(ident(x["pk"]) == root_id for x in root_response["data"]["comments"]):
raise ValueError("Root does not belong to the saved request")
if "min_id" in params:
raise ValueError("First page must omit min_id")
elif (current_media, current_root) != (media, root_id) or params.get("min_id") != expected:
raise ValueError("Mixed media/root or broken cursor chain")
source = manifest_file.parent / entry["response_file"]
raw = source.read_bytes()
raw_pages.append(raw)
response = json.loads(raw)
ev = {"page": index + 1, "source": str(source), "sha256": hashlib.sha256(raw).hexdigest(),
"collected_at": entry["collected_at"], "params": params, "http_status": entry["http_status"]}
evidence.append(ev)
if entry["http_status"] != 200:
error = response.get("error", {})
if not isinstance(error, dict) or not isinstance(error.get("code"), str) or not error["code"]:
raise ValueError("Non-200 entry requires a gateway error envelope")
ev.update(request_id=error.get("request_id"), error_code=error.get("code"))
stop = "gateway_failed"
continue
if response.get("status") != "succeeded" or response.get("action") != ACTION or response.get("error") is not None:
raise ValueError("Saved response is not the requested successful action")
request = response.get("request_id")
if not isinstance(request, str) or not request.strip() or request in requests:
raise ValueError("Missing/reused request ID")
requests.add(request)
ev["request_id"] = request
data = response.get("data")
if not isinstance(data, dict) or not isinstance(data.get("child_comments"), list):
raise ValueError("Expected data.child_comments, not an empty-result fallback")
page_ids = []
for comment in data["child_comments"]:
cid = ident(comment["pk"])
page_ids.append(cid)
if not isinstance(comment.get("text"), str):
raise ValueError("Expected comment text")
parent_id = ident(comment["parent_comment_id"])
likes = count(comment.get("comment_like_count"))
created = scalar(comment.get("created_at"))
created_utc = scalar(comment.get("created_at_utc"))
if cid in seen:
continue
seen.add(cid)
rows.append({"media_id": media, "requested_root_id": root_id, "reply_id": cid, "parent_comment_id": parent_id, "text": comment["text"],
"likes": likes,
"created_at_raw": created,
"created_at_utc_raw": created_utc,
"request_id": request, "collected_at": entry["collected_at"], "source_page": index + 1})
ev.update(returned_reply_objects=len(page_ids), reported_reply_count=count(data.get("child_comment_count")))
page_info = data.get("page_info")
more = data.get("has_more_tail_child_comments")
cursor = page_info.get("next_min_id") if isinstance(page_info, dict) else None
if not isinstance(more, bool):
stop = "missing_more_flag"
elif not more:
stop = "provider_end"
elif not page_ids:
stop = "empty_page_with_more"
elif not isinstance(cursor, str) or not cursor:
stop = "missing_cursor"
elif cursor in cursors:
stop = "repeated_cursor"
else:
cursors.add(cursor)
expected = cursor
next_request = {"action": ACTION, "params": {"media_id": media, "comment_id": root_id, "min_id": expected}} if stop == "saved_pages_exhausted" and len(entries) < 10 else None
if stop == "saved_pages_exhausted" and len(entries) == 10:
stop = "helper_page_cap"
target.mkdir(exist_ok=False)
columns = ["media_id", "requested_root_id", "reply_id", "parent_comment_id", "text", "likes", "created_at_raw", "created_at_utc_raw", "request_id", "collected_at", "source_page"]
with (target / "replies.csv").open("x", encoding="utf-8-sig", newline="") as f:
writer = csv.DictWriter(f, fieldnames=columns)
writer.writeheader()
writer.writerows({k: safe(v) for k, v in row.items()} for row in rows)
for index, raw in enumerate(raw_pages):
(target / ("raw-page-%02d.json" % (index + 1))).write_bytes(raw)
report = {"media_id": media, "requested_root_id": root_id, "unique_replies": len(rows),
"root_request_id": root_row["request_id"], "root_sha256": root_page["sha256"],
"stop_reason": stop, "all_replies_collected": False, "reply_coverage": "saved_reply_pages",
"duplicate_policy": "first_observation_csv_all_observations_raw", "pages": evidence}
(target / "coverage.json").write_text(json.dumps(report, ensure_ascii=False, indent=2), encoding="utf-8")
if next_request:
(target / "next-request.json").write_text(json.dumps(next_request, ensure_ascii=False, indent=2), encoding="utf-8")
print(json.dumps({"replies": len(rows), "stop": stop, "next_request_prepared": bool(next_request)}))

replies.csv keeps requested_root_id separate from each returned parent_comment_id, because a reply’s immediate parent is not always the requested root comment. Each row keeps the original reply ID, text, likes and raw timestamps. coverage.json records the root page’s source hash and the reply pages retrieved for the root comment. Keep both the root export folder and the reply folder for review.

Reply pagination continues with data.page_info.next_min_id. Although next_min_child_cursor may also appear in response metadata, instagram_replies.py does not substitute next_min_child_cursor because the two fields are not interchangeable. If more is true but data.page_info.next_min_id is missing, the script stops with missing_cursor; keep the response for investigation. Otherwise next-request.json holds the same media ID, root comment ID and cursor for the next paid request. As with root pages, append the actual request log and export into a new folder.

Review each question with the root comment text and replies.csv, and record a manual resolution of answered, needs_context or no_answer_observed with the supporting reply ID and an exact quote. provider_end describes pagination only; provider_end does not show that no hidden or deleted replies exist. No message is sent to commenters.

Identifier precision prerequisite

Unquoted JSON numbers above 9007199254740991 can lose precision when decoded as float64 before reaching the Python scripts. The scripts therefore reject unquoted numeric IDs above 9007199254740991, while IDs originally encoded as strings stay exact. Do not “fix” a rejected numeric ID by wrapping the rounded value in quotes: stop the export and keep the request ID for investigation. Python’s large integers and spreadsheet text formatting cannot restore precision already lost in a rounded number.

Check every observation before deduplication

Both exporters validate counts, timestamps and returned parent IDs before skipping a repeated ID, so a malformed later copy of a comment cannot disappear just because the same ID appeared on an earlier page. Valid changed values still follow the first-observation policy of the CSV; the raw pages keep every observation, so the CSV is not a latest-state merge. Counts accept zero, safe nonnegative integers and original ASCII digit strings; negative, abbreviated, boolean or unsafe numeric values stop the export. Missing counts stay blank. A success envelope that also carries an error is rejected.

7. Finish one question with an auditable manual resolution

replies.csv alone is not a product-support conclusion. For one selected root comment, read the root comment and its saved replies, then record a manual decision. Use answered only with a saved reply ID and an exact supporting passage. needs_context means the saved evidence is insufficient. no_answer_observed means you found no answer in the saved sample, not that nobody ever answered.

Save review.json with your actual root comment ID and reply ID. The example below illustrates the expected review.json format:

{"root_id":"11","decision":"answered","reply_id":"22","quote":"Open Settings","reviewer_note":"This reply gives the setup step asked about; the claim still needs product-owner review."}

For no_answer_observed, omit reply_id and quote, and list the pages you reviewed in reviewer_note. For needs_context, attach a matching quote when one helps, or omit both evidence fields. resolve_question.py checks that the evidence links to a saved reply; the script does not judge whether the reply is correct or helpful.

Save the following script as resolve_question.py and run python3 resolve_question.py review-2 replies-1 review.json question-review, with your actual root and reply export folders. The output resolution.json contains the selected root comment, the manual judgment, the exact quote with its source, the observed reply count and the collection stop reason. review-input.json keeps the original manual input. The script makes no API request and sends no reply.

import hashlib,json,pathlib,sys
roots,replies,review_path,out=map(pathlib.Path,sys.argv[1:5])
root_report=json.loads((roots/'coverage.json').read_text())
report=json.loads((replies/'coverage.json').read_text())
review_bytes=review_path.read_bytes();review=json.loads(review_bytes)
if not isinstance(review,dict):raise ValueError('Review must be an object')
for archive in (root_report,report):
if not isinstance(archive,dict) or not isinstance(archive.get('pages'),list) or not 1<=len(archive['pages'])<=10:raise ValueError('Expected a bounded saved export')
def ident(x):
if type(x) is int and 0 < x <= 9007199254740991:return str(x)
if isinstance(x,str) and x.isascii() and x.isdigit() and any(c!='0' for c in x):return x
raise ValueError('Expected an exact positive ID')
def load_page(folder,number,meta,action):
raw=(folder/('raw-page-%02d.json'%number)).read_bytes()
if hashlib.sha256(raw).hexdigest()!=meta.get('sha256'):raise ValueError('Changed source bytes')
value=json.loads(raw)
if not isinstance(value,dict) or value.get('action')!=action or value.get('status')!='succeeded' or value.get('error') is not None or value.get('request_id')!=meta.get('request_id') or not isinstance(value.get('request_id'),str) or not value['request_id'].strip():raise ValueError('Invalid saved response identity')
return value
media=ident(report['media_id']);root_id=ident(report['requested_root_id'])
if ident(root_report['media_id'])!=media or ident(review['root_id'])!=root_id:raise ValueError('Mixed media/root')
root_matches=[]
for n,meta in enumerate(root_report['pages'],1):
if meta.get('request_id')!=report.get('root_request_id'):continue
value=load_page(roots,n,meta,'instagram.fetch_post_comments_v2')
if ident(meta['params']['media_id'])!=media or meta['sha256']!=report.get('root_sha256'):raise ValueError('Wrong root source')
for item in value['data']['comments']:
if ident(item['pk'])==root_id:root_matches.append(item)
if not root_matches or not isinstance(root_matches[0].get('text'),str):raise ValueError('Missing root text')
if any(item.get('text')!=root_matches[0]['text'] for item in root_matches):raise ValueError('Conflicting root text in source page')
observed={};request_ids=set()
for n,meta in enumerate(report['pages'],1):
if meta.get('http_status')!=200:raise ValueError('Resolve failed reply pages before final review')
if ident(meta['params']['media_id'])!=media or ident(meta['params']['comment_id'])!=root_id:raise ValueError('Mixed reply request')
value=load_page(replies,n,meta,'instagram.fetch_comment_replies')
if value['request_id'] in request_ids:raise ValueError('Repeated response ID')
request_ids.add(value['request_id'])
items=value.get('data',{}).get('child_comments')
if not isinstance(items,list):raise ValueError('Missing child comments')
for item in items:
key=ident(item['pk']);parent=ident(item['parent_comment_id']);text=item.get('text')
if not isinstance(text,str):raise ValueError('Missing reply text')
observed.setdefault(key,{'reply_id':key,'parent_comment_id':parent,'text':text,'request_id':value['request_id'],'source_sha256':meta['sha256'],'source_page':n})
if len(observed)!=report.get('unique_replies'):raise ValueError('Reply coverage count disagrees with source')
decision=review.get('decision');note=review.get('reviewer_note')
if decision not in ('answered','needs_context','no_answer_observed') or not isinstance(note,str) or not note.strip():raise ValueError('Supply manual decision and review note')
evidence=None
if decision in ('answered','needs_context') and review.get('reply_id') is not None:
evidence=observed.get(ident(review['reply_id']));quote=review.get('quote')
if evidence is None or not isinstance(quote,str) or not quote.strip() or quote not in evidence['text']:raise ValueError('Quote must match the saved reply exactly')
evidence={k:v for k,v in evidence.items() if k!='text'};evidence['quote']=quote
elif decision=='answered':raise ValueError('Answered requires an exact reply quote')
elif review.get('reply_id') is not None or review.get('quote') not in (None,''):raise ValueError('No evidence must not carry an invented quote')
result={'media_id':media,'root_id':root_id,'root_text':root_matches[0]['text'],'decision':decision,'reviewer_note':note,'evidence':evidence,'observed_unique_replies':len(observed),'stop_reason':report['stop_reason'],'all_replies_collected':False,'root_source_sha256':report['root_sha256'],'review_sha256':hashlib.sha256(review_bytes).hexdigest(),'decision_source':'manual_review_not_automated_truth','scope':'Only supplied saved reply pages; no customer outreach or network call'}
out.mkdir();(out/'review-input.json').write_bytes(review_bytes);(out/'resolution.json').write_text(json.dumps(result,ensure_ascii=False,indent=2),encoding='utf-8')
print(str(out))

Keep the question-review folder private until the quoted content is reviewed for sharing. resolve_question.py checks the evidence quote against the raw response text, not the spreadsheet-escaped cell. Changed raw bytes, a wrong media ID or root comment, missing IDs, an invented quote or a mismatched coverage count stop the review. Local hashes show that the files are consistent; the hashes are not a server signature. An answered label is a human assessment, not a verified purchase, a resolved support ticket or a promise that all replies were collected. When you aggregate later, do not count unreviewed root comments as unanswered.