JSPM

gao150

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 9
  • Score
    100M100P100Q26272F
  • License MIT

Facebook automation node (Reels, Feed, Page, Group, Comments, Upload) for n8n

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

    NPM Version License

    ⚠️ 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

    1. Open n8n
    2. Go to SettingsCommunity Nodes
    3. Search for n8n-nodes-facebook-pro
    4. Click Install

    Manual Installation

    # Navigate to your n8n custom nodes directory
    cd ~/.n8n/custom
    
    # Install the package
    npm install n8n-nodes-facebook-pro
    
    # Restart n8n

    From 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.tgz

    Getting Started

    1. Extract Facebook Cookies

    Using Chrome DevTools:

    1. Open Facebook in Chrome and log in

    2. Press F12 to open DevTools

    3. Go to ApplicationCookieshttps://www.facebook.com

    4. Copy the following cookie values:

      • c_user
      • xs
      • datr
      • fr (optional)
      • sb (optional)
    5. 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

    1. In n8n, create a new Facebook PRO (Cookie) credential
    2. Paste your cookie string
    3. (Optional) Add proxy URL: http://username:password@proxy.com:8080
    4. (Optional) Customize User-Agent
    5. Click Save

    3. Create Your First Workflow

    Example: Create Page Post

    1. Add node → Facebook PRO
    2. Select credential
    3. Resource: Page
    4. Operation: Create Text Post
    5. Page ID: your-page-id
    6. Message: Hello from n8n!
    7. 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:8080

    2. 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.

    Cookies expire after ~30-90 days. Automate refresh:

    1. Use Validate Cookies operation daily
    2. If validation fails, extract new cookies
    3. Update credential in n8n

    Troubleshooting

    Error: "Invalid or expired cookies"

    Cause: Cookies are no longer valid

    Solution:

    1. Log out of Facebook completely
    2. Clear browser cookies
    3. Log in again
    4. Extract fresh cookies
    5. 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 timeout in credentials (default: 30000ms)

    Proxy Not Working

    Cause: Invalid proxy format or proxy server down

    Solution:

    1. Test proxy with Test Proxy operation
    2. Verify proxy format: http://user:pass@host:port
    3. Try different proxy provider
    4. 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 build

    Run Tests

    npm test

    Lint

    npm run lint
    npm run lintfix

    Local Development with n8n

    # Link package
    npm link
    
    # In n8n directory
    npm link n8n-nodes-facebook-pro
    
    # Start n8n in dev mode
    n8n start

    Project 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.json

    Contributing

    Contributions are welcome! Please:

    1. Fork the repository
    2. Create a feature branch: git checkout -b feature/amazing-feature
    3. Commit changes: git commit -m 'Add amazing feature'
    4. Push to branch: git push origin feature/amazing-feature
    5. 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

    Changelog

    See CHANGELOG.md for version history.


    Made with ❤️ for the n8n community