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-sifu

v1.0.4

Published

A modern Facebook Chat API for Node.js Build by SIFAT— real-time MQTT messaging, auto session revival, encrypted vault, smart rate-limiting, and a full Messenger surface. Drop-in compatible with popular bot frameworks.

Readme

npm downloads node license stars

Install · Quick Start · API Reference · Stealth System · Themes · FAQ


Overview

FCA-SIFU is a drop-in Facebook Chat API built for longevity. It replaces polling with a direct MQTT connection, wraps every session in a layered protection stack, and exposes the full Messenger surface through a clean async API.

Works out of the box with Goat-Bot V2, Mirai, MARIN-BOT-V1, and any bot that previously used fca-unofficial.

Feature Matrix

| Area | What you get | |------|-------------| | Transport | MQTT-first, sub-second delivery, auto-reconnect | | Session | Cookie + email/password login, TOTP 2FA support | | Stealth | Identity rotation, warmup mode, circuit breaker | | Reliability | Auto-revival, token refresh cycle, session watchdog | | Rate limiting | Adaptive gate — stays under Facebook's thresholds | | Vault | AES-encrypted runtime secret store (SifuCipher) | | Messaging | Send, edit, react, unsend, forward, broadcast | | Threads | Create, manage, archive, delete, theme, emoji | | AI Themes | Generate Messenger themes from a text prompt | | Media | Attachments, images, video, location, stickers | | Users | Profile, avatar, bio, cover, friends, block | | Groups | Create, admin, image, polls, notes, add/remove | | TypeScript | Full .d.ts type definitions included |

Install

npm install fca-sifu

Requires Node.js ≥ 18

Quick Start

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

login({ appState: require("./appstate.json") }, (err, api) => {
    if (err) return console.error(err);

    api.setOptions({
        listenEvents:     true,
        autoMarkDelivery: true,
        autoMarkRead:     false,
    });

    api.listenMqtt((err, event) => {
        if (err) return console.error(err);

        if (event.type === "message" && event.body === "/ping") {
            api.sendMessage("pong", event.threadID);
        }
    });
});

Both callback and Promise styles are supported on every method.

Login Options

Export cookies from your browser with a tool like C3C FBState, save as appstate.json, then:

login({ appState: require("./appstate.json") }, callback);
login({ email: "[email protected]", password: "••••••••" }, callback);
login({
    email:      "[email protected]",
    password:   "••••••••",
    totpSecret: "YOUR_TOTP_SECRET",
}, callback);
login(credentials, {
    online:           true,
    selfListen:       false,
    listenEvents:     true,
    autoMarkDelivery: true,
    autoReconnect:    true,
    proxy:            "http://user:pass@host:port",
}, callback);

API Reference

Messaging

// Send
api.sendMessage("Hello!", threadID);
api.sendMessage({ body: "look", attachment: fs.createReadStream("img.png") }, threadID);

// Edit / delete
api.editMessage("corrected text", messageID);
api.unsendMessage(messageID);

// Forward
api.forwardMessage(messageID, threadID);
api.broadcastMessage("Announcement", [id1, id2, id3]);

// Schedule (sends after delay)
api.scheduleMessage("Reminder!", threadID, Date.now() + 60_000);

Reactions & Receipts

api.setMessageReaction("❤️", messageID);
api.markAsRead(threadID);
api.markAsDelivered(threadID);
api.markAsReadAll();

// Auto-unsend any message the bot sent when someone reacts
api.unsendOnReaction();                        // all reactions
api.unsendOnReaction({ triggers: ["😡","👎"] }); // specific reactions
api.unsendOnReaction.disable();

Call unsendOnReaction() before listenMqtt() so it can hook into the stream.

Threads

api.getThreadInfo(threadID);
api.getThreadHistory(threadID, 30, null);
api.getThreadList(10, null, ["INBOX"]);
api.changeNickname("Bot", threadID, userID);
api.changeGroupImage(imageStream, threadID);
api.changeThreadName("New name", threadID);
api.createNewGroup([uid1, uid2], "Group name");
api.addUserToGroup(userID, threadID);
api.removeUserFromGroup(userID, threadID);
api.changeAdminStatus(threadID, userID, true);
api.createPoll("Question?", threadID, { "Yes": true, "No": false });

Users & Friends

api.getUserInfo(userID);
api.getUserInfoV2(userID);
api.getFriendsList();
api.addFriend(userID);
api.changeAvatar(imageStream);
api.changeBio("New bio");

Real-time

api.listenMqtt(callback);    // start listener
api.stopListening();          // stop listener
api.isSessionAlive();         // → Promise<boolean>
api.getHealthStatus();        // MQTT, rate-limiter, token cycle stats

Session & Tokens

api.getAppState();            // export current cookie state
api.refreshTokens();          // force token refresh
api.getCycleStatus();         // token cycle health
api.disconnect();             // graceful logout

AI Themes

Generate and apply Messenger themes from a natural-language prompt.

// Generate themes
const themes = await api.createAITheme("ocean sunset", 3);
console.log(themes[0].name, themes[0].preview_image_urls.light_mode);

// Apply a theme to a thread
await api.setThreadTheme(threadID, { themeId: themes[0].id });

// Or use the unified theme() helper
await api.theme("ai:dark neon galaxy", threadID);
await api.theme("list", threadID);   // list all available themes
await api.theme("ocean", threadID);  // fuzzy match by name
await api.theme("undo", threadID);   // revert to previous

// Full AI theme producer (structured output)
const result = await api.produceMetaTheme("aurora borealis", { numThemes: 2 });
console.log(result.themes[0].colors.gradient);

Stealth System

Four cooperating managers run automatically after login:

┌─────────────┬─────────────────────────────────────────────────┐
│ Shield      │ Circuit breaker + warmup mode on fresh starts   │
│ Revive      │ Detects expired sessions and re-authenticates   │
│ Heartbeat   │ Refreshes auth tokens before expiry             │
│ Gate        │ Adaptive rate-limiter, respects FB thresholds   │
└─────────────┴─────────────────────────────────────────────────┘

You can inspect or control them at runtime:

api.shield.getStatus();
api.shield.reset();
api.isAutoReviveActive();
api.enableAutoRevive(false);

const { globalRateLimiter, globalShield, globalMonitor } = require("fca-sifu");
globalRateLimiter.pause(5000);
globalShield.setDailyLimit(200);

Encrypted Vault

const { globalCipher } = require("fca-sifu");

globalCipher.set("myToken", "secret-value");
globalCipher.get("myToken");   // decrypted
globalCipher.delete("myToken");

Top-level Exports

const {
    connect,              // login function
    globalShield,         // circuit breaker
    globalReviveManager,  // session revival
    globalGate,           // rate limiter
    globalRateLimiter,    // rate limiter (alias)
    globalMonitor,        // telemetry
    globalCache,          // in-memory cache
    globalCipher,         // encrypted vault
    CycleManager,         // token refresh
    TokenRefreshManager,
    SifuCipher,
    configureRateLimiter,
    getRateLimiterStats,
} = require("fca-sifu");

Compatibility

| Framework | Status | |-----------|--------| | Goat-Bot V2 | Drop-in | | Mirai | Drop-in | | MARIN-BOT-V1 | Drop-in | | fca-unofficial | Drop-in replacement | | Custom bots | Full support |

FAQ

const [api1, api2] = await Promise.all([
    login({ appState: state1 }),
    login({ appState: state2 }),
]);

Each call returns an independent API instance with its own session.

Disclaimer

This project is not affiliated with, endorsed by, or sponsored by Meta Platforms. Use at your own risk and in accordance with Facebook's Terms of Service. The maintainers accept no liability for account actions taken by Meta.

License

MIT © 2026 SIFAT


Built by SIFAT · GitHub · npm

If FCA-SIFU saved you time, a ⭐ on GitHub goes a long way.