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

aminul-new-fca

v1.0.30

Published

A modern Facebook Chat API fork | Made & Maintained by Aminul Sardar - Enhanced with rate limiting, batch messaging, and utility functions

Readme

Aminul FCA - Facebook Chat API Library

Overview

A modern Facebook Chat API fork for Node.js applications. This library provides a comprehensive set of functions to interact with Facebook Messenger programmatically.

Version: 1.0.29
Author: Aminul Sardar

Project Structure

/
├── index.js           # Mainn entry point with login, rate limiting, connection monitoring
├── utils.js           # Utility functions (HTTP, parsing, validation, helpers)
├── package.json       # Dependencies and project metadata
├── test.js            # Library validation tests
├── src/               # API function modules
│   ├── sendMessage.js
│   ├── sendBatchMessages.js      # NEW: Send multiple messages with delays
│   ├── scheduleMessage.js        # NEW: Schedule messages for later
│   ├── forwardMessage.js         # NEW: Forward messages to threads
│   ├── getThreadInfo.js
│   ├── getThreadMembers.js       # NEW: Get detailed member info
│   ├── getThreadParticipants.js  # NEW: Get thread participants
│   ├── getThreadHistory.js
│   ├── getRecentMessages.js      # NEW: Get recent messages
│   ├── getUnreadThreads.js       # NEW: Get unread threads
│   ├── getOnlineUsers.js         # NEW: Get online friends
│   ├── getMutualFriends.js       # NEW: Get mutual friends
│   ├── searchMessages.js         # NEW: Search message history
│   ├── setTypingStatus.js        # NEW: Set typing indicator
│   ├── listenMqtt.js
│   └── ... (60+ API modules)
└── src/data/          # Static data files

Recent Changes (v1.0.29)

index.js Enhancements

  • Added Rate Limiter - Prevents API abuse with configurable request limits
  • Added Connection Monitor - Tracks connection health and activity
  • Added Event Emitter - Emit events for login, shutdown, errors
  • Added Graceful Shutdown - Clean disconnection helper
  • Added utility exports via login.utils

utils.js New Functions

  • retryWithBackoff() - Retry failed operations with exponential backoff
  • isValidThreadID() / isValidUserID() - ID validation
  • sanitizeMessageBody() - Clean message content
  • parseTimeString() - Parse "5m", "1h" to milliseconds
  • deepClone() - Deep object cloning
  • debounce() / throttle() - Rate limiting helpers
  • generateRandomString() - Random string generator
  • formatFileSize() / formatDuration() - Formatting helpers
  • parseMentions() - Extract mentions from messages
  • sleep() - Async delay utility
  • chunkArray() / uniqueArray() - Array utilities
  • safeJSONParse() - Safe JSON parsing with default

New src/ Modules

  • sendBatchMessages.js - Send multiple messages with configurable delays
  • scheduleMessage.js - Schedule, cancel, and list scheduled messages
  • forwardMessage.js - Forward messages to one or more threads
  • getThreadMembers.js - Get detailed member information
  • getThreadParticipants.js - Get participant profiles
  • getRecentMessages.js - Get recent message history
  • getUnreadThreads.js - List unread conversation threads
  • getOnlineUsers.js - Get currently online friends
  • getMutualFriends.js - Get mutual friends with a user
  • searchMessages.js - Search message content
  • setTypingStatus.js - Control typing indicator

Usage Example

const login = require('aminul-new-fca');

const appState = require('./appstate.json');

login({ appState }, (err, api) => {
  if (err) return console.error(err);
  
  // Send a message
  api.sendMessage("Hello!", "threadID");
  
  // Send batch messages
  api.sendBatchMessages([
    { threadID: "123", body: "Message 1" },
    { threadID: "456", body: "Message 2" }
  ], { delay: 2000 });
  
  // Schedule a message
  api.scheduleMessage.schedule("Reminder!", "threadID", "1h");
  
  // Listen for messages
  api.listenMqtt((err, event) => {
    if (event.type === "message") {
      console.log(event.body);
    }
  });
});

// Use utility functions
await login.utils.waitForRateLimit();
const health = login.utils.getConnectionHealth();

Key Dependencies

  • axios - HTTP client
  • mqtt - MQTT client for real-time messaging
  • request - HTTP requests
  • node-cron - Scheduled tasks
  • websocket-stream - WebSocket support
  • cheerio - HTML parsing

Running Tests

node test.js

Notes

  • This is a library meant to be imported by other Node.js projects
  • Requires a valid Facebook appstate for authentication
  • Rate limiting is built-in to prevent API abuse
  • Connection health monitoring available via login.utils.getConnectionHealth()