AutomationFlowsSocial Media › Scrape Instagram Post Data and Engagement Stats with Webhooks and Coreclaw

Scrape Instagram Post Data and Engagement Stats with Webhooks and Coreclaw

Bydata-scraper @scraping on n8n.io

This workflow receives Instagram post URLs, sends them to the CoreClaw Instagram Post Scraper, and returns structured post data including captions, likes, comments, media URLs, and timestamps. Requires a CoreClaw API key. Receives a POST webhook request containing one or more…

Webhook trigger★★★★☆ complexity10 nodesHTTP Request
Social Media Trigger: Webhook Nodes: 10 Complexity: ★★★★☆ Added:

This workflow corresponds to n8n.io template #17872 — we link there as the canonical source.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "Instagram Post Scraper",
  "tags": [
    {
      "name": "scraping"
    },
    {
      "name": "instagram"
    },
    {
      "name": "social-media"
    }
  ],
  "nodes": [
    {
      "id": "e70801fa-efa9-4e2e-bfc6-2b86507b5b0c",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -368,
        128
      ],
      "parameters": {
        "width": 480,
        "height": 816,
        "content": "## Instagram Post Scraper\n\n### How it works\n\nThis workflow exposes a webhook that accepts Instagram post URLs, sends them to the CoreClaw Instagram Post Scraper Worker, and retrieves structured post data including captions, likes, comments, and media URLs. It then aggregates engagement statistics and returns the results to the webhook caller.\n\n### Setup steps\n\n- Configure the Webhook Trigger URL and HTTP method according to how the workflow will be called.\n- Add your CoreClaw API key as the CORECLAW_API_KEY environment variable in n8n.\n- Ensure the incoming webhook body contains a urls array with Instagram post URLs.\n- Test the workflow with a sample Instagram post URL.\n\n### Customization\n\nYou can adjust the input format to accept different request body structures, modify the result parsing to extract additional fields, or extend the aggregation step with custom metrics such as engagement rate or top-performing posts."
      },
      "typeVersion": 1
    },
    {
      "id": "ca1adc5e-9ea1-4a61-bd41-d184d20d7803",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        192,
        144
      ],
      "parameters": {
        "color": 7,
        "width": 432,
        "height": 320,
        "content": "## Receive and prepare input\n\nStarts the workflow from a webhook request and extracts the Instagram post URLs from the incoming request body."
      },
      "typeVersion": 1
    },
    {
      "id": "14341d19-a988-4ae2-b7c3-900b7b9c813b",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        672,
        128
      ],
      "parameters": {
        "color": 7,
        "width": 432,
        "height": 336,
        "content": "## Run CoreClaw Worker and parse results\n\nCalls the CoreClaw Instagram Post Scraper Worker with the provided URLs, then converts the API response into clean post objects for downstream processing."
      },
      "typeVersion": 1
    },
    {
      "id": "adcb32c9-36b7-411c-904f-8b636384e460",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1152,
        128
      ],
      "parameters": {
        "color": 7,
        "width": 432,
        "height": 336,
        "content": "## Summarize and return results\n\nCalculates aggregate metrics such as total posts, likes, comments, and average likes per post, then sends the final response back to the webhook caller."
      },
      "typeVersion": 1
    },
    {
      "id": "webhook-trigger",
      "name": "Instagram Scraper Trigger",
      "type": "n8n-nodes-base.webhook",
      "position": [
        240,
        300
      ],
      "parameters": {
        "path": "instagram-scraper",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 2
    },
    {
      "id": "extract-urls",
      "name": "Extract Post URLs",
      "type": "n8n-nodes-base.code",
      "position": [
        480,
        300
      ],
      "parameters": {
        "jsCode": "const body = $input.first().json.body || $input.first().json;\nlet urls = body.urls || body.urls_list || body.post_urls || body.url;\n\nif (!urls) {\n  throw new Error('Instagram post URLs are required. Send { \"urls\": [\"https://www.instagram.com/p/XXXX\"] } in the request body.');\n}\n\nif (typeof urls === 'string') {\n  urls = [urls];\n}\n\nconst formattedUrls = urls.map(u => {\n  if (typeof u === 'string') return { url: u };\n  if (u.url) return { url: u.url };\n  return { url: String(u) };\n});\n\nreturn [{\n  json: {\n    urls: formattedUrls,\n    url_count: formattedUrls.length,\n    timestamp: new Date().toISOString()\n  }\n}];",
        "typeVersion": 2
      }
    },
    {
      "id": "call-coreclaw-api",
      "name": "Run CoreClaw Scraper",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        720,
        300
      ],
      "parameters": {
        "url": "https://openapi.coreclaw.com/api/v2/workers/coreclaw~instagram-post-scraper/runs",
        "method": "POST",
        "options": {
          "timeout": 300000
        },
        "jsonBody": "={\n  \"input\": {\n    \"parameters\": {\n      \"custom\": {\n        \"urls\": {{ JSON.stringify($json.urls) }}\n      }\n    }\n  },\n  \"is_async\": false,\n  \"limit\": 100,\n  \"offset\": 0\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "typeVersion": 4.2,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer {{$env.CORECLAW_API_KEY}}"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      }
    },
    {
      "id": "parse-post-data",
      "name": "Parse Post Data",
      "type": "n8n-nodes-base.code",
      "position": [
        960,
        300
      ],
      "parameters": {
        "jsCode": "const response = $input.first().json;\n\nif (response.code !== 0) {\n  return [{\n    json: {\n      error: 'CoreClaw API error: ' + (response.message || 'Unknown error'),\n      request_id: response.request_id\n    }\n  }];\n}\n\nconst dataList = (response.data && response.data.list) || [];\nconst headers = (response.data && response.data.headers) || [];\n\nif (dataList.length === 0) {\n  return [{\n    json: {\n      error: 'No posts found in CoreClaw response',\n      count: 0\n    }\n  }];\n}\n\nconst parsedPosts = dataList.map(post => {\n  return {\n    json: {\n      post_id: post.id || post.pk || post.shortcode || '',\n      shortcode: post.shortcode || post.code || '',\n      image_url: post.image_url || post.display_url || post.thumbnail_src || '',\n      video_url: post.video_url || '',\n      is_video: post.is_video || post.media_type === 2 || false,\n      caption: post.caption || post.caption_text || '',\n      likes: post.like_count || post.likes || 0,\n      comments: post.comment_count || post.comments || 0,\n      timestamp: post.taken_at_timestamp || post.timestamp || post.created_time || '',\n      permalink: post.permalink || (post.shortcode ? 'https://instagram.com/p/' + post.shortcode + '/' : ''),\n      location: post.location ? (post.location.name || post.location) : ''\n    }\n  };\n});\n\nreturn parsedPosts;",
        "typeVersion": 2
      }
    },
    {
      "id": "aggregate-stats",
      "name": "Set Post Statistics",
      "type": "n8n-nodes-base.set",
      "position": [
        1200,
        300
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "agg-total",
              "name": "total_posts",
              "type": "number",
              "value": "={{ $json.length || 0 }}"
            },
            {
              "id": "agg-likes",
              "name": "total_likes",
              "type": "number",
              "value": "={{ $json.reduce((sum, p) => sum + (p.likes || 0), 0) }}"
            },
            {
              "id": "agg-comments",
              "name": "total_comments",
              "type": "number",
              "value": "={{ $json.reduce((sum, p) => sum + (p.comments || 0), 0) }}"
            },
            {
              "id": "agg-avg-likes",
              "name": "avg_likes_per_post",
              "type": "number",
              "value": "={{ Math.round(($json.reduce((sum, p) => sum + (p.likes || 0), 0)) / ($json.length || 1)) }}"
            },
            {
              "id": "agg-avg-comments",
              "name": "avg_comments_per_post",
              "type": "number",
              "value": "={{ Math.round(($json.reduce((sum, p) => sum + (p.comments || 0), 0)) / ($json.length || 1)) }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "return-results",
      "name": "Send Webhook Response",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1440,
        300
      ],
      "parameters": {
        "options": {
          "responseCode": 200
        },
        "respondWith": "json",
        "typeVersion": 1.1,
        "responseBody": "={\n  \"status\": \"success\",\n  \"scraped_at\": \"{{ $('Extract Post URLs').first().json.timestamp }}\",\n  \"url_count\": {{ $('Extract Post URLs').first().json.url_count }},\n  \"summary\": {\n    \"total_posts\": {{ $json.total_posts }},\n    \"total_likes\": {{ $json.total_likes }},\n    \"total_comments\": {{ $json.total_comments }},\n    \"avg_likes_per_post\": {{ $json.avg_likes_per_post }},\n    \"avg_comments_per_post\": {{ $json.avg_comments_per_post }}\n  },\n  \"posts\": {{ JSON.stringify($('Parse Post Data').all().map(item => item.json)) }}\n}"
      }
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "connections": {
    "Parse Post Data": {
      "main": [
        [
          {
            "node": "Set Post Statistics",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Post URLs": {
      "main": [
        [
          {
            "node": "Run CoreClaw Scraper",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Post Statistics": {
      "main": [
        [
          {
            "node": "Send Webhook Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run CoreClaw Scraper": {
      "main": [
        [
          {
            "node": "Parse Post Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Instagram Scraper Trigger": {
      "main": [
        [
          {
            "node": "Extract Post URLs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

This workflow receives Instagram post URLs, sends them to the CoreClaw Instagram Post Scraper, and returns structured post data including captions, likes, comments, media URLs, and timestamps. Requires a CoreClaw API key. Receives a POST webhook request containing one or more…

Source: https://n8n.io/workflows/17872/ — original creator credit. Request a take-down →

More Social Media workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Social Media

generación_publicaciones (workflow 3) webhook all platforms decrypt publicar git. Uses dataTable, linkedIn, httpRequest. Webhook trigger; 50 nodes.

Data Table, LinkedIn, HTTP Request
Social Media

This workflow captures buying-signal leads via a webhook (or optionally polls a HubSpot list), generates a personalized LinkedIn intro and follow-up sequence with Twain, and posts the ready-to-send dr

HTTP Request, Slack
Social Media

Automate your entire Instagram carousel publishing pipeline from a single webhook call. This workflow receives a product collection payload, loops through each slide image, uploads every asset via Upl

HTTP Request, N8N Nodes Uploadtourl, Slack
Social Media

Twitter MCP - Complete Workflow. Uses start, httpRequest. Webhook trigger; 18 nodes.

Start, HTTP Request
Social Media

This workflow leverages n8n to automate LinkedIn content creation from start to finish. Upload an image and quote through a web form, and get a professionally designed post with AI-generated captions,

HTTP Request, LinkedIn, Edit Image