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

mahmud-fca

v2.0.7

Published

Facebook Chat API - Send messages, listen to chats, manage threads and more. Made by MahMUD.

Readme

mahmud-fca

A modified & improved Facebook Chat API — Fixed and maintained by @mahmudx7


👤 About

mahmud-fca is a Facebook Chat API modified with bug fixes, stability improvements, and extra features for Facebook Messenger bots.


📦 Install

npm install mahmud-fca

Or install directly from GitHub:

npm install github:mahmudx7/mahmud-fca

🚀 Example Usage

const login = require("mahmud-fca");
const fs = require("fs");

login({
  appState: JSON.parse(fs.readFileSync("appstate.json", "utf8"))
}, (err, api) => {
  if (err) return console.error(err);

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

    if (event.type === "message") {
      api.sendMessage("Echo: " + event.body, event.threadID);
    }
  });
});

✨ Features & Changes

  • Auto relogin — Automatically relogins when an error is detected
  • Auto dismiss behavior — Detects and dismisses Facebook's automated behavior checkpoint
  • Added api.relogin() — Manually trigger relogin
  • Added api.stopListenMqtt() — Stop listening to MQTT
  • Added api.getRegion() — Get the server region
  • Fixed api.follow() and other API functions
  • Replaced npmlog with normal console.log to fix render log issues
  • Supports cookie string, cookie array, and JSON appstate

📖 API Reference

api.sendMessage(message, threadID[, callback][, messageID])

Send a message to a thread. Message types:

| Type | Field | |------|-------| | Text | body | | Sticker | sticker | | File/Image | attachment (readable stream) | | URL | url | | Emoji | emoji + emojiSize |


api.listenMqtt(callback)

Listen for messages and events. Enable events with:

api.setOptions({ listenEvents: true });

Enable self-listen:

api.setOptions({ selfListen: true });

api.getAppState()

Returns the current appstate (cookies). Save it to avoid logging in every time:

fs.writeFileSync("appstate.json", JSON.stringify(api.getAppState()));

api.stopListenMqtt()

Stops listening to MQTT.


api.relogin()

Manually triggers a relogin.


api.getRegion()

Returns the current Facebook server region (e.g. PRN, LLA).


⚙️ Options

Pass options as the second argument to login():

login({ appState: [...] }, {
  selfListen: false,
  listenEvents: true,
  autoMarkRead: true,
  autoMarkDelivery: false,
  userAgent: "Mozilla/5.0 ...",
  online: true,
  autoReconnect: true
}, callback);

💾 Saving Session

const fs = require("fs");
const login = require("mahmud-fca");

login({ appState: JSON.parse(fs.readFileSync("appstate.json", "utf8")) }, (err, api) => {
  if (err) return console.error(err);
  fs.writeFileSync("appstate.json", JSON.stringify(api.getAppState()));
});

📬 Contact


⚠️ Disclaimer

This API is not affiliated with or endorsed by Facebook. Misuse may result in account bans. Use responsibly.


📄 License

MIT