npm package: @inite/n8n-nodes-instagram-private-api
Description: n8n node for Instagram Private API with 2FA support
Author: Mikhail Savhenko
Latest version: 1.0.43

��# n8n-nodes-instagram-private-api

This is an n8n community node for interacting with Instagram using the Instagram Private API. It provides comprehensive functionality for posting content, managing direct messages, handling comments, and monitoring Instagram activities.

[n8n](https://n8n.io/) is a [fair-code licensed](https://docs.n8n.io/reference/license/) workflow automation platform.

[Installation](#installation)  
[Setup](#setup)  
[Operations](#operations)  
[Triggers](#triggers)  
[Examples](#examples)  
[Resources](#resources)  
[Version history](#version-history)

## Installation

Follow these steps to install the node:

1. Open your n8n instance
2. Go to **Settings** > **Community Nodes**
3. Select **Install**
4. Enter `@inite/n8n-nodes-instagram-private-api`
5. Click **Install**

Alternatively, you can install it using npm:

```bash
npm install @inite/n8n-nodes-instagram-private-api
```

## Setup

1. Create new credentials in n8n:

   - Go to **Credentials** > **New**
   - Search for "Instagram Private API"
   - Enter your Instagram username and password

2. Important Security Notes:
   - Store your credentials securely
   - Use a dedicated Instagram account for automation
   - Follow Instagram's rate limits and usage guidelines
   - Consider using Instagram's official API for business accounts

## Features

- Full Instagram Private API support
- Two-Factor Authentication (2FA) support
- Session storage for faster subsequent logins
- Proxy support for enhanced security
- Comprehensive error handling

## Operations

### Instagram Private API Node

#### Content Publishing

- **Post**: Post images or videos to your feed

  ```json
  {
    "operation": "post",
    "contentType": "image",
    "media": "https://example.com/image.jpg",
    "caption": "My awesome post!"
  }
  ```

- **Post Story**: Share stories

  ```json
  {
    "operation": "postStory",
    "contentType": "video",
    "media": "https://example.com/video.mp4",
    "coverImage": "https://example.com/cover.jpg"
  }
  ```

- **Post Reel**: Create engaging reels
  ```json
  {
    "operation": "postReel",
    "media": "https://example.com/reel.mp4",
    "caption": "Check out my new reel!",
    "coverImage": "https://example.com/cover.jpg"
  }
  ```

#### Engagement

- **Comment**: Interact with posts

  ```json
  {
    "operation": "comment",
    "mediaId": "12345",
    "commentText": "Great post!"
  }
  ```

- **Send DM**: Message users directly
  ```json
  {
    "operation": "sendDM",
    "userId": "67890",
    "messageText": "Hello there!"
  }
  ```

#### Information Retrieval

- **Get User Info**: Fetch user details
- **Get User Feed**: Access user's posts
- **Get User Stories**: View user's stories

## Triggers

### Instagram Trigger Node

Monitor Instagram activities in real-time:

#### New DM Trigger

```json
{
  "event": "newDM",
  "pollInterval": 60,
  "output": {
    "threadId": "123",
    "userId": "456",
    "username": "user",
    "message": "Hello!",
    "timestamp": 1234567890
  }
}
```

#### New Comment Trigger

```json
{
  "event": "newComment",
  "pollInterval": 60,
  "output": {
    "mediaId": "789",
    "userId": "012",
    "username": "commenter",
    "text": "Nice!",
    "timestamp": 1234567890
  }
}
```

## Examples

### Automated Story Sharing

```javascript
// When a new image is uploaded to cloud storage
// Post it as an Instagram story
{
  "operation": "postStory",
  "contentType": "image",
  "media": "{{$node.trigger.json.imageUrl}}"
}
```

### Comment Monitoring and Response

```javascript
// When a new comment is received
// Send a thank you DM to the commenter
{
  "operation": "sendDM",
  "userId": "{{$node.instagramTrigger.json.userId}}",
  "messageText": "Thanks for your comment!"
}
```

## Resources

- [n8n Community Nodes Documentation](https://docs.n8n.io/integrations/community-nodes/)
- [Instagram Private API Documentation](https://github.com/dilame/instagram-private-api)
- [Instagram Rate Limits](https://developers.facebook.com/docs/instagram-api/reference/rate-limits)
- [Best Practices for Instagram Automation](https://developers.facebook.com/docs/instagram-api/guides/content-publishing)

## Version history

### 1.0.0 (2024-04-07)

- Initial release with comprehensive Instagram functionality
- Content publishing (posts, stories, reels)
- Direct messaging and commenting capabilities
- User information and feed retrieval
- Real-time triggers for DMs and comments
- Extensive error handling and rate limit management

## License

[MIT](LICENSE.md)