Package Information
Documentation
n8n-nodes-facebook-instagram-threads
This is an n8n community node that lets you create and publish content to Facebook, Instagram, and Threads using access token authentication.
This node supports publishing text posts, photos, videos, Reels, carousels, and stories across all three Meta platforms with comprehensive configuration options.
n8n is a fair-code licensed workflow automation platform.
Table of Contents
- Installation
- Prerequisites
- Getting Access Token
- Operations
- Media Format Requirements
- Authentication
- Usage Examples
- Error Handling
- Troubleshooting
- Version History
Installation
Follow the installation guide in the n8n community nodes documentation.
Manual Installation
- Install the package in your n8n installation:
npm install @yaring/n8n-nodes-meta
- Restart your n8n instance.
Docker Installation
Add the package to your n8n Docker container by modifying your docker-compose file or Dockerfile:
RUN npm install -g @yaring/n8n-nodes-meta
Prerequisites
Before using this node, you need:
- Facebook Developer Account: Sign up at developers.facebook.com
- Facebook App: Create a new app in the Facebook Developer Console
- Access Token: Generate access token with required permissions
- Business Verification: Some features require business verification
- Page/Instagram Account: Connected Facebook Page and/or Instagram Business Account
- Threads Account: Professional Threads account linked to Instagram
Getting Access Token
Method 1: Facebook Graph API Explorer (Recommended for Testing)
- Go to Facebook Graph API Explorer
- Select your app from the dropdown
- Click "Generate Access Token"
- Select required permissions:
pages_manage_posts
- Publish to Facebook Pagespages_read_engagement
- Read Page informationinstagram_basic
- Basic Instagram accessinstagram_content_publish
- Publish to Instagrampublish_to_groups
- Publish to Facebook Groupsthreads_basic
- Basic Threads accessthreads_content_publish
- Publish to Threads
- Generate and copy the access token
Method 2: App Dashboard (Production)
- In your Facebook App dashboard, go to "Tools" → "Access Token Tool"
- Generate a User Access Token or Page Access Token
- For long-lived tokens, exchange short-lived tokens using the API
- Copy the access token
Token Types
- User Access Token: For posting to user's own profile and pages they manage
- Page Access Token: For posting specifically to a Facebook page
- App Access Token: For app-level operations (not recommended for posting)
Operations
Facebook Operations
Create Text Post
- Target Types: Page, Group, User Profile
- Required: Target ID, Message
- API Endpoint:
/{target-id}/feed
- Supported: All text formatting, mentions, hashtags
Create Photo Post
- Target Types: Page, Group, User Profile
- Required: Target ID, Photo URL
- Optional: Caption
- API Endpoint:
/{target-id}/photos
- Supported: JPEG, PNG formats
Create Video Post
- Target Types: Page, Group, User Profile
- Required: Target ID, Video URL
- Optional: Video Description
- API Endpoint:
/{target-id}/videos
- Supported: MP4, MOV formats
Create Link Post
- Target Types: Page, Group, User Profile
- Required: Target ID, Link URL
- Optional: Link Message
- API Endpoint:
/{target-id}/feed
- Supported: Automatic link preview generation
Instagram Operations
Create Photo Post
- Required: Instagram Business Account ID, Image URL
- Optional: Caption
- API Process: Create container → Publish
- Supported: JPEG, PNG formats
Create Video Post
- Required: Instagram Business Account ID, Video URL
- Optional: Caption
- API Process: Create container → Publish
- Supported: MP4 format, feed videos (square/landscape)
Create Reels
- Required: Instagram Business Account ID, Reels Video URL
- Optional: Caption, Cover Image URL
- API Process: Create container → Publish
- Supported: MP4 format, vertical orientation (9:16 aspect ratio)
Create Carousel Post
- Required: Instagram Business Account ID, Media Items (multiple photos/videos)
- Optional: Caption
- API Process: Create individual containers → Create carousel → Publish
- Supported: Mix of photos and videos (up to 10 items)
Create Story
- Required: Instagram Business Account ID, Story Media URL, Media Type
- Optional: None
- API Process: Create container → Publish
- Supported: JPEG, PNG for images; MP4 for videos
Threads Operations
Create Text Post
- Required: Threads User ID, Text
- Optional: None
- API Process: Create post → Publish
- Supported: Plain text, mentions, hashtags
Create Photo Post
- Required: Threads User ID, Image URL
- Optional: Text
- API Process: Create post → Publish
- Supported: JPEG, PNG formats
Create Video Post
- Required: Threads User ID, Video URL
- Optional: Text
- API Process: Create post → Publish
- Supported: MP4 format
Media Format Requirements
Images
- Formats: JPEG, PNG
- Max Size: 4MB
- Min Resolution: 200x200px
- Max Resolution: 2048x2048px
- Aspect Ratio: Any (square recommended for best display)
Instagram Feed/Carousel
- Formats: JPEG, PNG
- Max Size: 8MB
- Min Resolution: 320px (any dimension)
- Max Resolution: 1440x1800px
- Aspect Ratio: 1.91:1 to 4:5 (landscape to portrait)
Instagram Stories
- Formats: JPEG, PNG
- Max Size: 8MB
- Resolution: 1080x1920px (recommended)
- Aspect Ratio: 9:16 (vertical)
Threads
- Formats: JPEG, PNG
- Max Size: 8MB
- Min Resolution: 320px (any dimension)
- Aspect Ratio: 1:1 to 4:5 (square to portrait)
Videos
- Formats: MP4, MOV
- Max Size: 4GB
- Max Duration: 240 minutes
- Min Resolution: 720p
- Recommended: H.264 codec, AAC audio
Instagram Feed Video
- Formats: MP4
- Max Size: 1GB
- Max Duration: 60 seconds
- Min Resolution: 720p
- Aspect Ratio: 1.91:1 to 4:5
- Recommended: H.264 codec, AAC audio
Instagram Reels
- Formats: MP4
- Max Size: 1GB
- Max Duration: 90 seconds
- Min Resolution: 720p
- Aspect Ratio: 9:16 (vertical)
- Recommended: H.264 codec, AAC audio, 30fps
Instagram Stories Video
- Formats: MP4
- Max Size: 1GB
- Max Duration: 15 seconds
- Resolution: 1080x1920px
- Aspect Ratio: 9:16 (vertical)
Threads
- Formats: MP4
- Max Size: 1GB
- Max Duration: 5 minutes
- Min Resolution: 720p
- Recommended: H.264 codec, AAC audio
Authentication
This node uses access token authentication:
- Create Credentials: In n8n, create new "Facebook, Instagram & Threads API" credentials
- Enter Access Token: Paste your access token from Facebook Graph API Explorer or App Dashboard
- Set API Version: Choose API version (default: v23.0)
- Test Connection: n8n will automatically test the token validity
Required Permissions
Your access token must include these permissions:
pages_manage_posts
- Publish to Facebook Pagespages_read_engagement
- Read Page informationinstagram_basic
- Basic Instagram accessinstagram_content_publish
- Publish to Instagrampublish_to_groups
- Publish to Facebook Groupsuser_posts
- Post to user timeline (if available)threads_basic
- Basic Threads accessthreads_content_publish
- Publish to Threads
Usage Examples
Example 1: Post to Facebook Page
{
"resource": "facebook",
"operation": "createTextPost",
"targetType": "page",
"targetId": "1234567890123456",
"message": "Hello from n8n! 🚀"
}
Example 2: Instagram Photo with Caption
{
"resource": "instagram",
"operation": "createPhotoPost",
"instagramBusinessAccountId": "1234567890123456",
"imageUrl": "https://example.com/image.jpg",
"caption": "Check out this amazing photo! #n8n #automation"
}
Example 3: Instagram Reels
{
"resource": "instagram",
"operation": "createReels",
"instagramBusinessAccountId": "1234567890123456",
"reelsVideoUrl": "https://example.com/video.mp4",
"reelsCaption": "Amazing automation with n8n! ⚡ #n8n #reels #automation",
"coverImageUrl": "https://example.com/cover.jpg"
}
Example 4: Instagram Carousel
{
"resource": "instagram",
"operation": "createCarouselPost",
"instagramBusinessAccountId": "1234567890123456",
"mediaItems": {
"mediaItem": [
{
"mediaType": "IMAGE",
"mediaUrl": "https://example.com/image1.jpg"
},
{
"mediaType": "VIDEO",
"mediaUrl": "https://example.com/video1.mp4"
}
]
},
"carouselCaption": "Swipe to see more! ➡️"
}
Example 5: Threads Text Post
{
"resource": "threads",
"operation": "createTextPost",
"threadsUserId": "1234567890123456",
"text": "Just automated my social media posting with @n8n 🤖"
}
Getting Account IDs
Facebook Page ID
- Go to your Facebook Page
- Click "About" → "Page Info"
- Scroll down to find "Page ID"
- Or use Graph API:
https://graph.facebook.com/v23.0/me/accounts
Instagram Business Account ID
- Use Facebook Graph API Explorer:
/{page-id}?fields=instagram_business_account
- Or check in your Facebook Page settings under "Instagram"
- Or use Graph API:
https://graph.facebook.com/v23.0/{page-id}?fields=instagram_business_account
Threads User ID
- Use Facebook Graph API Explorer:
/{instagram-account-id}?fields=threads_id
- Requires Instagram account connected to Threads
- Or use Graph API:
https://graph.facebook.com/v23.0/{instagram-account-id}?fields=threads_id
Error Handling
The node includes comprehensive error handling:
- Authentication Errors: Clear messages for invalid/expired tokens
- API Rate Limits: Detailed rate limit information and retry suggestions
- Media Validation: Specific errors for unsupported formats or sizes
- Permission Errors: Detailed explanations for missing permissions
- Facebook Error Codes: Full Facebook error details with trace IDs
Common Error Codes
- 190: Invalid OAuth access token
- 200: Missing required permissions
- 100: Invalid parameter (check media URLs and formats)
- 368: Media violates content policy
- 80001: Instagram account not found or not business account
Troubleshooting
Common Issues
"Invalid OAuth access token"
- Cause: Expired or invalid access token
- Solution: Generate new access token from Facebook Graph API Explorer
"Insufficient permissions"
- Cause: Missing required permissions
- Solution: Generate token with all required scopes listed above
"Media could not be processed"
- Cause: Unsupported media format or size
- Solution: Check media requirements section and convert to supported format
"Page not found"
- Cause: Incorrect Page/Account ID
- Solution: Verify IDs using Facebook Graph API Explorer
"Rate limit exceeded"
- Cause: Too many API calls in short time
- Solution: Implement delays between calls or use different access token
Debug Mode
Enable debug mode to see detailed API responses:
export N8N_LOG_LEVEL=debug
API Versions
This node supports:
- Facebook Graph API: v23.0 (configurable, compatible with v18.0+)
- Instagram Graph API: Latest version
- Threads API: Latest version
Rate Limits
Meta APIs have rate limits per access token:
- Facebook: 200 calls per hour per user
- Instagram: 240 calls per hour per user
- Threads: 1000 calls per 24 hours per user
The node provides detailed error information when rate limits are exceeded.
Support
For support and questions:
- GitHub Issues: Report bugs and feature requests
- n8n Community: Community forum
- Documentation: Meta for Developers
Version History
v0.0.1
- Initial release
- Facebook, Instagram, and Threads support
- Access token authentication
- Instagram Reels support
- All major content types supported
- Comprehensive error handling
- Detailed media format validation