npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

fca-raihan

v37.2.7

Published

FCA Raihan - Facebook Chat API compatibility build with stable MQTT theme and nickname methods

Readme

💬 fca-riyad

🚀 The Ultimate Unofficial Facebook Messenger Bot API for Node.js

NEXCA Engine · Signal Protocol · sessionGuard · 90+ API Methods

npm license node E2EE

✨ Features · 📦 Installation · 🚀 Quick Start · 🔐 E2EE · 🛡️ sessionGuard · 📡 sendBroadcast · 📖 API Reference


🔥 Why Developers are Switching to fca-riyad?

🚨 STOP using outdated, broken FCA libraries! fca-riyad is engineered for the modern era. We solved the bugs others couldn't and added features everyone wanted.

| | | |---|---| | 🔒 | E2EE SUPPORTED — Full Signal Protocol integration! Your bot can now send & receive encrypted messages flawlessly. | | ⚡ | NEXCA Engine — Ultra-stable MQTT, jitter, and autoReconnect. Zero downtime. | | 🛡️ | sessionGuard — Say goodbye to silent logouts and corrupted appstates! It auto-saves and protects your sessions. | | 📢 | sendBroadcast — Massive, rate-limited multi-thread broadcasting built-in. | | 🛠️ | Fixed Core Bugs — "Connection refused: No subscription existed" and MQTT race conditions? FIXED. | | ⚙️ | RIYAD BOT Framework Native — Drop-in ready, optional threadID, zero TypeScript bloat. | | 🎯 | 90+ API Methods — If Messenger can do it, fca-riyad can do it. Period. |


✨ Mind-Blowing Features

  • 🔒 True E2EE — Signal Protocol encrypted threads (connectE2EE, listenE2EE, e2ee.*).
  • 📡 Full Messenger API — messages, reactions, attachments, stickers, polls, pins, and more.
  • 🚀 NEXCA MQTT — Rock-solid connection with isActiveClient guard.
  • 🛡️ sessionGuard — appstate auto-save, corruption guard, and .bak backup.
  • 📢 sendBroadcast — parallel/sequential multi-thread sending with smart rate limiting.
  • 🤖 MessengerBot — Discord.js/Telegraf style .command, .hears, .launch.
  • 🎯 createFcaClient — Clean namespaced facade (client.messages, client.threads etc.).
  • 🤝 RIYAD BOT Framework native — Built-in, drop-in ready.

📦 Installation

npm install fca-riyad

🟢 Node.js >= 18 required.


🚀 Quick Start

Classic (RIYAD BOT Framework)

const login = require("fca-riyad");

login({ appState: require("./account.json") }, { listenEvents: true }, (err, api) => {
  if (err) throw err;

  api.sessionGuard("./account.json", {
    interval: 3 * 60 * 1000,
    debounce: 30 * 1000
  });

  api.listenMqtt((err, event) => {
    if (err) throw err;
    if (event.type === "message") api.sendMessage(event.body, event.threadID);
  });
});

🔐 With E2EE (Regular + Encrypted Threads)

Unlock the power of true privacy!

login({ appState: require("./account.json") }, { listenEvents: true }, async (err, api) => {
  if (err) throw err;

  api.sessionGuard("./account.json");
  
  // 🚀 Initialize Signal Protocol E2EE
  await api.connectE2EE();

  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);
      }
    }
  });
});

RIYAD BOT Framework login.js

const login = require("fca-riyad");

login({ appState }, options, async (err, api) => {
  if (err) return;

  api.sessionGuard(path.join(process.cwd(), "account.txt"), {
    interval: 3 * 60 * 1000,
    debounce: 30 * 1000
  });

  try { await api.connectE2EE(); } catch (e) {}

  api.listenMqtt(callback);
});

🔒 E2EE — Encrypted Conversations

Uses Facebook's real Signal Protocol infrastructure — same as the official Messenger app.

Setup

await api.connectE2EE();
// Auto-creates .nexca/e2ee_device.json

console.log(api.e2ee.isConnected()); // true

Listen (Regular + E2EE Combined)

api.listenE2EE((err, event) => {
  if (event.type === "message") {
    if (event.isE2EE) {
      api.e2ee.sendMessage(event.threadID, "Encrypted reply! 🔐");
    } else {
      api.sendMessage("Normal reply!", event.threadID);
    }
  }
});

E2EE Methods

await api.e2ee.sendMessage(threadID, "Hello!");
await api.e2ee.sendMessage(threadID, { body: "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!");
api.e2ee.isConnected();
await api.e2ee.disconnect();

🛡️ sessionGuard

Protects your appstate from corruption and silent logouts. Never lose your session again!

api.sessionGuard("./account.json");

// Custom timing
api.sessionGuard("./account.json", {
  interval: 3 * 60 * 1000,
  debounce: 30 * 1000
});

What it does:

  • 🔄 Auto-saves appstate every N minutes
  • 💾 Saves after every successful sendMessage (debounced)
  • 🛡️ Corruption guard — never overwrites a larger appstate with a smaller one
  • 📦 Auto-backup — writes .bak before every overwrite
api.saveSession();           // force save now
api.restoreSessionBackup();  // restore from .bak
api.stopSessionGuard();      // stop the timer

📡 sendBroadcast

Rate-limited multi-thread broadcast. Send to thousands without getting flagged.

const result = await api.sendBroadcast(
  "Hello everyone!",
  ["THREAD_1", "THREAD_2", "THREAD_3"],
  {
    delay: 2000,
    parallel: 2,
    onEach: (err, info, id) => {
      console.log(err ? "Failed: " + id : "Sent: " + id);
    }
  }
);
console.log(result.sent.length + "/" + result.total + " delivered");

🤖 MessengerBot

Discord.js/Telegraf style high-level bot class.

const { createMessengerBot } = require("fca-riyad");

const bot = await createMessengerBot(
  { appState: require("./account.json") },
  { commandPrefix: "/", stopOnSignals: true }
);

bot.command("ping", async ctx => await ctx.replyAsync("pong 🏓"));
bot.hears(/hello/i, async ctx => await ctx.replyAsync("Hi! 👋"));
bot.on("messageCreate", event => console.log(event.body));

await bot.launch({ stopOnSignals: true });

🎯 createFcaClient

Namespaced facade grouping all API methods by domain.

const { createFcaClient } = require("fca-riyad");
const client = createFcaClient(api);

await client.messages.send("Hello!", threadID);
await client.messages.react("❤️", messageID, threadID);
await client.threads.getInfo(threadID);
await client.users.getInfo(userID);
await client.account.refreshDtsg();

📖 API Reference

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);
api.sendMessage({ sticker: "369239263222822" }, threadID);
api.sendMessage({ location: { latitude: 23.8, longitude: 90.4, current: true } }, threadID);
api.sendBroadcast("msg", ["tid1", "tid2"], { delay: 2000 });
api.sendGif("https://media.giphy.com/xyz.gif", threadID);
api.sendLocation(23.8, 90.4, threadID);
api.sendImage("./photo.jpg", threadID, "caption");
api.sendVideo("./video.mp4", threadID);
api.sendAudio("./voice.ogg", threadID);
api.sendFile("./doc.pdf", threadID);
api.shareLink("https://github.com", threadID, "Check this!");
api.shareContact("Meet my friend!", userID, threadID);
api.editMessage("Updated text", messageID);
api.unsendMessage(messageID);
api.deleteMessage([messageID]);
api.setMessageReaction("😍", messageID, threadID);  // threadID optional
api.setMessageReaction("", messageID);               // remove reaction
api.getMessage(threadID, messageID);
api.forwardAttachment(attachmentID, [userID]);
api.uploadAttachment([fs.createReadStream("photo.jpg")]);
api.markAsRead(threadID);
api.markAsReadAll();
api.markAsDelivered(threadID, messageID);
api.markAsSeen();
api.sendTypingIndicator(threadID, true);
api.getThreadInfo(threadID);
api.getThreadList(10, null, ["INBOX"]);
api.getThreadHistory(threadID, 20);
api.createGroup("Hey!", ["uid1", "uid2"]);
api.deleteThread(threadID);
api.muteThread(threadID, 3600);
api.changeArchivedStatus(threadID, true);
api.handleMessageRequest(threadID, true);
api.searchForThread("query");
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);
api.changeAdminStatus(threadID, userID, true);
api.addUserToGroup(userID, threadID);
api.removeUserFromGroup(userID, threadID);
api.createPoll("Question?", threadID, { "Yes": false, "No": false });
api.pinMessage(messageID, threadID);
api.unpinMessage(messageID, threadID);
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);
api.sendFriendRequest(userID);
api.handleFriendRequest(userID, true);
api.changeBlockedStatus(userID, true);
api.followUser(userID);
api.unfollowUser(userID);
api.unfriend(userID);
api.reactToPost(postID, "love");
api.reactToComment(commentID, "haha");
api.postComment(postID, "Great post!");
api.sharePost(postID, "Check this!");
api.getCurrentUserID();
api.getAppState();
api.setOptions({ listenTyping: true });
api.logout();
api.refreshFb_dtsg();
api.addExternalModule("myFunc", (defaultFuncs, api, ctx) => {
  return function(text, threadID) {
    return api.sendMessage("[BOT] " + text, threadID);
  };
});
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 events | | autoMarkDelivery | boolean | false | Auto-mark incoming 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 when MQTT connected | | proxy | string | — | HTTP proxy URL | | userAgent | string | Safari UA | Override HTTP User-Agent |


📄 License

MIT License

fca-riyad by Riyad NEXCA Engine by Deku — MIT License

🚫 Unauthorized copying or redistribution without credit is strictly prohibited.


Made with ❤️ & 🔒 by Riyad