πŸš€ DAY 2 OF LAUNCH WEEK: Unify Your Security Stack with Socket Basics.Learn more β†’
Socket
Book a DemoInstallSign in
Socket

n8n-nodes-instagram-integrations

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

n8n-nodes-instagram-integrations

N8N nodes for Instagram API integration with OAuth2 authentication

Source
npmnpm
Version
1.5.4
Version published
Weekly downloads
1.7K
603.67%
Maintainers
1
Weekly downloads
Β 
Created
Source

n8n-nodes-instagram-integrations

Instagram Banner npm version License: MIT n8n Downloads

Professional N8N community nodes for seamless Instagram Messaging API integration with OAuth2 authentication.

Installation β€’ Features β€’ Prerequisites β€’ Quick Start β€’ Documentation β€’ Support

πŸ“– Overview

This package provides comprehensive Instagram integration for n8n workflows, enabling automated messaging, media management, and webhook-based event handling through the official Instagram Graph API.

Perfect for:

  • πŸ€– Automated customer support via Instagram DM
  • πŸ“’ Marketing campaigns and notifications
  • 🎯 Lead generation and engagement
  • πŸ“Š Customer interaction tracking
  • πŸ”„ Multi-platform messaging automation

✨ Features

πŸ” OAuth2 Authentication

  • One-click authentication - Secure OAuth2 flow similar to Google Drive
  • πŸ†• Automatic long-lived tokens - Short-lived tokens (1 hour) automatically exchanged for long-lived tokens (60 days)
  • πŸ†• Automatic token refresh - Tokens refresh automatically before expiration (zero configuration)
  • πŸ†• No more "refreshToken is required" errors - Smart token lifecycle management prevents expiration issues
  • Multiple credential types - OAuth2 or manual access token
  • Auto-discovery - Automatically fetches Instagram Business Account ID

πŸ“¬ Instagram Messaging Node

Message Types:

  • πŸ’¬ Text Messages - Send formatted text with up to 1000 characters
  • πŸ–ΌοΈ Image Messages - Share images via public HTTPS URLs
  • 🎡 Audio Messages - Send voice messages and audio files
  • 🎬 Video Messages - Share video content
  • πŸ“€ Media Upload - Upload and publish photos, videos, reels, and stories

Interactive Templates:

  • πŸ”˜ Button Templates - Up to 3 action buttons (web links or postbacks)
  • 🎴 Generic Templates - Carousel cards with images and buttons
  • ⚑ Quick Replies - Up to 13 quick response options

User Management:

  • πŸ‘€ Get User Profile - Retrieve user information (name, username, profile picture)

οΏ½ Instagram Content Publishing (NEW!)

Post Creation:

  • πŸ“· Single Posts - Create image or video feed posts
  • 🎞️ Carousel Posts - Multi-media posts (2-10 images/videos)
  • 🎬 Reels - Short-form videos up to 60 seconds
  • πŸ“‹ Stories - 24-hour temporary content

Advanced Features:

  • 🏷️ User Tagging - Tag up to 20 users with precise positioning
  • πŸ›οΈ Product Tagging - Tag products from Facebook catalog
  • 🀝 Collaborators - Tag other accounts as collaborators
  • πŸ“ Location Tagging - Add location stickers to posts
  • 🎨 Custom Thumbnails - Set video thumbnail positions
  • 🎡 Audio Attribution - Name audio tracks in reels

Media Management:

  • πŸ“Š List Media - Get paginated list of your media
  • πŸ” Get Media Details - Retrieve specific media information
  • πŸ‘Ά Get Carousel Children - Access individual carousel items

Instagram Trigger Node

Webhook Events:

  • πŸ’¬ New Messages - Trigger on incoming messages
  • πŸ”˜ Postback Events - Handle button clicks and interactions
  • βœ… Opt-in Events - Process user consent actions
  • πŸ’­ Comments (NEW!) - Trigger when someone comments on your media
  • 🏷️ Mentions (NEW!) - Trigger when someone mentions you in comments or stories

Dual Output System:

  • Output 1 (Messages/Postbacks/Opt-ins) - Direct messaging events
  • Output 2 (Comments/Mentions) - Content engagement events

Security Features:

  • πŸ”’ Webhook signature validation (X-Hub-Signature-256)
  • βœ“ Verify token authentication
  • πŸ›‘οΈ HMAC SHA256 cryptographic verification

πŸ“‹ Prerequisites

Required Accounts

  • Facebook Page - Active Facebook page
  • Instagram Business Account - Connected to your Facebook page
  • Meta Developer Account - Access to Facebook Developer Console
  • n8n Instance - Self-hosted or cloud (version 0.196.0+)

Required Permissions

For Messaging:

  • instagram_basic - Basic profile access
  • instagram_manage_messages - Send and receive messages
  • pages_manage_metadata - Webhook subscriptions
  • pages_read_engagement - Read engagement data

For Content Publishing (NEW):

  • instagram_content_publish - Create and publish posts, reels, and stories
  • pages_show_list - List Facebook pages
  • catalog_management - Product tagging (optional, for Instagram Shopping)

Technical Requirements

  • Node.js 18.15+ or 20.10+
  • n8n version 0.196.0 or higher
  • HTTPS webhook endpoint (for trigger node)

πŸš€ Installation

  • Open n8n
  • Go to Settings β†’ Community Nodes
  • Search for n8n-nodes-instagram-integrations
  • Click Install
  • Restart n8n

Option 2: npm Installation

cd ~/.n8n/nodes
npm install n8n-nodes-instagram-integrations

Option 3: Docker

Add to your docker-compose.yml:

services:
  n8n:
    environment:
      - N8N_COMMUNITY_PACKAGES=n8n-nodes-instagram-integrations

🎯 Quick Start

Step 1: Create Meta App

  • Visit Meta for Developers
  • Click Create App
  • Select Business type
  • Add Instagram product
  • Note your App ID and App Secret

Step 2: Connect Facebook Page

  • In App Dashboard β†’ Instagram β†’ Basic Display
  • Add your Instagram Business Account
  • Generate a Page Access Token with required permissions
  • Copy the Instagram Business Account ID

Step 3: Configure n8n Credentials

Using OAuth2 (Recommended):

  • In n8n: Credentials β†’ New β†’ Instagram OAuth2 API
  • Enter:
    • Client ID: Your App ID
    • Client Secret: Your App Secret
  • Click Connect my account
  • Authorize in popup window
  • βœ… Connection established!

Using Access Token:

  • In n8n: Credentials β†’ New β†’ Instagram Access Token API
  • Enter:
    • Access Token: Your Page Access Token
  • Click Save
  • βœ… Account ID auto-discovered!

Step 4: Build Your First Workflow

  • Create new workflow
  • Add Instagram node
  • Select Message β†’ Send Text Message
  • Configure:
    • Credential: Your Instagram credential
    • Recipient ID: Target user's Instagram-scoped ID
    • Message: Your text content
  • Execute!

πŸ“š Documentation

Core Guides

Content Publishing Guides (NEW!)

Example Workflows

Messaging:

  • Auto-Reply to Messages
  • Daily Announcements
  • Customer Support Bot

Content Publishing:

  • Scheduled Daily Posts
  • Automated Carousels
  • Story Automation
  • Product Showcase Reels

API Reference

Message Operations:

  • sendTextMessage - Send text content
  • sendImageMessage - Send image via URL
  • sendAudioMessage - Send audio file
  • sendVideoMessage - Send video content
  • sendButtonTemplate - Interactive buttons
  • sendGenericTemplate - Carousel cards
  • sendQuickReplies - Quick response options
  • uploadMedia - Upload media files

Post Operations (NEW):

  • createSinglePost - Create image/video posts
  • createCarouselPost - Multi-media carousels
  • createReel - Short-form videos
  • publishPost - Publish created content

Story Operations (NEW):

  • createStory - Create and publish stories

Media Operations (NEW):

  • listMedia - Get your media list
  • getMedia - Get media details
  • getMediaChildren - Get carousel children

User Operations:

  • getUserProfile - Fetch user information
  • getMyProfile - Get authenticated account info

Webhook Events:

  • messages - Incoming messages
  • messaging_postbacks - Button interactions
  • messaging_optins - Consent events

οΏ½ Token Management (v1.5.0+)

Automatic Long-Lived Token System

Instagram uses a two-tier token system that this package automatically manages for you:

Token TypeValidityManagement
Short-lived1 hourReceived from OAuth
Long-lived60 daysAuto-exchanged on first use
Refreshed60 daysAuto-refreshed before expiration

How It Works

OAuth Authentication (User action)
         ↓
Short-lived Token (1 hour)
         ↓
First API Call (automatic)
         ↓
Long-lived Token Exchange (automatic)
         ↓
Token Valid for 60 Days
         ↓
Auto-refresh at 53 Days (automatic)
         ↓
Another 60 Days of Validity

Key Features

βœ… Zero Configuration - Everything happens automatically
βœ… No More Errors - "refreshToken is required" error is eliminated
βœ… Smart Refresh - Tokens refresh when at least 24 hours old and expiring within 7 days
βœ… Fallback Protection - If refresh fails, attempts to exchange current OAuth token
βœ… Secure Storage - All tokens encrypted in N8N credential system

Best Practices

  • Keep Workflows Active: Run at least once every 50 days to maintain token validity
  • Monitor Health: Create a weekly health-check workflow (optional)
  • Handle Errors Gracefully: Use continueOnFail for robust error handling

Token Lifecycle Example

// Day 1: OAuth authentication
User authenticates β†’ Short-lived token (expires in 1 hour)

// Day 1: First workflow run
First API call β†’ Automatic exchange β†’ Long-lived token (expires in 60 days)

// Day 53: Automatic refresh (7 days before expiry)
API call β†’ Token check β†’ Auto-refresh β†’ New long-lived token (expires in 60 days)

// Repeat cycle every ~53 days as long as workflows are active

What If Token Expires?

If a workflow is inactive for 60+ days:

  • Token expires and cannot be refreshed
  • Workflow shows error: "Instagram access token has expired"
  • Solution: Reconnect your Instagram OAuth2 credential (takes 30 seconds)

Learn More

πŸ“˜ TOKEN_MANAGEMENT.md - Comprehensive token management guide
πŸ”§ TOKEN_MANAGEMENT_IMPLEMENTATION.md - Technical implementation details

οΏ½πŸ”§ Configuration

Webhook Setup

  • In Meta App Dashboard β†’ Instagram β†’ Webhooks
  • Subscribe to messages field
  • Callback URL: Your n8n webhook URL
    https://your-n8n.com/webhook/instagram
    
  • Verify Token: Enter in both Meta and n8n credentials
  • Click Verify and Save

Rate Limits

  • API Calls: 200 requests per hour per user
  • Messages: 1000 characters max
  • Buttons: 3 per template, 20 characters per title
  • Quick Replies: 13 max per message
  • Webhook Response: Must respond within 20 seconds

πŸ› οΈ Troubleshooting

Common Issues

"Invalid OAuth Access Token"

  • Verify token hasn't expired
  • Check required permissions are granted
  • Regenerate token in Meta Developer Console

"Webhook Verification Failed"

  • Ensure verify token matches in both Meta and n8n
  • Check n8n webhook is publicly accessible via HTTPS
  • Verify firewall allows Meta's IP ranges

"User Cannot Receive Messages"

  • User must initiate conversation first (24-hour window)
  • Use message tags for out-of-window messaging
  • Verify Instagram Business Account is active

"Rate Limit Exceeded"

  • Implement exponential backoff
  • Reduce request frequency
  • Use batch operations where possible

Debug Mode

Enable n8n debug logging:

export N8N_LOG_LEVEL=debug
n8n start

🀝 Support

Resources

Contributing

Contributions are welcome! Please:

  • Fork the repository
  • Create a feature branch
  • Follow existing code style
  • Add tests for new features
  • Submit a pull request

See CODE_OF_CONDUCT.md for guidelines.

πŸ“„ License

MIT License - see LICENSE.md for details.

Copyright Β© 2025 Mohammad Mahdi Samei

πŸ™ Acknowledgments

πŸ“Š Stats

npm downloads license node version

Made with ❀️ for the n8n community | GitHub | npm

Keywords

n8n-community-node-package

FAQs

Package last updated on 05 Oct 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