npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

mostakim-fca-v2

v2.3.4

Published

custom fca build by : mostakim (forked from fca-unofficial) with extended features and faster updates.

Readme

mostakim-fca-v2

A custom Facebook Chat API (FCA) built with extended features and faster updates.

npm version npm downloads License: MIT

📋 Features

  • 🚀 Extended Functionality - Enhanced features beyond the original FCA
  • Faster Updates - Regular maintenance and quick bug fixes
  • 💬 Facebook Messenger Integration - Full support for Messenger Bot API
  • 🔄 Real-time Communication - WebSocket support for live messaging
  • 🛡️ Secure - Support for 2FA and modern authentication methods
  • 📦 Easy to Use - Simple API for building messenger bots
  • 🔁 Auto Re-login - Automatically re-authenticates when session expires
  • ⬇️ Media Downloader - Download media from Facebook, TikTok, YouTube, Instagram and more
  • 🔃 Retry Logic - Built-in retry wrapper with exponential backoff

🔧 Requirements

  • Node.js: >= 16.0.0
  • npm: Latest version recommended

📦 Installation

npm install mostakim-fca-v2

🚀 Quick Start

const login = require('mostakim-fca-v2');

login({ appState: YOUR_APP_STATE }, (err, api) => {
    if (err) return console.error(err);

    api.sendMessage("Hello!", threadID);

    api.listen((err, event) => {
        if (err) return console.error(err);
        console.log(event);
    });
});

📚 Usage Examples

Send a Message

api.sendMessage("Hello World!", threadId);

Send an Image

api.sendMessage(
    {
        body: "Check this out!",
        attachments: [require("fs").createReadStream("image.jpg")]
    },
    threadId
);

Get User Info

api.getUserInfo(userIdArray, (err, ret) => {
    if (err) return console.error(err);
    console.log(ret);
});

Listen to Messages

api.listen((err, event) => {
    if (err) return console.error(err);

    if (event.type === "message") {
        console.log(event.body);
        console.log(event.senderID);
    }
});

Download Media

const result = await api.downloadMedia("https://www.facebook.com/...");
console.log(result);

Supported platforms: Facebook, Instagram, TikTok, YouTube, Twitter/X, Pinterest, SoundCloud, Spotify, Threads.

Auto Re-login

await api.autoRelogin();

Session expire হলে automatically re-login হয় (max 5 attempts). Manual call-ও করা যায়।

Retry a Request

const result = await api.retryRequest(
    async () => await api.sendMessage("Hello", threadID),
    { maxRetries: 3, baseDelay: 1000, factor: 2, maxDelay: 15000 }
);

🔑 Key Methods

| Method | Description | |--------|-------------| | login() | Authenticate with Facebook via appState | | sendMessage() | Send messages to a thread | | listen() | Listen for incoming messages and events | | getUserInfo() | Get user profile information | | getThreadInfo() | Get thread/conversation details | | getThreadHistory() | Get message history of a thread | | setTitle() | Change group chat title | | addUserToGroup() | Add users to a group | | removeUserFromGroup() | Remove users from a group | | downloadMedia() | Download media from social platforms | | autoRelogin() | Manually trigger session re-authentication | | retryRequest() | Wrap any async call with retry + backoff | | createPoll() | Create a poll in a thread | | createPost() | Create a Facebook post | | setMessageReaction() | React to a message | | muteThread() | Mute a thread | | deleteMessage() | Delete a message | | unsendMessage() | Unsend a sent message | | uploadAttachment() | Upload an attachment | | sendTypingIndicator() | Show typing indicator | | markAsRead() | Mark thread as read | | changeNickname() | Change nickname in a thread | | changeThreadEmoji() | Change thread emoji | | changeThreadColor() | Change thread color |

For the full list, see the source files in /src.

📦 Dependencies

  • axios - HTTP client for API requests
  • bluebird - Promise library
  • chalk - Terminal string styling
  • cheerio - HTML parsing
  • mqtt - MQTT protocol support
  • ws - WebSocket client
  • sqlite3 - Local database support
  • sequelize - ORM for database operations

See package.json for the complete list.

⚠️ Important Notes

  • This library is unofficial and uses reverse-engineered Facebook APIs
  • Facebook may change their API at any time, which could break this library
  • Use at your own risk and follow Facebook's Terms of Service
  • This is for educational purposes only

🐛 Troubleshooting

Login Issues

  • Make sure your appState is valid and not expired
  • Use autoRelogin() to refresh an expired session

Connection Issues

  • Check your internet connection
  • Try reconnecting or use the built-in autoReconnect option
  • Check if Facebook has made API changes

Message Not Sending

  • Verify the thread ID is correct
  • Ensure the recipient hasn't blocked you
  • Use retryRequest() to handle temporary failures

🤝 Contributing

Found a bug or want to contribute?

  • Open an issue on GitHub
  • Submit a pull request with improvements
  • Share feedback and suggestions

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Credits

Built and maintained by MOSTAKIM

📞 Support

  • Message on Facebook
  • Open an issue on GitHub Issues
  • Visit the npm package: https://www.npmjs.com/package/mostakim-fca-v2

⚡ Disclaimer

This is an unofficial library. We are not affiliated with Facebook or Meta Platforms, Inc. Use responsibly and in accordance with Facebook's Terms of Service.


Made with ❤️ by the mostakim-fca-v2 community