Package Exports
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (gao150) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
n8n-nodes-facebook-pro
⚠️ DISCLAIMER: This package uses cookie-based authentication which violates Facebook's Terms of Service. Use at your own risk. Accounts may be suspended or banned.
A comprehensive n8n custom node for Facebook automation using cookie-based authentication. Interact with Pages, Groups, User profiles, Media, Comments, and Messages programmatically.
Features
- ✅ 7 Resource Categories: Page, Group, User, Media, Comment, Message, Utility
- ✅ 31+ Operations: Complete coverage of Facebook actions
- ✅ Cookie-Based Auth: No OAuth tokens required
- ✅ Clean JSON Output: Normalized responses with ISO timestamps
- ✅ Chunked Video Upload: Support for large files (>1GB)
- ✅ Multi-Image Albums: Upload 2-10 images in single album
- ✅ Proxy Support: Built-in proxy configuration
- ✅ Automatic Retry: Exponential backoff for failed requests
Installation
Community Nodes (Recommended)
- Open n8n
- Go to Settings → Community Nodes
- Search for
n8n-nodes-facebook-pro - Click Install
Manual Installation
# Navigate to your n8n custom nodes directory
cd ~/.n8n/custom
# Install the package
npm install n8n-nodes-facebook-pro
# Restart n8nFrom Source
# Clone this repository
git clone https://github.com/yourusername/n8n-nodes-facebook-pro.git
cd n8n-nodes-facebook-pro
# Build the package
npm install
npm run build
# Create installable package
npm pack
# Install in n8n
npm install -g /path/to/n8n-nodes-facebook-pro-1.0.0.tgzGetting Started
1. Extract Facebook Cookies
Using Chrome DevTools:
Open Facebook in Chrome and log in
Press
F12to open DevToolsGo to Application → Cookies →
https://www.facebook.comCopy the following cookie values:
c_userxsdatrfr(optional)sb(optional)
Format as string:
c_user=123456789; xs=abc123def456; datr=xyz789; fr=...
⚠️ Security Warning: Never share your cookies publicly. They grant full access to your Facebook account.
2. Configure Credentials in n8n
- In n8n, create a new Facebook PRO (Cookie) credential
- Paste your cookie string
- (Optional) Add proxy URL:
http://username:password@proxy.com:8080 - (Optional) Customize User-Agent
- Click Save
3. Create Your First Workflow
Example: Create Page Post
- Add node → Facebook PRO
- Select credential
- Resource: Page
- Operation: Create Text Post
- Page ID:
your-page-id - Message:
Hello from n8n! - Execute
Operations Reference
📄 Page (7 Operations)
| Operation | Description |
|---|---|
| Get Page Info | Retrieve page details (name, followers, verified status) |
| Get Posts | Fetch recent posts from page |
| Create Text Post | Publish text post with optional link |
| Create Image Post | Upload and post image (URL or binary) |
| Create Video Post | Upload video with chunked upload support |
| Create Reel | Upload vertical video as Reel |
| Reply to Comment | Reply to comment on page post |
👥 Group (6 Operations)
| Operation | Description |
|---|---|
| Get Group Info | Retrieve group details |
| Get Posts | Fetch group feed |
| Create Post | Post to group as authenticated user |
| Create Post as Page | Post to group as page (unpublished → publish) |
| Upload Photo | Upload image to group |
| Comment on Post | Comment on group post |
👤 User (5 Operations)
| Operation | Description |
|---|---|
| Get User Info | Get authenticated user profile |
| Get Posts | Fetch user timeline posts |
| Create Post | Post to timeline with privacy settings |
| Upload Photo | Upload image to timeline |
| Upload Video | Upload video to timeline |
🎬 Media (2 Operations)
| Operation | Description |
|---|---|
| Upload Album | Create multi-image album (2-10 images) |
| Attach Thumbnail | Add custom thumbnail to video |
💬 Comment (4 Operations)
| Operation | Description |
|---|---|
| Create Comment | Comment on post/photo/video |
| Reply to Comment | Reply to existing comment |
| Get Comment Thread | Fetch all replies to comment |
| Get Comment Count | Get total comment count |
📨 Message (3 Operations)
| Operation | Description |
|---|---|
| Get Conversations | List page inbox conversations |
| Get Messages | Fetch messages from conversation |
| Send Message | Send text/image/video/file to user (PSID required) |
🔧 Utility (4 Operations)
| Operation | Description |
|---|---|
| Get Facebook ID | Extract ID from any Facebook URL |
| Validate Cookies | Test if cookies are still valid |
| Test Proxy | Check proxy connection |
| Raw Graph Request | Make custom Graph API calls (advanced) |
Advanced Examples
Scheduled Reel Publishing
{
"nodes": [
{
"name": "Schedule",
"type": "n8n-nodes-base.scheduleTrigger",
"parameters": {
"rule": { "interval": [{ "field": "hours", "hoursInterval": 6 }] }
}
},
{
"name": "Facebook PRO",
"type": "n8n-nodes-facebook-pro.facebookPro",
"parameters": {
"resource": "page",
"operation": "createReel",
"pageId": "123456789",
"videoUrl": "https://example.com/reel.mp4",
"description": "Daily automation reel! 🚀"
}
}
]
}Multi-Image Album with Dynamic URLs
{
"name": "Upload Album",
"type": "n8n-nodes-facebook-pro.facebookPro",
"parameters": {
"resource": "media",
"operation": "uploadAlbum",
"pageId": "{{$json.pageId}}",
"imageUrls": "{{$json.images.join(', ')}}",
"message": "Check out our new products!"
}
}Auto-Reply to Comments
{
"nodes": [
{
"name": "Webhook",
"type": "n8n-nodes-base.webhook",
"parameters": {
"path": "facebook-comment"
}
},
{
"name": "Facebook PRO",
"type": "n8n-nodes-facebook-pro.facebookPro",
"parameters": {
"resource": "comment",
"operation": "reply",
"commentId": "={{$json.comment_id}}",
"message": "Thanks for your comment! 😊"
}
}
]
}Security Best Practices
1. Use Residential Proxies
Datacenter IPs are easily detected by Facebook. Use residential proxies:
http://username:password@residential-proxy.com:80802. Implement Request Delays
Don't spam requests. Add delays between actions:
- Posting: Wait 2-5 minutes between posts
- Commenting: Wait 30-60 seconds between comments
- Messaging: Wait 1-2 minutes between messages
3. Rotate User-Agents
Change User-Agent periodically to mimic different devices:
const userAgents = [
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36',
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36',
'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36'
];4. Monitor for Checkpoints
Facebook may trigger security checkpoints. Signs:
- Unexpected login prompts
- CAPTCHA requirements
- "Suspicious activity" warnings
Solution: Refresh cookies, use cleaner proxies, reduce activity frequency.
5. Cookie Refresh Strategy
Cookies expire after ~30-90 days. Automate refresh:
- Use Validate Cookies operation daily
- If validation fails, extract new cookies
- Update credential in n8n
Troubleshooting
Error: "Invalid or expired cookies"
Cause: Cookies are no longer valid
Solution:
- Log out of Facebook completely
- Clear browser cookies
- Log in again
- Extract fresh cookies
- Update n8n credential
Error: "Temporarily blocked - Facebook detected unusual activity"
Cause: Too many requests too quickly (Error 368)
Solution:
- Wait 1-24 hours before retrying
- Use residential proxies
- Reduce request frequency
- Spread automation across multiple accounts
Error: "Permission denied"
Cause: Your account doesn't have access to the resource
Solution:
- Verify you're admin/editor of the Page/Group
- Check if your account is restricted
- Try with a different account
Uploads Failing
Cause: Network issues or file too large
Solution:
- Enable Use Chunked Upload for videos >25MB
- Check proxy configuration
- Verify file URL is publicly accessible
- Increase
timeoutin credentials (default: 30000ms)
Proxy Not Working
Cause: Invalid proxy format or proxy server down
Solution:
- Test proxy with Test Proxy operation
- Verify proxy format:
http://user:pass@host:port - Try different proxy provider
- Check if proxy supports HTTPS
API Rate Limits
Facebook has undocumented rate limits. Observed limits:
| Action | Estimated Limit |
|---|---|
| Posts | ~50-100/day per account |
| Comments | ~200-300/day |
| Messages | ~100-200/day |
| API Calls | ~600/hour |
Tips:
- Spread actions across time
- Use multiple Facebook accounts
- Monitor for error code 4 (rate limit)
Development
Clone & Build
git clone https://github.com/yourusername/n8n-nodes-facebook-pro.git
cd n8n-nodes-facebook-pro
npm install
npm run buildRun Tests
npm testLint
npm run lint
npm run lintfixLocal Development with n8n
# Link package
npm link
# In n8n directory
npm link n8n-nodes-facebook-pro
# Start n8n in dev mode
n8n startProject Structure
n8n-nodes-facebook-pro/
├── credentials/
│ └── FacebookProApi.credentials.ts
├── nodes/
│ └── FacebookPro/
│ ├── FacebookPro.node.ts
│ └── facebook.svg
├── actions/
│ ├── page.ts
│ ├── group.ts
│ ├── user.ts
│ ├── media.ts
│ ├── comment.ts
│ ├── message.ts
│ └── utility.ts
├── utils/
│ ├── FacebookApiClient.ts
│ ├── ResponseCleaner.ts
│ ├── MediaUploader.ts
│ └── ErrorHandler.ts
├── types/
│ └── index.ts
└── package.jsonContributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open a Pull Request
License
MIT License - see LICENSE file
Disclaimer
This project is not affiliated with, endorsed by, or connected to Facebook/Meta in any way. Use of this package violates Facebook's Terms of Service. The authors are not responsible for:
- Account suspensions or bans
- Data loss
- Legal consequences
- Any damages resulting from use of this package
Use at your own risk.
Support
- 🐛 Issues: GitHub Issues
- 💬 Discussions: GitHub Discussions
- 📧 Email: your.email@example.com
Changelog
See CHANGELOG.md for version history.
Made with ❤️ for the n8n community