zca-js is an unofficial JavaScript/TypeScript library designed to interact with the Zalo platform for personal accounts by simulating a web browser's interaction with Zalo Web. The current stable version is 2.1.2, and the project maintains an active release cadence, frequently publishing patches and minor updates to address bugs and introduce new API functionalities. It ships with TypeScript types, facilitating robust development. A key differentiator is its approach of simulating browser behavior, which allows access to features typically unavailable through official APIs. However, this method comes with a significant warning: using the library carries a risk of account suspension or banning, and the maintainers explicitly disclaim responsibility for such outcomes. Developers are advised to proceed with caution and consider using dedicated test accounts.
npm install zca-jsVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to log in with a QR code, set up a listener for incoming messages, and implement a basic echo bot that replies to direct and group messages received.
Install `sharp` (e.g., `npm install sharp`) and pass an `imageMetadataGetter` function (as shown in the README) to the `Zalo` constructor.
Update any calls from `getRequestStatus` to `getFriendRequestStatus` in your codebase.
Proceed with extreme caution. It is strongly recommended to use this library only with a dedicated test account and to be aware of the potential consequences.
Ensure no other Zalo web sessions are open or active when running the listener to maintain continuous operation. Implement robust reconnection logic for production use cases.
Regularly update `zca-js` to the latest version and monitor the GitHub repository for announcements regarding compatibility issues and new releases.
Upgrade to `zca-js` `v2.0.4` or newer to ensure `loginQR` correctly rejects its promise upon abortion, allowing for proper error handling with `.catch()`.
Upgrade to `zca-js` `v2.1.2` or newer to benefit from fixes addressing cookie parsing and domain handling, which are essential for stable authentication and session management.
Upgrade to `zca-js` `v2.0.0-beta.26` or newer, which integrated `json-bigint` to correctly handle large integer values from the Zalo API, preventing data corruption.