# Instagram Comment Actions – Like & Reply (`automation_nerd/instagram-comment-action-actor`) Actor

Automate replies and likes on Instagram comments with your own account. For each action: like a comment, reply to it, and/or like the post. Bring your own login (cookies). Safe by default: dry-run mode validates everything before any write.

- **URL**: https://apify.com/automation\_nerd/instagram-comment-action-actor.md
- **Developed by:** [Egon Maier](https://apify.com/automation_nerd) (community)
- **Categories:** Automation, SEO tools, Social media
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $7.00 / 1,000 comment actions

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Instagram Comment Actions – Like & Reply

**Automatically like and reply to Instagram comments — with your own account.**

Give this actor a list of actions and it will, for each one, **like a comment**,
**post a reply** to it, and/or **like the post** — acting as you. Ideal for
community management: acknowledge every comment on a launch post, thank people
for feedback, or auto-like mentions.

It logs in with **your own Instagram session** (you paste your cookies), so it
acts exactly as if you did it in the app.

> 🛡️ **Safe by default:** the actor runs in **dry-run mode** unless you turn it
> off. A dry run validates your login and every action and reports what it
> *would* do — without sending a single like or reply. Set `dryRun: false` only
> when you're ready to act for real.

### Use it to

- **Community management at scale** — like and reply to comments on your posts
- **Campaign engagement** — respond to everyone who commented on a giveaway
- **Consistent replies** — post the same thank-you under many comments

Pair it with the **Instagram Post Engagement Scraper** to first collect the
comment IDs, then feed them here.

### How to get your cookies

**Easiest (recommended):** install the free **[Cookie-Editor](https://cookie-editor.com/)**
extension, log in to `instagram.com` (an account **you control**), click the
Cookie-Editor icon → **Export → Export as JSON**, and paste the JSON into the
**`cookies`** field.

**Or** paste just your **`sessionid`** value (DevTools → Application → Cookies →
`instagram.com` → `sessionid`) — the actor derives the rest.

`cookies` is a **secret field** — Apify stores it encrypted and never shows it in
the log, input or dataset. Log out of that browser session to revoke access.

### Input

| Field                   | Type            | Description                                                                         |
| ----------------------- | --------------- | ----------------------------------------------------------------------------------- |
| `cookies`               | string (secret) | Your login: a Cookie-Editor JSON export, a cookie string, or just your `sessionid`. |
| `actions`               | array           | Action objects (see below).                                                         |
| `mentionUser`           | boolean         | Prefix each reply with `@username` (from the action's `username`). Default false.   |
| `dryRun`                | boolean         | **Default `true`** — validate only, no writes. Set `false` to actually act.         |
| `proxyConfiguration`    | object          | Residential proxy, ideally in your account's usual country.                         |
| `maxConcurrency`        | integer         | Keep low (default **1**) — parallel writes look automated.                          |
| `delayBetweenActionsMs` | integer         | Pause between actions (default 4000).                                               |
| `maxRequestRetries`     | integer         | Retries per action on transient errors (default 2).                                 |

Each **action** object:

```json
{
  "postUrl": "https://www.instagram.com/p/YOUR_POST/",
  "commentId": "17900000000000000",
  "username": "comment_author",
  "likeComment": true,
  "reply": "Thanks for the kind words!",
  "likePost": false
}
```

- `likeComment` / `reply` need **`commentId`** (get it from the **Instagram Post
  Engagement Scraper** — the `id` on each comment).
- `reply` / `likePost` need **`postUrl`** (to resolve the post).
- `username` is optional — the comment author's handle. When **`mentionUser`** is
  on, the reply becomes `@username <your reply>`. (The engagement scraper gives
  you `comments[].username`.)
- Any combination is allowed; sub-actions run in order like → reply → like post.

### Output

One dataset item per action:

| Field                                                        | Description                                                                         |
| ------------------------------------------------------------ | ----------------------------------------------------------------------------------- |
| `postUrl`, `commentId`                                       | The target.                                                                         |
| `success`                                                    | True only if **all** requested sub-actions succeeded (or, in a dry run, validated). |
| `dryRun`                                                     | Whether this was a validation-only run (no writes sent).                            |
| `actionsPerformed`                                           | Which sub-actions completed, e.g. `["likeComment","reply"]`.                        |
| `wouldPerform`                                               | In a dry run: which sub-actions *would* run.                                        |
| `likedComment`, `replied`, `replyCommentId`, `likedPost`     | Per-sub-action result.                                                              |
| `replyText`                                                  | The exact reply text posted (including any `@username`).                            |
| `error`, `attempts`                                          | Combined error message and try count.                                               |
| `responseTimeMs`, `actionIndex`, `totalActions`, `timestamp` | Run metadata.                                                                       |

### Pricing

**Pay per event** — you are charged one `comment-actioned` event per action item
that **fully succeeds**, plus Apify platform usage. Partial/failed actions are
not charged.

### Safety & account health (please read)

Automating engagement can trigger Instagram **action blocks** if done too fast or
too much. To stay safe:

- **Dry-run first.** Leave `dryRun: true` (the default) for your first run to
  confirm your cookies work and the targets are valid, then flip it to `false`.
- Keep **`maxConcurrency` at 1** and a **delay between actions** (a few seconds).
- Use a **Residential proxy in your usual country** — logging actions in from an
  unexpected datacenter IP is a risk signal.
- Don't run large bursts. Spread activity out; keep replies varied and genuine.
- If you see `ACTION_BLOCKED` / `feedback_required` in the output, **stop** and
  let the account rest — do not retry immediately.

### Legal

This actor automates actions on your own account using your own login, which
runs against Instagram's Terms of Service (which discourage automation).
Reliability is not guaranteed and your account carries the risk. Use only for
accounts you own/manage and comply with applicable law. You are responsible for
how you use it.

# Actor input Schema

## `cookies` (type: `string`):

Your own Instagram web session — this Actor acts AS this account, so use one you control. Three accepted formats: (1) the JSON export from the Cookie-Editor browser extension while on instagram.com \[recommended — one click 'Export']; (2) a cookie header string like 'sessionid=...; csrftoken=...; ds\_user\_id=...'; (3) just your 'sessionid' value (ds\_user\_id is derived automatically). Secret field: Apify stores it encrypted and never shows it in the log, input or dataset. Log out to invalidate the session anytime.

## `actions` (type: `array`):

List of actions. Each item targets one comment/post and can like the comment, reply to it and/or like the post. 'commentId' is required for 'likeComment' and 'reply'; 'postUrl' is required for 'reply' and 'likePost'. Optional 'username' = the comment author's handle (used to prefix '@username' when Mention user is on). Get 'commentId' and 'username' from the Instagram Post Engagement Scraper ('comments\[].id' and 'comments\[].username').

## `mentionUser` (type: `boolean`):

When ON, each reply is prefixed with '@<username> ' using the action's 'username' field (the comment author's handle). Actions without a 'username' are replied to without a mention.

## `dryRun` (type: `boolean`):

When ON (default), the Actor validates your cookies and every action and reports what it WOULD do, but sends NO like/reply requests and charges nothing. Set to false ONLY when you are ready to actually perform the actions on your account.

## `likeCommentDocId` (type: `string`):

Advanced/optional. Comment-liking uses a GraphQL mutation (PolarisCommentActionsLikeMutation) whose numeric doc\_id Instagram rotates every few weeks. Leave empty to use the built-in default. If comment-likes start failing, capture a fresh doc\_id from the browser Network tab (x-fb-friendly-name = PolarisCommentActionsLikeMutation) and paste it here.

## `likePostDocId` (type: `string`):

Advanced/optional. Post-liking uses a GraphQL mutation (usePolarisLikeMediaXIGLikeMutation) with a rotating doc\_id. Leave empty for the built-in default; override with a fresh one from the Network tab if post-likes start failing.

## `proxyConfiguration` (type: `object`):

Recommended: Apify Residential proxy in the SAME country your account normally logs in from. Logging actions in from an unexpected datacenter IP raises Instagram's risk flags. Leave off only for quick local tests.

## `maxConcurrency` (type: `integer`):

Keep this LOW. Writing actions (likes/replies) in parallel from one account looks automated and increases the risk of action blocks. 1 is safest.

## `delayBetweenActionsMs` (type: `integer`):

Pause between actions to mimic human pacing and stay under Instagram's rate limits. A few seconds is recommended for anything beyond a handful of actions.

## `maxRequestRetries` (type: `integer`):

How often to retry an action on a transient error (rate limit / 5xx / connection). Action blocks and auth errors are not retried.

## Actor input object example

```json
{
  "actions": [
    {
      "postUrl": "https://www.instagram.com/p/YOUR_POST/",
      "commentId": "REPLACE_WITH_REAL_COMMENT_ID",
      "username": "comment_author",
      "likeComment": true,
      "reply": "Thanks for the kind words!",
      "likePost": false
    }
  ],
  "mentionUser": false,
  "dryRun": true,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  },
  "maxConcurrency": 1,
  "delayBetweenActionsMs": 4000,
  "maxRequestRetries": 2
}
```

# Actor output Schema

## `results` (type: `string`):

All results as JSON (one item per action: actionsPerformed, replyCommentId, error, …)

## `run` (type: `string`):

API endpoint of this run (status, stats, storages)

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "actions": [
        {
            "postUrl": "https://www.instagram.com/p/YOUR_POST/",
            "commentId": "REPLACE_WITH_REAL_COMMENT_ID",
            "username": "comment_author",
            "likeComment": true,
            "reply": "Thanks for the kind words!",
            "likePost": false
        }
    ],
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("automation_nerd/instagram-comment-action-actor").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "actions": [{
            "postUrl": "https://www.instagram.com/p/YOUR_POST/",
            "commentId": "REPLACE_WITH_REAL_COMMENT_ID",
            "username": "comment_author",
            "likeComment": True,
            "reply": "Thanks for the kind words!",
            "likePost": False,
        }],
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("automation_nerd/instagram-comment-action-actor").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "actions": [
    {
      "postUrl": "https://www.instagram.com/p/YOUR_POST/",
      "commentId": "REPLACE_WITH_REAL_COMMENT_ID",
      "username": "comment_author",
      "likeComment": true,
      "reply": "Thanks for the kind words!",
      "likePost": false
    }
  ],
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call automation_nerd/instagram-comment-action-actor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=automation_nerd/instagram-comment-action-actor",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/BOusbibRbanuuvj8E/builds/1vykEIYRis4vzbnHV/openapi.json
