fcanew-r3nz75
v10.1.15
Published
Facebook Chat API - Redefine By renz2451 | r3nz75
Maintainers
Readme
🚀 fcanew-r3nz75
🔥 The Ultimate Unofficial Facebook Messenger Bot API for Node.js ⚡ ASTRO STAR RENZ Engine · 🔐 Signal Protocol E2EE · 🛡️ sessionGuard · 🌐 90+ API Methods · ⚡ Zero TypeScript ✨ Features • 📦 Installation • ⚡ Quick Start • 🔐 E2EE • 🛡️ sessionGuard • 📡 sendBroadcast • 📖 API Reference
🏆 features fcanew-r3nz75
· ✅ ⚡ ASTRO STAR RENZ Engine — Next-gen MQTT core with E2EE & sessionGuard integration · ✅ 🔐 Signal Protocol E2EE — Military-grade encryption for Facebook conversations · ✅ 🛡️ sessionGuard — Bulletproof appstate protection with corruption detection & auto-backup · ✅ 📡 sendBroadcast — Lightning-fast multi-thread broadcasting with smart rate limiting · ✅ 🔄 Fixed MQTT race conditions — Say goodbye to "Connection refused: No subscription existed" · ✅ 🛡️ isActiveClient() guard — Zero stale event processing from zombie connections · ✅ ⏱️ Extended connectTimeout — Rock-solid stability even on slow networks · ✅ 🔁 autoReconnect — Seamless reconnection on connection drops · ✅ 🐐 GoatBot compatible — Drop-in replacement, all API signatures preserved · ✅ 🌐 90+ Powerful API methods — Everything from messages to polls, stickers to E2EE
✨ Killer Features
· ✅ Complete Messenger API — Messages, reactions, attachments, stickers, polls, pins & more · ✅ ⚡ ASTRO STAR RENZ MQTT — Ultra-stable connection with autoReconnect, jitter, & isActiveClient guard · ✅ 🔐 E2EE Ready — Full Signal Protocol support (connectE2EE, listenE2EE, e2ee.* methods) · ✅ 🛡️ sessionGuard — Automatic appstate preservation, corruption shield & .bak backup system · ✅ 📡 sendBroadcast — Parallel/sequential multi-thread messaging with intelligent rate limits · ✅ 🤖 MessengerBot — Discord.js/Telegraf-style elegance (.command, .hears, .launch) · ✅ 🎯 createFcaClient — Clean namespaced architecture (client.messages, client.threads etc.) · ✅ 🐐 GoatBot / Mirai Ready — Seamless drop-in replacement for existing bots
📦 Installation
npm install fcanew-r3nz75💡 Requires Node.js >= 18 for maximum performance and security.
⚡ Quick Start
🚀 Classic Setup (GoatBot Compatible)
const login = require("fcanew-r3nz75");
login({ appState: require("./account.json") }, { listenEvents: true }, (err, api) => {
if (err) throw err;
// 🛡️ Activate session protection
api.sessionGuard("./account.json", {
interval: 3 * 60 * 1000,
debounce: 30 * 1000
});
// 🎧 Start listening
api.listenMqtt((err, event) => {
if (err) throw err;
if (event.type === "message") api.sendMessage(event.body, event.threadID);
});
});🔐 With E2EE Encryption
login({ appState: require("./account.json") }, { listenEvents: true }, async (err, api) => {
if (err) throw err;
// 🛡️ Protect your session
api.sessionGuard("./account.json");
// 🔐 Activate end-to-end encryption
await api.connectE2EE();
// 🎧 Listen for both regular & encrypted messages
api.listenE2EE((err, event) => {
if (err) throw err;
if (event.type === "message") {
if (event.isE2EE) {
api.e2ee.sendMessage(event.threadID, "🔐 Got your encrypted message!");
} else {
api.sendMessage("📨 Got it!", event.threadID);
}
}
});
});🐐 GoatBot Integration
const login = require("fcanew-r3nz75");
login({ appState }, options, async (err, api) => {
if (err) return;
// 🛡️ Session protection
api.sessionGuard(path.join(process.cwd(), "account.txt"), {
interval: 3 * 60 * 1000,
debounce: 30 * 1000
});
// 🔐 Optional: Activate E2EE
try { await api.connectE2EE(); } catch (e) {}
// 🚀 Launch your bot
api.listenMqtt(callback);
});🔐 E2EE — Military-Grade Encrypted Conversations
Leverages Facebook's native Signal Protocol infrastructure for true end-to-end encryption.
🚀 Setup
await api.connectE2EE();
// Auto-generates .ASTRO STAR RENZ/e2ee_device.json
console.log(api.e2ee.isConnected()); // ✅ true🎧 Unified Listener
api.listenE2EE((err, event) => {
if (event.type === "message") {
if (event.isE2EE) {
api.e2ee.sendMessage(event.threadID, "🔐 Encrypted reply incoming!");
} else {
api.sendMessage("📨 Normal reply!", event.threadID);
}
}
});🔧 E2EE Power Methods
await api.e2ee.sendMessage(threadID, "🔒 Secret message!");
await api.e2ee.sendMessage(threadID, { body: "📸 Encrypted photo!", attachment: fs.createReadStream("photo.jpg") });
await api.e2ee.sendReaction(threadID, messageID, "❤️");
await api.e2ee.sendTyping(threadID, true);
await api.e2ee.unsendMessage(messageID, threadID);
await api.e2ee.editMessage(threadID, messageID, "✏️ Updated securely!");
api.e2ee.isConnected(); // Check connection status
await api.e2ee.disconnect(); // Graceful shutdown🛡️ sessionGuard — Your Session's Bodyguard
Never lose your session again! Protects against appstate corruption and silent logouts.
// 🛡️ Basic protection
api.sessionGuard("./account.json");
// ⚙️ Custom configuration
api.sessionGuard("./account.json", {
interval: 3 * 60 * 1000, // Save every 3 minutes
debounce: 30 * 1000 // Wait 30s after last activity
});🎯 What It Does:
· 💾 Auto-saves appstate every N minutes · ⚡ Smart saving after each successful sendMessage (debounced) · 🛡️ Corruption guard — never overwrites good data with corrupted state · 📦 Auto-backup — creates .bak before every overwrite · 🔄 Recovery ready — restore from backup instantly
api.saveSession(); // 💾 Force immediate save
api.restoreSessionBackup(); // 📦 Restore from .bak file
api.stopSessionGuard(); // ⏹️ Stop the protection timer📡 sendBroadcast — Mass Messaging Made Easy
Smart rate-limited broadcasting with multi-thread support.
const result = await api.sendBroadcast(
"📢 Hello everyone!",
["THREAD_1", "THREAD_2", "THREAD_3"],
{
delay: 2000, // ⏱️ 2s between batches
parallel: 2, // 🔄 2 concurrent sends
onEach: (err, info, id) => {
console.log(err ? `❌ Failed: ${id}` : `✅ Sent: ${id}`);
}
}
);
console.log(`📊 ${result.sent.length}/${result.total} messages delivered`);🤖 MessengerBot — Elegant Bot Framework
Build sophisticated bots with Discord.js/Telegraf-style syntax.
const { createMessengerBot } = require("fcanew-r3nz75");
const bot = await createMessengerBot(
{ appState: require("./account.json") },
{ commandPrefix: "/", stopOnSignals: true }
);
// 🎯 Command handling
bot.command("ping", async ctx => await ctx.replyAsync("🏓 Pong!"));
// 👂 Pattern matching
bot.hears(/hello/i, async ctx => await ctx.replyAsync("👋 Hi there!"));
// 📡 Event listening
bot.on("messageCreate", event => console.log(`📨 ${event.body}`));
// 🚀 Launch your bot
await bot.launch({ stopOnSignals: true });🎯 createFcaClient — Clean Architecture
Namespaced API design for better code organization.
const { createFcaClient } = require("fcanew-r3nz75");
const client = createFcaClient(api);
// 📨 Messaging
await client.messages.send("Hello!", threadID);
await client.messages.react("❤️", messageID, threadID);
// 👥 Thread management
await client.threads.getInfo(threadID);
// 👤 User operations
await client.users.getInfo(userID);
// ⚙️ Account settings
await client.account.refreshDtsg();📖 API Reference
💬 Messaging Arsenal
// 📝 Text Messages
api.sendMessage("Hello!", threadID);
api.sendMessage({ body: "📸 Photo!", attachment: fs.createReadStream("photo.jpg") }, threadID);
api.sendMessage({ body: "Hey @John", mentions: [{ id: "uid", tag: "@John", fromIndex: 4 }] }, threadID);
// 🎨 Rich Media
api.sendMessage({ sticker: "369239263222822" }, threadID);
api.sendMessage({ location: { latitude: 23.8, longitude: 90.4, current: true } }, threadID);
api.sendGif("https://media.giphy.com/xyz.gif", threadID);
// 📁 File Sharing
api.sendLocation(23.8, 90.4, threadID);
api.sendImage("./photo.jpg", threadID, "📸 Check this!");
api.sendVideo("./video.mp4", threadID);
api.sendAudio("./voice.ogg", threadID);
api.sendFile("./doc.pdf", threadID);
// 🔗 Links & Contacts
api.shareLink("https://github.com", threadID, "🌟 Amazing repo!");
api.shareContact("🤝 Meet my friend!", userID, threadID);
// 📡 Broadcasting
api.sendBroadcast("📢 Announcement!", ["tid1", "tid2"], { delay: 2000 });⚡ Message Actions
// ✏️ Editing & Removal
api.editMessage("✏️ Updated text", messageID);
api.unsendMessage(messageID);
api.deleteMessage([messageID]);
// 😍 Reactions
api.setMessageReaction("😍", messageID, threadID);
api.setMessageReaction("", messageID); // Remove reaction
// 📥 Retrieval
api.getMessage(threadID, messageID);
api.forwardAttachment(attachmentID, [userID]);
api.uploadAttachment([fs.createReadStream("photo.jpg")]);👀 Read Receipts & Typing
api.markAsRead(threadID);
api.markAsReadAll();
api.markAsDelivered(threadID, messageID);
api.markAsSeen();
api.sendTypingIndicator(threadID, true);👥 Thread Management
// 📊 Information
api.getThreadInfo(threadID);
api.getThreadList(10, null, ["INBOX"]);
api.getThreadHistory(threadID, 20);
// 🏗️ Creation & Deletion
api.createGroup("🎉 New Group!", ["uid1", "uid2"]);
api.deleteThread(threadID);
// ⚙️ Settings
api.muteThread(threadID, 3600);
api.changeArchivedStatus(threadID, true);
api.handleMessageRequest(threadID, true);
api.searchForThread("🔍 query");🎨 Thread Customization
// 🏷️ Basic Customization
api.setTitle("🌟 New Name", threadID);
api.changeThreadColor("#0084FF", threadID);
api.changeThreadEmoji("🔥", threadID);
api.changeNickname("👑 The Boss", threadID, userID);
api.changeGroupImage(fs.createReadStream("group.jpg"), threadID);
// 👑 Admin Controls
api.changeAdminStatus(threadID, userID, true);
api.addUserToGroup(userID, threadID);
api.removeUserFromGroup(userID, threadID);
// 📌 Pins & Polls
api.createPoll("❓ Question?", threadID, { "Yes": false, "No": false });
api.pinMessage(messageID, threadID);
api.unpinMessage(messageID, threadID);👤 User Operations
// 🔍 Information
api.getUserInfo(userID);
api.getUserID("John Doe", callback);
api.getUID("https://facebook.com/zuck");
api.getFriendsList();
api.getAvatarUser(userID);
api.getProfileInfo(userID);
api.getPublicData(userID);
// 🤝 Social Actions
api.sendFriendRequest(userID);
api.handleFriendRequest(userID, true);
api.changeBlockedStatus(userID, true);
api.followUser(userID);
api.unfollowUser(userID);
api.unfriend(userID);🌐 Social Interactions
api.reactToPost(postID, "❤️");
api.reactToComment(commentID, "😂");
api.postComment(postID, "💬 Great post!");
api.sharePost(postID, "📤 Check this out!");⚙️ Account & Configuration
// 🔧 Account
api.getCurrentUserID();
api.getAppState();
api.setOptions({ listenTyping: true });
api.logout();
api.refreshFb_dtsg();
// 🧩 Extensions
api.addExternalModule("myFunc", (defaultFuncs, api, ctx) => {
return function(text, threadID) {
return api.sendMessage("[🤖 BOT] " + text, threadID);
};
});🌐 HTTP Utilities
api.httpGet(url, params, callback);
api.httpPost(url, form, callback);
api.httpPostFormData(url, form, callback);
api.uploadImageToImgbb(imageUrl);📋 Login Options
⚙️ Option 🎯 Type 🔧 Default 📝 Description selfListen boolean false 👂 Receive your own sent messages listenEvents boolean true 📡 Receive thread/group events listenTyping boolean false ⌨️ Receive typing indicator events updatePresence boolean false 🟢 Receive online/offline presence autoMarkDelivery boolean false ✅ Auto-mark messages as delivered autoMarkRead boolean false 👁️ Auto-mark threads as read autoReconnect boolean true 🔁 Auto-reconnect MQTT on disconnect online boolean false 🟢 Appear as online to others emitReady boolean false 🎯 Emit ready event on MQTT connect proxy string — 🌐 HTTP proxy URL userAgent string Safari UA 🖥️ Override HTTP User-Agent
📄 License
MIT License — Free to use, modify, and distribute!
fcanew-r3nz75 crafted by ASTRO STAR RENZ
⚡ ASTRO STAR RENZ Engine — MIT License
🚫 Unauthorized copying or redistribution without proper credit is strictly prohibited.
🌟 Crafted with passion by ASTRO STAR RENZ
💡 Star us on GitHub • 🐛 Report issues • 🤝 Contribute
