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

@rxabdullah/hopenity

v0.0.1

Published

HCA — Hopenity Chat API. unofficial Node.js library for Hopenity.

Readme

@hca-rx/hopenity 〄

HCA is an unofficial Node.js client for Hopenity — built for reliable, fast, and modular bot development. Designed with clean FCA-style API, it gives you full control over Hopenity chat automation through a simple, stable interface.

Zero external dependencies — pure Node.js https / http / events.


✨ Features

  • 🔐 Secure Login — Email or phone number authentication with device approval support
  • 💬 Real-time Messaging — Poll and receive messages, replies, reactions, and group events
  • 📎 Attachments — Upload and send files, images, and media
  • 👥 Full Group Control — Create, join, leave, manage members and admins
  • 🔔 Notifications — Fetch and mark notifications as read
  • 🎵 Media & Extras — Music, stories, donations, premium calls, LiveKit tokens
  • 🛡️ Self-Defending — Core source is protected against copying and tampering
  • FCA-Style API — Familiar structure for anyone who has used fca-unofficial or ws3-fca

📦 Installation

npm install hca

🚀 Quick Start

const hca = require("hca");

(async () => {
  const session = await hca.login({
    email: "[email protected]",
    password: "yourpassword",
  });

  session.listen({ interval: 3000 }, async (err, event) => {
    if (err) return console.error(err);

    if (event.type === "message") {
      console.log(`${event.senderName}: ${event.body}`);
      await session.sendMessage(event.threadID, "Hello!", {
        isGroup: event.isGroup,
      });
    }
  });
})();

🔑 Login

// Login with email
const session = await hca.login({
  email: "[email protected]",
  password: "yourpassword",
});

// Login with phone number
const session = await hca.login({
  phoneNumber: "01XXXXXXXXX",
  password: "yourpassword",
});

📲 Device Approval

If Hopenity requires approval from a trusted device:

try {
  const session = await hca.login({ email, password });
} catch (err) {
  if (err.requiresApproval) {
    console.log("Approve from a trusted device:", err.message);

    const session = await hca.waitForDeviceApproval(
      err.requestToken,
      null,
      { interval: 5000, timeout: 120000 }
    );
  }
}

👂 session.listen(opts, callback)

Listens for new messages, replies, reactions, and group events.

const stop = session.listen({
  interval: 3000,        // message poll interval ms   (default: 3000)
  selfListen: false,     // emit your own messages?    (default: false)
  groupEvents: true,     // track group changes?       (default: true)
  reactionEvents: true,  // track reactions?           (default: true)
}, (err, event) => {
  if (err) return console.error(err);

  if (event.type === "message") { /* new message */ }
  if (event.type === "reply")   { /* reply to a message */ }
  if (event.type === "reaction"){ /* reaction on a message */ }
  if (event.type === "event")   { /* group event */ }
});

stop(); // stop listening

📨 Message / Reply Fields

| Field | Type | Description | |---|---|---| | type | string | "message" or "reply" | | senderID | string | Sender user ID | | senderName | string | Sender display name | | body | string | Message text | | threadID | string | Conversation ID | | messageID | string | Message ID | | timestamp | number | Unix ms | | attachments | Array | Attached files | | isGroup | boolean | Is it a group chat? | | replyToId | string\|null | ID of the message being replied to | | isSelf | boolean | Sent by the logged-in account? |

📣 Group Event Types (event.logMessageType)

| Value | Description | |---|---| | log:subscribe | Member joined or was added | | log:unsubscribe | Member left or was removed | | log:admin-promote | Member promoted to admin | | log:admin-demote | Admin demoted to member | | log:thread-name | Group name changed | | log:thread-image | Group avatar changed |


📖 API Reference

💬 Messages

await session.sendMessage(threadID, "Hello!", { isGroup: false });
await session.sendAttachment(threadID, buffer, { fileName: "photo.jpg", mimeType: "image/jpeg", isGroup: false });
await session.getMessages(threadID, { limit: 20, isGroup: false });
await session.deleteMessage(threadID, messageID, { isGroup: false });
await session.reactToMessage(threadID, messageID, "❤️", { isGroup: false });
await session.markAsRead(threadID, { isGroup: false });

🔍 Threads & Users

await session.getThreadList();
await session.searchUsers("John");
await session.getUserInfo(userId);
await session.acceptChatRequest(chatId, userId);

👥 Groups

await session.getGroups();
await session.getGroupInfo(groupId);
await session.getGroupMembers(groupId);
await session.joinGroup(groupId);
await session.leaveGroup(groupId);
await session.createGroup({ name: "My Group", memberIds: ["id1", "id2"] });
await session.updateGroupInfo(groupId, { name: "New Name" });
await session.addUserToGroup(groupId, userId);
await session.removeUserFromGroup(groupId, userId);
await session.promoteAdmin(groupId, userId);
await session.demoteAdmin(groupId, userId);

🔔 Notifications

await session.getNotifications({ page: 1, limit: 50 });
await session.markAllNotificationsRead();

🎵 Media & Extras

await session.getStories();
await session.getMyPages();
await session.getMusicList();
await session.getMusicTracks();
await session.getDonations();
await session.getPremiumCalls();
await session.getLiveKitToken({ liveKitRoom: "room", conversationId: "id" });
await session.updateFCMToken(fcmToken);
await session.updatePrivacySettings(settings);
await session.rawRequest("/api/v1/any-endpoint", { method: "GET" });

🤝 Contributing

Found a bug or want to add something new? Send a Pull Request!

GitHub: https://github.com/abdullahrx07/Hopechat-hca.git

When submitting a PR, include the following info:

GitHub Username : your_github_username
Hopenity ID     : your_hopenity_id
Change / Feature: brief description of what you added or fixed

All PRs are reviewed manually. Hopenity ID is required.


👤 Credits

Made with ❤️ by rX


HCA is unofficial and not affiliated with Hopenity.