Professional N8N community nodes for seamless Instagram Messaging API integration with OAuth2 authentication.
Installation β’ Features β’ Prerequisites β’ Quick Start β’ Documentation β’ Support
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
- 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
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)
Comment Moderation:
- π Get Comments - Retrieve all comments on your media posts with pagination
- π¬ Get Replies - Fetch replies to specific comments
- β©οΈ Reply to Comment - Post public replies to comments on your media
- π Send Private Reply - Send a DM to users who commented (7-day window)
- ποΈ Delete Comment - Remove unwanted comments from your posts
- ποΈ Hide/Unhide Comment - Toggle comment visibility without deletion
Perfect for:
- π€ Engaging with your audience through comment replies
- π§ Sending exclusive offers via private DM to commenters
- π‘οΈ Moderating spam and unwanted comments
- π Automating comment response workflows (Manychat alternative!)
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
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
- 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+)
For Messaging:
instagram_basic- Basic profile accessinstagram_manage_messages- Send and receive messagespages_manage_metadata- Webhook subscriptionspages_read_engagement- Read engagement data
For Content Publishing (NEW):
instagram_content_publish- Create and publish posts, reels, and storiespages_show_list- List Facebook pagescatalog_management- Product tagging (optional, for Instagram Shopping)
- Node.js 18.15+ or 20.10+
- n8n version 0.196.0 or higher
- HTTPS webhook endpoint (for trigger node)
- Open n8n
- Go to Settings β Community Nodes
- Search for
n8n-nodes-instagram-integrations - Click Install
- Restart n8n
cd ~/.n8n/nodes
npm install n8n-nodes-instagram-integrationsAdd to your docker-compose.yml:
services:
n8n:
environment:
- N8N_COMMUNITY_PACKAGES=n8n-nodes-instagram-integrations- Visit Meta for Developers
- Click Create App
- Select Business type
- Add Instagram product
- Note your App ID and App Secret
- 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
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!
- 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!
- π CHANGELOG.md - Version history and updates
- π§ IMPLEMENTATION_GUIDE.md - Developer documentation
- οΏ½ AUTHENTICATION_GUIDE.md - Setup and OAuth guide
- οΏ½π Instruction Files - Technical specifications
- π QUICKSTART.md - Get started in 5 minutes
- πΈ POST_STORY_GUIDE.md - Complete post/story creation guide
- π‘ EXAMPLES.md - Code examples and workflow patterns
- π FEATURE_SUMMARY.md - Technical implementation details
Messaging:
- Auto-Reply to Messages
- Daily Announcements
- Customer Support Bot
Content Publishing:
- Scheduled Daily Posts
- Automated Carousels
- Story Automation
- Product Showcase Reels
Message Operations:
sendTextMessage- Send text contentsendImageMessage- Send image via URLsendAudioMessage- Send audio filesendVideoMessage- Send video contentsendButtonTemplate- Interactive buttonssendGenericTemplate- Carousel cardssendQuickReplies- Quick response optionsuploadMedia- Upload media files
Post Operations (NEW):
createSinglePost- Create image/video postscreateCarouselPost- Multi-media carouselscreateReel- Short-form videospublishPost- Publish created content
Story Operations (NEW):
createStory- Create and publish stories
Media Operations (NEW):
listMedia- Get your media listgetMedia- Get media detailsgetMediaChildren- Get carousel children
User Operations:
getUserProfile- Fetch user informationgetMyProfile- Get authenticated account info
Comment Operations (NEW in v1.6.0):
getComments- Get all comments on mediagetReplies- Get replies to a commentreplyToComment- Post public replysendPrivateReply- Send DM to commenterdeleteComment- Remove a commenttoggleVisibility- Hide/unhide comment
Webhook Events:
messages- Incoming messagesmessaging_postbacks- Button interactionsmessaging_optins- Consent events
Instagram uses a two-tier token system that this package automatically manages for you:
| Token Type | Validity | Management |
|---|---|---|
| Short-lived | 1 hour | Received from OAuth |
| Long-lived | 60 days | Auto-exchanged on first use |
| Refreshed | 60 days | Auto-refreshed before expiration |
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
β
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
- 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
continueOnFailfor robust error handling
// 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 activeIf 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)
π TOKEN_MANAGEMENT.md - Comprehensive token management guide
π§ TOKEN_MANAGEMENT_IMPLEMENTATION.md - Technical implementation details
- In Meta App Dashboard β Instagram β Webhooks
- Subscribe to
messagesfield - 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
- 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
"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
Enable n8n debug logging:
export N8N_LOG_LEVEL=debug
n8n start- π Instagram Graph API Documentation
- π¬ n8n Community Forum
- π Issue Tracker
- π§ Email: 9259samei@gmail.com
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.
MIT License - see LICENSE.md for details.
Copyright Β© 2025 Mohammad Mahdi Samei
- Built with n8n - Fair-code workflow automation
- Powered by Instagram Graph API
- Icons by Instagram Brand Guidelines