SocialCrawl

Cookbooks

Get only the new comments under your posts, sent to a webhook

Get comments since your last check on an account's posts, then let a Monitor send new ones to your webhook

Send a profile link and a time, and get back the comments left under its recent posts since then. Posts with no new comment cost nothing. A Monitor then runs the same read every hour and sends only the comments it has never sent before.

Measured on 23/11/2026: a 3-hour check on the five newest posts of National Geographic on Instagram found 48 new comments for 36 credits. A 2-minute check found 1 new comment for 6 credits.

Start in five minutes

Set your key once. Every block on this page reads it.

Terminal
export SOCIALCRAWL_API_KEY=YOUR_API_KEY

Paste this prompt into your coding agent:

Prompt
Read https://www.socialcrawl.dev/docs/recipes/new-comments-to-a-webhook.md and follow it to watch the comments under the five newest posts of https://www.instagram.com/natgeo/. Use the key in SOCIALCRAWL_API_KEY. Price the read with a dry run first and show me the hold. Then price the hourly Monitor with a dry run and show me estimated_cost_per_run. Ask me before you create it, and send max_credits_per_month with the cap I agree to.

Or price the read yourself. A dry run quotes it for 0 credits:

cURL
curl -G "https://www.socialcrawl.dev/v1/prism/profile/comments" \
  -H "x-api-key: $SOCIALCRAWL_API_KEY" \
  --data-urlencode "url=https://www.instagram.com/natgeo/" \
  --data-urlencode "posts=5" \
  --data-urlencode "per_post=20" \
  --data-urlencode "since=2026-11-23T20:00:00Z" \
  --data-urlencode "dry_run=true"

How it works

  • prism/profile/comments reads the account's recent posts, then the comments under each one.
  • since stops each post at its first comment older than that time.
  • A post with no new comment reads no comment page, so it costs nothing.
  • posts sets how many recent posts are read, and per_post caps the comments taken from each.
  • The call holds its worst case up front and refunds what it did not read.

What you need

CallWhat it givesCredits
GET /v1/prism/profile/commentsNew comments under the profile's recent postsThe post list page, plus each comment page read
POST /v1/monitors?dry_run=1The price of an hourly Monitor of that read0
An HTTPS endpoint of your ownReceives each signed deliveryFree

On Instagram a comment page costs 5 credits. On most other platforms it costs 1. The roster lists every price.

Steps

Step 1: read the comments since a time

cURL
curl -G "https://www.socialcrawl.dev/v1/prism/profile/comments" \
  -H "x-api-key: $SOCIALCRAWL_API_KEY" \
  --data-urlencode "url=https://www.instagram.com/natgeo/" \
  --data-urlencode "posts=5" \
  --data-urlencode "per_post=20" \
  --data-urlencode "since=2026-11-23T20:00:00Z"
Python
import json, os, urllib.request

url = "https://www.socialcrawl.dev/v1/prism/profile/comments?url=https%3A%2F%2Fwww.instagram.com%2Fnatgeo%2F&posts=5&per_post=20&since=2026-11-23T20:00:00Z"
req = urllib.request.Request(url, headers={"x-api-key": os.environ["SOCIALCRAWL_API_KEY"]})
page = json.load(urllib.request.urlopen(req, timeout=180))
for p in page["data"]["posts"]:
    print(p["url"], p["comments_new"], p["credits"])
print(len(page["data"]["items"]), page["credits_used"])
  • data.items holds the new comments, each under comment with its text, author and time.
  • data.posts says, post by post, how many comments were new and what each cost.
  • since takes an ISO 8601 time on a direct call.

Step 2: keep the newest time you read

Save the time of the run once it finishes, and send it as since on the next run. Keep each comment by comment.id, so a comment that comes back is not stored twice.

Response (trimmed)
{
  "data": {
    "items": [{ "comment": { "id": "18135330661764616", "post_id": "DgCpvD5A-3U", "published_at": "2026-11-23T23:20:41.000Z" } }],
    "credits": { "posts": 1, "comments": 35, "replies": 0, "charged": 36, "held": 51 }
  },
  "credits_used": 36
}

Step 3: let a Monitor send only the new ones

The Monitor below runs the read every hour and sends new comments to your webhook. With webhook_rows: "new" it remembers every comment it has read, so none is sent twice. Its first run is the baseline: it remembers what is there and sends nothing.

Store only what is new

  • Key each comment on comment.id.
  • Overlap the windows. Send a since an hour or two earlier than your last run, so a failed run loses nothing.
  • In a Monitor, send since: "now-3h". It is resolved at every run to the time three hours earlier.
  • Keep each run under 200 comments with since and per_post. Rows past that are not stored.

What it costs

A check pays for the post list page and for each comment page it reads. A post with no new comment reads no page. A Monitor adds 1 scheduling credit a run.

What the runs measured on 23/11/2026:

RunCommentsCredits
The dry run of the read00 (it holds 51)
3 hours, five posts4836
2 minutes, five posts16
A post with no new comment00

Run this every day

Price the Monitor with a dry run, which creates nothing:

cURL
curl -X POST "https://www.socialcrawl.dev/v1/monitors?dry_run=1" \
  -H "x-api-key: $SOCIALCRAWL_API_KEY" \
  -H "content-type: application/json" \
  -d '{"recipe": "prism/profile/comments", "params": {"url": "https://www.instagram.com/natgeo/", "posts": "5", "per_post": "20", "since": "now-3h"}, "cadence": "hourly", "webhook_url": "https://example.com/hooks/socialcrawl", "track": {"metrics": ["items[].comment.engagement.likes", "total"], "max_rows": 200}, "webhook_rows": "new", "alert_rules": [{"metric": "rows_new", "op": "gt", "value": 0}], "suppress_webhook_unless_alert": true}'
  • estimated_cost_per_run in the answer is the worst case, every post with a full page of new comments.
  • rows_new gt 0 with suppress_webhook_unless_alert: true sends nothing in an hour with no new comment.
  • Send the same body without dry_run=1 to create it, with max_credits_per_month set to your limit.
  • The answer carries would_be_refused when your plan has no free Monitor slot.
  • Store the webhook_secret from the create answer, and verify every delivery.

Tips, and what not to use

  • A chat app's incoming-webhook address is refused, because it cannot check a signature. Run the short relay and register its address instead.
  • Start with five posts. Older posts rarely get new comments, and each one adds to the hold.
  • Read webhook_delivery on the Monitor's runs to see the status your endpoint returned for each delivery.
  • Use Read the comments under many posts for a one-off export of every comment.
  • Watch one post with instagram/post/comments and sort=recent when only one post matters.

Copy it

Full program and agent brief

Next steps