fca-sahu
v0.0.10
Published
Lightweight and enhanced unofficial Facebook Chat API client for Messenger automation, real-time MQTT listening, and session-stable chat operations.
Maintainers
Readme
🚀 SAHU-FCA: Unofficial Facebook Chat API
A lightweight, fast, and unofficial API to interact with Facebook Chat programmatically — ideal for building bots, automation systems, and custom messaging tools.
This project is customized and enhanced for improved performance and stability.
Customized by SHAHADAT SAHU
FCA Enhanced by NeoKEX
✨ Features
- Real-time MQTT message listening and sending
- Automatic MQTT reconnection + resume (session-stable)
- Text, reply, attachments, stickers, mentions, and locations
- Thread, user, reaction, typing, and read-state operations
- Auto typing indicator (via
config.jsonor login/setOptions option) - SAHU-FCA connect banner output
- Session recovery, auto-re-login, adaptive rate-limiting, and request validation
- Clean Domain architecture (
messages,threads,users,account,realtime,http,scheduler) - CommonJS + TypeScript consumers (built-in
.d.tstypes) OldMessagefallback for resilient sends
📦 Installation
npm install sahu-fca@latest🚀 Basic Usage
const { login } = require("sahu-fca");
const api = await login({ appState: require("./appstate.json"), listenEvents: true, autoReconnect: true, autoReLogin: false, });
console.log("Logged in:", api.getCurrentUserID?.());
api.listenMqtt(async (error, event) => { if (error) return console.error(error); if (event?.type !== "message" || !event.body) return;
await api.sendMessage(Echo: ${event.body}, event.threadID);
});
«⚠️ Keep "appstate.json" outside your repository.»
📤 Send Message
await api.sendMessage("Hello!", threadID);
// Reply await api.sendMessage("Replying…", threadID, replyToMessageID);
// Attachment const fs = require("fs");
await api.sendMessage( { body: "Photo", attachment: fs.createReadStream("./photo.jpg") }, threadID );
⌨️ Typing Indicator
config.json
{ "enableTypingIndicator": true, "typingDuration": 2500 }
Or during login:
const api = await login({ appState: require("./appstate.json"), enableTypingIndicator: true, typingDuration: 2500, simulateTyping: false });
Runtime:
api.setOptions({ enableTypingIndicator: true, typingDuration: 2000 });
Config Priority
"config.json" → "login({...})" / "api.setOptions()"
After editing "config.json":
api.refreshFcaConfig();
«⚠️ Typing indicators require a live MQTT client with event listening active.»
🔗 Links
📄 License
MIT — original source credits are preserved in the source files and license.
⚠️ Disclaimer
Note: This is an unofficial Facebook API. Use at your own risk. This project is not affiliated with or endorsed by Meta / Facebook in any way.
🚀 DEVELOPMENT APPROACH
- 💻 Copy-paste techniques with customizations
- 🤝 Collaborative development with friends
- 🤖 AI-powered using AI and other advanced tools
