# Instagram Auto DMs (`aizen0/instagram-auto-dms`) Actor

Instagram DM Automation Automatically send direct messages to multiple Instagram users using your session ID. Customize the message, delay, proxy settings, and number of users for safe, efficient outreach.

- **URL**: https://apify.com/aizen0/instagram-auto-dms.md
- **Developed by:** [Aizen](https://apify.com/aizen0) (community)
- **Categories:** Automation, Social media, Lead generation
- **Features:** Limited permissions
- **Stats:** 119 total users, 0 monthly users, 100.0% runs succeeded, 14 bookmarks
- **User rating**: No ratings yet

## Pricing

from $35.00 / 1,000 dm sents

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/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Instagram DM Automation

Automatically send personalized direct messages (DMs) to multiple Instagram users using this Apify Actor!

This Actor helps you perform safe and efficient outreach by allowing you to customize your message, set delays between messages, configure proxy settings, and control how many users you target.

***

### How It Works

The Actor logs into Instagram using your **Session ID** and sends your custom message to each username you specify in the input.\
You can configure the delay between each message to avoid triggering Instagram’s anti-spam systems.

***

### Input Parameters

| Field | Type | Description |
| :--- | :--- | :--- |
| `sessionid` | String | Your Instagram session ID for authentication. (Required for login) |
| `target_usernames` | Array of Strings | List of Instagram usernames you want to message. |
| `message` | String | The direct message you want to send. |
| `delay_between_messages` | Integer | Delay between messages (in seconds). Default is 60 seconds. |
| `proxy` | Object | Proxy configuration. (Default: Apify Residential proxies) |
| `max_users` | Integer | Maximum number of users to message. Set to `0` for unlimited messaging. |

***

### Example Input

```json
{
  "sessionid": "your-instagram-sessionid-here",
  "target_usernames": ["user1", "user2", "user3"],
  "message": "Hey! Just wanted to reach out :)",
  "delay_between_messages": 45,
  "proxy": {
    "useApifyProxy": true,
    "apifyProxyGroups": ["RESIDENTIAL"]
  },
  "max_users": 100
}

```

***

### Example Output

```json

{
  "username": "example_user",
  "user_id": "12345678",
  "thread_id": "87654321",
  "status": "success",
  "message": "Hello, this is my message!"
}

```

⚠️ Important Warnings

Ensure your Instagram account follows Instagram's DM limits to avoid or getting banned (5 per run , 30-40 max user per day).

Always use a reasonable delay between messages!
If you send DMs too quickly without a proper delay (like sending every second), Instagram may detect spam-like behavior.
This can result in:

Temporary action blocks (can't DM or perform actions for hours or days)

Temporary account suspension

Permanent account ban

Avoid messaging a large number of users at once without delays!
Attempting to send DMs to hundreds or thousands of users quickly can seriously risk your Instagram account being flagged, limited, or banned.

Use proxies for added safety.
Proxies (especially Residential proxies) help hide your real IP address and reduce the chance of detection by Instagram.

Your Session ID must stay valid.
If your session expires (you log out everywhere, reset password, or Instagram detects suspicious activity), you will need to generate a new session ID.

Use responsibly!
Always comply with Instagram’s Terms of Service. This Actor is intended for ethical, respectful communication only, not for spam or unsolicited mass messaging.

# Actor input Schema

## `sessionid` (type: `string`):

Your Instagram session ID cookie value. To get this: 1) Log into Instagram on desktop, 2) Open browser DevTools (F12), 3) Go to Application/Storage > Cookies, 4) Copy the 'sessionid' value

## `target_usernames` (type: `array`):

List of Instagram usernames to send DMs to (without @ symbol). Example: \['user1', 'user2', 'user3']

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

The message to send. You can include links directly in this message (e.g., 'Check this out: https://example.com'). If sending an image, this text will be sent as the caption. Leave empty to send image only.

## `delay_between_messages` (type: `integer`):

Delay between each DM to avoid Instagram rate limits. Recommended: 60-120 seconds. Lower values may trigger rate limits.

## `max_users` (type: `integer`):

Limit the number of users to message. Set to 0 for unlimited (will message all users in the list). Useful for testing.

## `proxy` (type: `object`):

Use Apify residential proxies to avoid rate limits and IP blocks. Highly recommended for production use. Works with LIMITED_PERMISSIONS.

## Actor input object example

```json
{
  "sessionid": "43773356358%3ABPWIDEag6iO07c%3A6%3AAYjoO-k4Fqc-gABoPU8BCS2SXI8sDN6R1Dxayv3BMQ",
  "target_usernames": [
    "mocoskeleton"
  ],
  "message": "Hey! 👋",
  "delay_between_messages": 120,
  "max_users": 0,
  "proxy": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# 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 = {
    "proxy": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("aizen0/instagram-auto-dms").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 = { "proxy": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    } }

# Run the Actor and wait for it to finish
run = client.actor("aizen0/instagram-auto-dms").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 '{
  "proxy": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call aizen0/instagram-auto-dms --silent --output-dataset

```

## MCP server setup

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

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/p62lhFXUaUqnecvHi/builds/zz5kG44mu1htZlQeB/openapi.json
