shankar-fca
v4.1.0
Published
Facebook-chat-api made by Smart Shankar
Maintainers
Readme
🚀 Shankar-FCA (Facebook Chat API)
Created by: Shankar Singhaniya
Version: 4.1.0
License: MIT
Facebook now has an official API for chat bots here.
This API is the only way to automate chat functionalities on a user account. We do this by emulating the browser. This means doing the exact same GET/POST requests and tricking Facebook into thinking we're accessing the website normally.
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... Be responsible Facebook citizens.
📦 Installation
If you want to use shankar-fca, install it from NPM:
npm install shankar-fca🔥 Bleeding Edge (Directly from GitHub)
npm install https://github.com/SHANKAR-PROJECT/try.git✨ Key Features
🔒 Advanced Security Features
- Anti-Detection System - Human-like behavior simulation
- Session Management - Persistent login sessions
- AES-256-GCM Encryption - Secure appstate encryption
- Proxy Rotation - Automatic IP rotation for safety
- Rate Limiting Protection - Prevents Facebook suspension
🛡️ Anti-Detection Measures
- Dynamic User-Agent Rotation - Randomized browser signatures
- Human-like Delays - Natural interaction patterns
- Advanced Headers - Browser-mimicking requests
- Cookie Management - Secure session handling
🤖 Advanced Bot Features
- Auto-Recovery System - Automatic reconnection on failures
- Memory Leak Prevention - Efficient resource management
- Advanced Message Handler - Rich message processing
- Multi-threading Support - Concurrent operations
⚙️ Configuration Options
- 2FA Support - Two-factor authentication
- Auto-Login - Seamless authentication
- Broadcast Messages - Server notifications
- HTML Dashboard - Web interface
- Database Integration - SQLite/JSON storage
🚀 Quick Start
Basic Echo Bot Example
const login = require("shankar-fca");
// Create simple echo bot
login({email: "FB_EMAIL", password: "FB_PASSWORD"}, (err, api) => {
if(err) return console.error(err);
console.log("✅ Login successful!");
api.listen((err, message) => {
if(err) return console.error(err);
// Echo the message back
api.sendMessage(`Echo: ${message.body}`, message.threadID);
});
});Advanced Bot with AppState
const fs = require("fs");
const login = require("shankar-fca");
// Login with saved appstate for faster authentication
login({appState: JSON.parse(fs.readFileSync('appstate.json', 'utf8'))}, (err, api) => {
if(err) return console.error(err);
// Set advanced options
api.setOptions({
listenEvents: true,
selfListen: false,
logLevel: "silent",
updatePresence: true,
forceLogin: true
});
console.log("🤖 Advanced Bot Started!");
var stopListening = api.listenMqtt((err, event) => {
if(err) return console.error(err);
switch(event.type) {
case "message":
if(event.body === '/stop') {
api.sendMessage("👋 Goodbye!", event.threadID);
return stopListening();
}
// Advanced message processing
api.sendMessage(`🔄 Processing: ${event.body}`, event.threadID);
break;
case "event":
console.log("📢 Event:", event);
break;
}
});
});🔐 Saving & Loading Sessions
Save AppState (Recommended)
const fs = require("fs");
const login = require("shankar-fca");
var credentials = {email: "FB_EMAIL", password: "FB_PASSWORD"};
login(credentials, (err, api) => {
if(err) return console.error(err);
// Save session for future use
fs.writeFileSync('appstate.json', JSON.stringify(api.getAppState()));
console.log("💾 Session saved successfully!");
});Load Saved Session
const fs = require("fs");
const login = require("shankar-fca");
// Load saved session
login({appState: JSON.parse(fs.readFileSync('appstate.json', 'utf8'))}, (err, api) => {
if(err) return console.error(err);
console.log("⚡ Fast login successful!");
});⚙️ Configuration File (ShankarFca.json)
The package creates a ShankarFca.json configuration file with extensive customization options:
{
"Language": "en",
"MainName": "[ FCA-SHANKAR ]",
"AutoLogin": false,
"Login2Fa": false,
"EncryptFeature": true,
"AntiSendAppState": true,
"AntiGetInfo": {
"AntiGetThreadInfo": true,
"AntiGetUserInfo": true
},
"AntiStuckAndMemoryLeak": {
"AutoRestart": {
"Use": true
}
}
}📋 Main API Methods
📤 Sending Messages
Text Message
api.sendMessage("Hello World!", threadID);Message with Attachment
const fs = require("fs");
var msg = {
body: "Check this image!",
attachment: fs.createReadStream(__dirname + '/image.jpg')
};
api.sendMessage(msg, threadID);Sticker
api.sendMessage({sticker: "767334476711748"}, threadID);👥 User & Group Management
Get User Info
api.getUserInfo(userID, (err, data) => {
if(err) return console.error(err);
console.log(data);
});Create Group
api.createNewGroup([userID1, userID2], "Group Name", (err, info) => {
if(err) return console.error(err);
console.log("Group created:", info.threadID);
});Add User to Group
api.addUserToGroup(userID, threadID, (err) => {
if(err) return console.error(err);
console.log("User added successfully!");
});🎨 Thread Customization
Change Group Name
api.setTitle("New Group Name", threadID);Change Thread Color
api.changeThreadColor("#ff0000", threadID); // Red colorChange Thread Emoji
api.changeThreadEmoji("🔥", threadID);📬 Advanced Features
Listen to Events
api.setOptions({listenEvents: true});
api.listen((err, event) => {
switch(event.type) {
case "message":
// Handle messages
break;
case "event":
// Handle events (user join/leave, etc.)
break;
}
});Mark as Read
api.markAsRead(threadID, (err) => {
if(err) return console.error(err);
});Send Typing Indicator
var stopTyping = api.sendTypingIndicator(threadID, (err) => {
if(err) return console.error(err);
// Stop typing after 3 seconds
setTimeout(() => stopTyping(), 3000);
});🔧 Advanced Security Configuration
Enable 2FA Authentication
// In ShankarFca.json
{
"Login2Fa": true,
"AuthString": "YOUR_2FA_CODE_HERE"
}Enable AppState Encryption
// In ShankarFca.json
{
"EncryptFeature": true
}🛡️ Security Best Practices
- Use AppState: Always save and reuse appstate to avoid frequent logins
- Enable 2FA: Add two-factor authentication for extra security
- Rate Limiting: Don't send messages too quickly
- Genuine Account: Use real, verified Facebook accounts
- Regular Breaks: Take breaks between bot operations
🧪 Testing Your Bots
Use Facebook Whitehat Accounts for testing without creating additional accounts.
🎯 Thread Colors
Available thread colors:
const colors = {
DefaultBlue: "196241301102133",
HotPink: "169463077092846",
AquaBlue: "2442142322678320",
BrightPurple: "234137870477637",
Orange: "175615189761153",
Green: "2136751179887052",
Red: "2129984390566328",
Yellow: "174636906462322"
};📊 Performance Monitoring
Memory Usage Monitoring
// Automatic memory monitoring enabled by default
{
"AntiStuckAndMemoryLeak": {
"AutoRestart": {
"Use": true
},
"LogFile": {
"Use": true
}
}
}❓ Frequently Asked Questions
Q: How do I avoid being banned?
A: Follow Facebook's terms of service, use rate limiting, don't spam, and use genuine accounts.
Q: Can I run multiple bots?
A: Yes, but use different accounts and implement proper delays between operations.
Q: How do I handle login approvals?
A: Enable 2FA in configuration or handle the approval callback manually.
Q: Why am I getting "login-approval" error?
A: Enable forceLogin: true in options or set up 2FA authentication.
🏗️ Projects Using This API
- SMART-SHANKAR-BOT - Advanced Facebook Messenger Bot
- C3C Bot - Customizable bot with plugins
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
📜 License
This project is licensed under the MIT License - see the LICENSE file for details.
👨💻 Author
Shankar Singhaniya
- GitHub: @SHANKAR-PROJECT
- Facebook: Facebook Profile
🙏 Acknowledgments
Special thanks to all contributors and the Facebook Chat API community.
⚠️ Important Notice: This API is for educational purposes. Please respect Facebook's Terms of Service and use responsibly.
🔗 Repository: https://github.com/SHANKAR-PROJECT/try
📦 NPM Package: https://www.npmjs.com/package/shankar-fca
