πŸš€ DAY 5 OF LAUNCH WEEK:Introducing Webhook Events for Alert Changes.Learn more β†’
Socket
Book a DemoInstallSign in
Socket

instagram-client-web

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

instagram-client-web

A robust Instagram API client library for Node.js that emulates browser interactions

latest
npmnpm
Version
2.0.0
Version published
Maintainers
1
Created
Source

Instagram API Client

A robust, feature-rich Instagram API client library for Node.js that emulates browser interactions and provides comprehensive Instagram functionality.

πŸš€ Features

πŸ“± Messaging

  • Send direct messages (text, media)
  • Get conversation history
  • Mark messages as seen
  • Delete messages
  • Message encryption support
  • Rate limiting and queue system

πŸ‘₯ Groups

  • Create group chats
  • Send group messages
  • Add/remove participants
  • Update group names
  • Mute/unmute groups
  • Leave groups

πŸ“Έ Stories

  • View stories
  • Create stories
  • React to stories
  • Reply to stories
  • Share stories
  • Get story highlights
  • Delete stories

πŸ‘ Reactions

  • React to posts (like, love, haha, wow, sad, angry, care)
  • React to stories and reels
  • React to comments
  • Remove reactions
  • Get reaction lists
  • Bulk reactions

πŸ” Encryption

  • AES-256-GCM encryption
  • RSA asymmetric encryption
  • ECDH key exchange
  • Hybrid encryption
  • HMAC integrity checks
  • Password-based key derivation
  • Signal protocol support

🌐 Browser Emulation

  • Realistic browser headers
  • Cookie management
  • Session handling
  • CSRF token management
  • Rate limiting
  • Error handling
  • Retry mechanisms

πŸ“¦ Installation

npm install instagram-api-client

πŸ”§ Requirements

  • Node.js >= 16.0.0
  • npm or yarn

🎯 Quick Start

Basic Setup

const InstagramClient = require('instagram-api-client');

const client = new InstagramClient({
    userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36',
    timeout: 30000,
    enableEncryption: true
});

Authentication

// Authenticate with username and password
const sessionData = await client.authenticate('username', 'password', 'email@example.com');
console.log('Logged in as:', sessionData.username);

Send Messages

// Send a direct message
await client.sendDirectMessage('recipient_id', 'Hello!', { encrypt: true });

// Send a media message
await client.sendMediaMessage('recipient_id', 'https://example.com/image.jpg', 'Check this out!');

Create Groups

// Create a group chat
const group = await client.createGroup(['user1_id', 'user2_id'], 'My Group');

// Send a group message
await client.sendGroupMessage(group.id, 'Hello everyone!');

React to Content

// React to a post
await client.sendPostReaction('post_id', 'love');

// React to a story
await client.sendStoryReaction('story_id', 'like');

πŸ“– Detailed Usage

Event Handling

// Listen for events
client.on('authenticated', (sessionData) => {
    console.log('Logged in as:', sessionData.username);
});

client.on('message-received', (message) => {
    console.log('New message:', message.text);
});

client.on('story-created', (story) => {
    console.log('Story created:', story.id);
});

client.on('group-created', (group) => {
    console.log('Group created:', group.name);
});

Messaging Features

// Get conversations
const conversations = await client.getConversations(20);

// Get messages from a specific conversation
const messages = await client.getDirectMessages(50, 'thread_id');

// Mark message as seen
await client.markAsSeen('thread_id', 'item_id');

// Delete a message
await client.deleteMessage('thread_id', 'item_id');

// Queue messages for rate limiting
await client.queueMessage('recipient_id', 'Queued message');

Group Management

// Get all groups
const groups = await client.getGroups(20);

// Add participants to group
await client.addParticipants('group_id', ['user1_id', 'user2_id']);

// Remove participants from group
await client.removeParticipants('group_id', ['user1_id']);

// Update group name
await client.updateGroupName('group_id', 'New Group Name');

// Mute group
await client.muteGroup('group_id', true);

// Leave group
await client.leaveGroup('group_id');

Stories and Reels

// Get stories
const stories = await client.getStories();

// Get reels
const reels = await client.getReels();

// View a story
await client.viewStory('story_id', 'user_id');

// Create a story
const story = await client.createStory('https://example.com/image.jpg', 'My story caption');

// Reply to a story
await client.replyToStory('story_id', 'Great story!');

// Share a story
await client.shareStory('story_id', ['user1_id', 'user2_id']);

// Get story highlights
const highlights = await client.getStoryHighlights('user_id');

// Add story to highlights
await client.addToHighlights('story_id', 'highlight_id');

Reactions

// React to different content types
await client.reactToPost('post_id', 'love');
await client.reactToStory('story_id', 'like');
await client.reactToReel('reel_id', 'haha');
await client.reactToComment('comment_id', 'wow');

// Remove reactions
await client.removeReaction('post_id');
await client.removeStoryReaction('story_id');
await client.removeCommentReaction('comment_id');

// Get reaction lists
const postReactions = await client.getPostReactions('post_id');
const storyReactions = await client.getStoryReactions('story_id');
const commentReactions = await client.getCommentReactions('comment_id');

// Bulk reactions
const postIds = ['post1', 'post2', 'post3'];
await client.bulkReactToPosts(postIds, 'like');

const storyIds = ['story1', 'story2', 'story3'];
await client.bulkReactToStories(storyIds, 'love');

User Management

// Search for users
const users = await client.searchUsers('username', 20);

// Get user information
const userInfo = await client.getUserInfo('user_id');

Encryption

const { InstagramEncryption } = require('instagram-api-client');
const encryption = new InstagramEncryption();

// Generate RSA key pair
const keys = encryption.generateRSAKeyPair(2048);

// Hybrid encryption (AES + RSA)
const encrypted = encryption.hybridEncrypt('secret message', keys.publicKey);
const decrypted = encryption.hybridDecrypt(encrypted, keys.privateKey);

// Generate ECDH key pair
const ecdhKeys = encryption.generateECDHKeyPair('secp256k1');

// Derive shared secret
const sharedSecret = encryption.deriveSharedSecret(
    ecdhKeys.privateKey, 
    'other_public_key', 
    'secp256k1'
);

// Encrypt with integrity check
const encryptedWithIntegrity = encryption.encryptWithIntegrity('message', 'key');
const decryptedWithIntegrity = encryption.decryptWithIntegrity(encryptedWithIntegrity, 'key');

βš™οΈ Configuration Options

const client = new InstagramClient({
    // Browser emulation
    userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36',
    
    // Network settings
    timeout: 30000,
    retryAttempts: 3,
    proxy: 'http://proxy.example.com:8080',
    
    // Security
    enableEncryption: true,
    
    // Rate limiting
    rateLimitDelay: 1000,
    maxConcurrentRequests: 5
});

πŸ”’ Security Features

  • AES-256-GCM Encryption: Military-grade symmetric encryption
  • RSA Asymmetric Encryption: Secure key exchange
  • ECDH Key Exchange: Perfect forward secrecy
  • HMAC Integrity: Tamper detection
  • PBKDF2 Key Derivation: Secure password handling
  • Signal Protocol Support: End-to-end encryption

🌐 Browser Emulation

The library emulates a real browser with:

  • Realistic User-Agent strings
  • Proper HTTP headers
  • Cookie management
  • Session persistence
  • CSRF token handling
  • Rate limiting
  • Error recovery

πŸ“Š Error Handling

client.on('error', (error) => {
    console.error('Client error:', error);
});

client.on('auth-error', (error) => {
    console.error('Authentication error:', error);
});

client.on('message-error', (error) => {
    console.error('Message error:', error);
});

// Handle specific errors
try {
    await client.sendDirectMessage('invalid_id', 'Hello');
} catch (error) {
    if (error.message.includes('not found')) {
        console.log('User not found');
    } else if (error.message.includes('rate limit')) {
        console.log('Rate limited, waiting...');
    }
}

πŸ§ͺ Testing

Run the test suite:

npm test

Or run the demo:

node test/test.js

πŸ“ Project Structure

instagram-api-client/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ client/
β”‚   β”‚   └── InstagramClient.js      # Main client class
β”‚   β”œβ”€β”€ auth/
β”‚   β”‚   └── InstagramAuth.js        # Authentication system
β”‚   β”œβ”€β”€ messaging/
β”‚   β”‚   └── InstagramMessaging.js   # Direct messaging
β”‚   β”œβ”€β”€ groups/
β”‚   β”‚   └── InstagramGroups.js      # Group management
β”‚   β”œβ”€β”€ stories/
β”‚   β”‚   └── InstagramStories.js     # Stories and reels
β”‚   β”œβ”€β”€ reactions/
β”‚   β”‚   └── InstagramReactions.js   # Reactions system
β”‚   β”œβ”€β”€ encryption/
β”‚   β”‚   └── InstagramEncryption.js  # Encryption utilities
β”‚   └── utils/
β”‚       └── BrowserEmulator.js      # Browser emulation
β”œβ”€β”€ test/
β”‚   └── test.js                     # Test suite
β”œβ”€β”€ package.json
└── README.md

🀝 Contributing

  • Fork the repository
  • Create a feature branch
  • Make your changes
  • Add tests
  • Submit a pull request

πŸ“„ License

MIT License - see LICENSE file for details

⚠️ Disclaimer

This library is for educational and legitimate use only. Please respect Instagram's Terms of Service and use responsibly. The authors are not responsible for any misuse of this library.

πŸ†˜ Support

  • Create an issue on GitHub
  • Check the documentation
  • Review the test examples

πŸ”„ Updates

Stay updated with the latest features and security patches by regularly updating the library:

npm update instagram-api-client

Made with ❀️ for the Instagram developer community

Keywords

instagram

FAQs

Package last updated on 23 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts