Package Exports
- devil-x-fca
- devil-x-fca/index.js
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 (devil-x-fca) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
devil-x-fca
Unofficial Facebook Chat API for Node.js - Interact with Facebook Messenger programmatically.
Enhanced & Maintained by Devil-X | Anonymous Cyber Team
🌟 What's New in devil-x-fca
- ✨ Enhanced MQTT connection logging
- 🔄 Auto-reconnect with configurable intervals
- 📊 Better connection status indicators
- 🎨 Improved console output with colors
- 🔐 Enhanced security and stability
- 🚀 Automatic update checking and installation
- 💡 Better error handling and debugging
📦 Installation
npm install devil-x-fcaOr with yarn:
yarn add devil-x-fca🔄 Auto-Update Feature
devil-x-fca includes an automatic update system that keeps your package up-to-date seamlessly:
How It Works
- 🔍 Automatic Check: Checks for updates when you start your bot
- 📋 Shows Changes: Displays recent changelog updates
- 📦 NPM Update: Runs
npm install devil-x-fca@latestautomatically - 🔄 Auto-Restart: Restarts your bot to apply changes
Manual Update
You can also update manually:
npm install devil-x-fca@latest⚠️ Important Disclaimer
We are not responsible if your account gets banned for spammy activities such as:
- Sending lots of messages to people you don't know
- Sending messages very quickly
- Sending spammy looking URLs
- Logging in and out very quickly
🔍 Introduction
Facebook now has an official API for chat bots, however it's only available for Facebook Pages.
devil-x-fca is the only API that allows you to automate chat functionalities on a user account by emulating the browser. This means:
- Making the exact same GET/POST requests as a browser
- Does not work with auth tokens
- Requires Facebook account credentials (email/password) or AppState (Cookies)
🚀 Basic Usage
1. Login and Simple Echo Bot
const login = require("devil-x-fca");
login({ appState: [] }, (err, api) => {
if (err) return console.error(err);
api.listenMqtt((err, event) => {
if (err) return console.error(err);
// Echo back the received message
if(event.type === "message") {
api.sendMessage(event.body, event.threadID);
}
});
});2. Send Text Message
const login = require("devil-x-fca");
login({ appState: [] }, (err, api) => {
if (err) {
console.error("Login Error:", err);
return;
}
let targetID = "000000000000000"; // Replace with actual Facebook ID
let msg = "Hey! I am powered by Devil-X FCA!";
api.sendMessage(msg, targetID, err => {
if (err) console.error("Message Sending Error:", err);
else console.log("Message sent successfully!");
});
});3. Send File/Image
const login = require("devil-x-fca");
const fs = require("fs");
login({ appState: [] }, (err, api) => {
if (err) return console.error("Login Error:", err);
let targetID = "000000000000000";
let imagePath = __dirname + "/image.jpg";
if (!fs.existsSync(imagePath)) {
console.error("Error: Image file not found!");
return;
}
let msg = {
body: "Check out this image!",
attachment: fs.createReadStream(imagePath)
};
api.sendMessage(msg, targetID, err => {
if (err) console.error("Message Sending Error:", err);
else console.log("Message sent successfully!");
});
});📝 Message Types
| Type | Usage |
|---|---|
| Regular text | { body: "message text" } |
| Sticker | { sticker: "sticker_id" } |
| File/Image | { attachment: fs.createReadStream(path) } or array of streams |
| URL | { url: "https://example.com" } |
| Large emoji | { emoji: "👍", emojiSize: "large" } (small/medium/large) |
💾 Saving AppState (Cookies)
To avoid getting locked out of your account, you should extract your AppState (Cookies) using an extension like EditThisCookie or C3C FbState and save it as appstate.json.
const fs = require("fs");
const login = require("devil-x-fca");
login(
{ appState: JSON.parse(fs.readFileSync("appstate.json", "utf8")) },
(err, api) => {
if (err) return console.error("Login Error:", err);
console.log("✅ Logged in successfully!");
}
);🤝 Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a new branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
📄 License
MIT License - See LICENSE for details.
👨💻 Author
Devil-X | Anonymous Cyber Team
⭐ Support
If this project is helpful, please give it a ⭐ on GitHub!
🔗 Links
Disclaimer: This is an unofficial API and is not officially supported by Facebook. Use responsibly.