mostakim-fca-v2
v2.3.4
Published
custom fca build by : mostakim (forked from fca-unofficial) with extended features and faster updates.
Maintainers
Readme
mostakim-fca-v2
A custom Facebook Chat API (FCA) built with extended features and faster updates.
📋 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
autoReconnectoption - 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
