# Instagram Bulk Messenger (`webscrap18/instagram-bulk-dm`) Actor

This actor allows you to send the Individual DM's to Multiple users.

- **URL**: https://apify.com/webscrap18/instagram-bulk-dm.md
- **Developed by:** [WebScrap](https://apify.com/webscrap18) (community)
- **Categories:** Automation, Developer tools, Social media
- **Stats:** 95 total users, 0 monthly users, 100.0% runs succeeded, 5 bookmarks
- **User rating**: No ratings yet

## Pricing

$15.00/month + usage

To use this Actor, you pay a monthly rental fee to the developer. The rent is subtracted from your prepaid usage every month after the free trial period. You also pay for the Apify platform usage, which gets cheaper the higher Apify subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#rental-actors

## 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 Bulk DM Sender

This Actor allows you to send personalized direct messages to multiple Instagram users with customizable delays between messages.

### Features

- Send messages to multiple Instagram users
- Personalize messages with randomized variations
- Configurable delays between messages to avoid rate limiting
- Authentication methods:
  - Cookie-based authentication (bypasses 2FA)

### Authentication Methods

#### 1. Cookie-based Authentication (Recommended)

This method bypasses 2FA and is the most reliable. You can obtain your Instagram cookies:

##### Using browser developer tools

For Puppeteer automation, you can export the cookies as a JSON file:

- you can use the [xport-cookie JSON plugin](https://chromewebstore.google.com/detail/nmckokihipjgplolmcmjakknndddifde?utm_source=item-share-cb) to export the cookies in a JSON format compatible with Puppeteer sessions.
- Log into Instagram
- Click on the extension icon
- Click "Export" to save the cookies in JSON format
- This JSON file can be directly used with Puppeteer for automation

### Message Templates

You can use a simple templating system to randomize parts of your messages:

```
Hey {there|hi|hello}, how are you {doing|feeling} today?
```

This will randomly select one option from each set of braces, creating variations like:

- "Hey there, how are you doing today?"
- "Hey hi, how are you feeling today?"
- "Hey hello, how are you doing today?"

### Input Fields Description

- **Instagram Cookies**\
  Paste your Instagram session cookie string here.

- **Target Usernames**\
  A list of Instagram usernames to whom the message should be sent. You can:
  - Add usernames one by one.
  - Use the **Bulk Edit** feature to input multiple usernames at once.
  - Use **Remove Empty Fields** to clean up unused entries.

- **Message Template**\
  The message content to be sent to each user. You can optionally use template syntax to randomize messages:
  ```
  Are you {good|doing okay|feeling fine}? 😊
  ```
  This adds natural variation to reduce detection as automated messaging.

- **Minimum Delay (seconds) (optional)**\
  The minimum amount of time (in seconds) to wait between sending messages. Recommended value: 60 seconds or more.

- **Maximum Delay (seconds) (optional)**\
  The maximum wait time (in seconds) between two consecutive messages. A random delay between min and max will be used to simulate human behavior and avoid rate limits.

### Output

The Actor returns a JSON object containing:

```json
{
  "success": true,
  "sent": [
    {
      "username": "username1",
      "user_id": "12345678",
      "message": "Hey there, how are you doing today?",
      "timestamp": "2025-05-22T12:34:56.789Z"
    }
  ],
  "failed": [
    {
      "username": "non_existent_user",
      "error": "User not found",
      "timestamp": "2025-05-22T12:35:56.789Z"
    }
  ],
  "total_sent": 1,
  "total_failed": 1
}
```

### Notes

- To avoid being rate-limited by Instagram, keep the delays reasonably high (at least 30-60 seconds between messages)
- Instagram has automatic protections against spam, so use this tool responsibly
- For best results, use an account that has been active for a while and has established relationships with the users you're messaging
- Using a saved session can help avoid frequent logins which may trigger security measures

### License

This Actor is proprietary software. All rights reserved.

No permission is granted for any use, copying, modification, distribution, or operation of this software without explicit written permission from the owners. If you wish to use this software, please contact us for licensing information.

### Disclaimer

This Actor is not affiliated with, authorized, maintained, sponsored or endorsed by Instagram or any of its affiliates or subsidiaries. Use at your own risk and responsibility.

# Actor input Schema

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

Instagram cookies for authentication. Can be in JSON format or raw cookie string. Use this to bypass 2FA requirements.

## `session_file` (type: `string`):

Path to a previously saved Instagram session file. If provided, it will be used instead of username/password.

## `usernames` (type: `array`):

List of Instagram usernames to send messages to.

## `message` (type: `string`):

Message template with optional randomized parts. Use {option1|option2|option3} syntax for random selection.

## `min_delay` (type: `integer`):

Minimum delay between sending messages (in seconds).

## `max_delay` (type: `integer`):

Maximum delay between sending messages (in seconds).

## `save_session` (type: `boolean`):

Whether to save the session for future use.

## `session_path` (type: `string`):

Path where to save the session file if save\_session is enabled.

## Actor input object example

```json
{
  "usernames": [
    "username1",
    "username2"
  ],
  "message": "Hey {there|hi|hello}, how are you {doing|feeling} today?",
  "min_delay": 10,
  "max_delay": 20,
  "save_session": true,
  "session_path": "./instagram_session.json"
}
```

# 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 = {
    "usernames": [
        "username1",
        "username2"
    ],
    "message": "Hey {there|hi|hello}, how are you {doing|feeling} today?",
    "min_delay": 10,
    "max_delay": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("webscrap18/instagram-bulk-dm").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 = {
    "usernames": [
        "username1",
        "username2",
    ],
    "message": "Hey {there|hi|hello}, how are you {doing|feeling} today?",
    "min_delay": 10,
    "max_delay": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("webscrap18/instagram-bulk-dm").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "usernames": [
    "username1",
    "username2"
  ],
  "message": "Hey {there|hi|hello}, how are you {doing|feeling} today?",
  "min_delay": 10,
  "max_delay": 20
}' |
apify call webscrap18/instagram-bulk-dm --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,webscrap18/instagram-bulk-dm"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/KVvbpCePauxYI5qXa/builds/uwuJbGVmk9m7HJUKX/openapi.json
