{"id":17593842,"url":"https://github.com/rfs-adreno/zca-js","last_synced_at":"2026-03-17T07:20:43.576Z","repository":{"id":253611724,"uuid":"828905600","full_name":"RFS-ADRENO/zca-js","owner":"RFS-ADRENO","description":"Unofficial Zalo API for JavaScript","archived":false,"fork":false,"pushed_at":"2025-05-13T15:07:40.000Z","size":595,"stargazers_count":170,"open_issues_count":12,"forks_count":99,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-05-13T16:29:09.532Z","etag":null,"topics":["api","bun","javascript","nodejs","typescript","zalo"],"latest_commit_sha":null,"homepage":"https://tdung.gitbook.io/zca-js","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RFS-ADRENO.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-07-15T11:12:07.000Z","updated_at":"2025-05-13T15:07:45.000Z","dependencies_parsed_at":"2024-08-26T16:26:32.040Z","dependency_job_id":"7ba9a50e-96f3-4219-963e-be3deb61273b","html_url":"https://github.com/RFS-ADRENO/zca-js","commit_stats":{"total_commits":139,"total_committers":6,"mean_commits":"23.166666666666668","dds":"0.17985611510791366","last_synced_commit":"f4be0522c0192ad7a7aab31b2e4c34cc5ea1474c"},"previous_names":["rfs-adreno/zca-js"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RFS-ADRENO%2Fzca-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RFS-ADRENO%2Fzca-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RFS-ADRENO%2Fzca-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RFS-ADRENO%2Fzca-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RFS-ADRENO","download_url":"https://codeload.github.com/RFS-ADRENO/zca-js/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253999743,"owners_count":21997320,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","bun","javascript","nodejs","typescript","zalo"],"created_at":"2024-10-22T06:43:21.254Z","updated_at":"2026-03-17T07:20:43.571Z","avatar_url":"https://github.com/RFS-ADRENO.png","language":"TypeScript","funding_links":["https://ko-fi.com/grosse","https://www.paypal.com/paypalme/dungto213"],"categories":[],"sub_categories":[],"readme":"# ZCA-JS\n\n\u003e [!NOTE]\n\u003e This is an unofficial Zalo API for personal account. It work by simulating the browser to interact with Zalo Web.\n\n\u003e [!WARNING]\n\u003e Using this API could get your account locked or banned. We are not responsible for any issues that may happen. Use it at your own risk.\n\n---\n\n## Table of Contents\n\n-   [Installation](#installation)\n    - [Migrate to V2](#migrate-to-v2)\n-   [Documentation](#documentation)\n-   [Basic Usages](#basic-usages)\n    -   [Login](#login)\n    -   [Listen for new messages](#listen-for-new-messages)\n    -   [Send a message](#send-a-message)\n    -   [Get/Send a sticker](#getsend-a-sticker)\n-   [Example](#example)\n-   [Projects \u0026 Useful Resources](#projects--useful-resources)\n-   [Contributing](#contributing)\n-   [License](#license)\n-   [Support Us](#support-us)\n\n## Installation\n\n```bash\nbun add zca-js # or npm install zca-js\n```\n\n### Migrate to V2\n\nSince official version 2.0.0, `zca-js` has removed sharp dependency for image metadata extraction. It now requires users to provide their own `imageMetadataGetter` function when initializing the `Zalo` class if they want to send images/gifs by file path.\n\nExample of custom `imageMetadataGetter` using `sharp`:\n\n```bash\nbun add sharp # or npm install sharp\n```\n\n```javascript\nimport { Zalo } from \"zca-js\";\nimport sharp from \"sharp\";\nimport fs from \"node:fs\";\n\nasync function imageMetadataGetter(filePath) {\n    const data = await fs.promises.readFile(filePath);\n    const metadata = await sharp(data).metadata();\n    return {\n        height: metadata.height,\n        width: metadata.width,\n        size: metadata.size || data.length,\n    };\n}\n\nconst zalo = new Zalo({\n    imageMetadataGetter,\n});\n```\n\n---\n\n## Documentation\n\nSee [API Documentation](https://zca-js.tdung.com) for more details.\n\n---\n\n## Basic Usages\n\n### Login\n\n```javascript\nimport { Zalo } from \"zca-js\";\n\nconst zalo = new Zalo();\nconst api = await zalo.loginQR();\n```\n\n### Listen for new messages\n\n```javascript\nimport { Zalo, ThreadType } from \"zca-js\";\n\nconst zalo = new Zalo();\nconst api = await zalo.loginQR();\n\napi.listener.on(\"message\", (message) =\u003e {\n    const isPlainText = typeof message.data.content === \"string\";\n\n    switch (message.type) {\n        case ThreadType.User: {\n            if (isPlainText) {\n                // received plain text direct message\n            }\n            break;\n        }\n        case ThreadType.Group: {\n            if (isPlainText) {\n                // received plain text group message\n            }\n            break;\n        }\n    }\n});\n\napi.listener.start();\n```\n\n\u003e [!IMPORTANT]\n\u003e Only one web listener can run per account at a time. If you open Zalo in the browser while the listener is active, the listener will be automatically stopped.\n\n### Send a message\n\n```javascript\nimport { Zalo, ThreadType } from \"zca-js\";\n\nconst zalo = new Zalo();\nconst api = await zalo.loginQR();\n\n// Echo bot\napi.listener.on(\"message\", (message) =\u003e {\n    const isPlainText = typeof message.data.content === \"string\";\n    if (message.isSelf || !isPlainText) return;\n\n    switch (message.type) {\n        case ThreadType.User: {\n            api.sendMessage(\n                {\n                    msg: \"echo: \" + message.data.content,\n                    quote: message.data, // the message to reply to (optional)\n                },\n                message.threadId,\n                message.type, // ThreadType.User\n            );\n            break;\n        }\n        case ThreadType.Group: {\n            api.sendMessage(\n                {\n                    msg: \"echo: \" + message.data.content,\n                    quote: message.data, // the message to reply to (optional)\n                },\n                message.threadId,\n                message.type, // ThreadType.Group\n            );\n            break;\n        }\n    }\n});\n\napi.listener.start();\n```\n\n### Get/Send a sticker\n\n```javascript\napi.getStickers(\"hello\").then(async (stickerIds) =\u003e {\n    // Get the first sticker\n    const stickerObject = await api.getStickersDetail(stickerIds[0]);\n    api.sendMessageSticker(\n        stickerObject,\n        message.threadId,\n        message.type, // ThreadType.User or ThreadType.Group\n    );\n});\n```\n\n---\n\n## Example\n\nSee [examples](examples) folder for more details.\n\n---\n\n## Projects \u0026 Useful Resources\n\n\u003cdiv align=\"center\"\u003e\n\n| Repository | Description |\n|    :---    |    :---     |\n| [**ZaloDataExtractor**](https://github.com/JustKemForFun/ZaloDataExtractor) | A browser `Extension` to extract IMEI, cookies, and user agent from Zalo Web. |\n| [**MultiZlogin**](https://github.com/ChickenAI/multizlogin) | A multi-account Zalo management system that lets you log in to and manage multiple accounts simultaneously, with proxy and webhook integration. |\n| [**n8n-nodes-zalo-tools**](https://github.com/ChickenAI/zalo-node) | N8N node for personal Zalo account. |\n| [**Zalo-F12**](https://github.com/ElectroHeavenVN/Zalo-F12) | A collection of JavaScript code snippets to paste into DevTools to change how Zalo Web/PC works. |\n| [**Zalo-F12-Tools**](https://github.com/JustKemForFun/Zalo-F12-Tools) | Toggle hidden modes for Zalo Web. |\n\n\u003c/div\u003e\n\n---\n\n## Contributing\n\nWe welcome contributions from the community! Please see our [Contributing Guidelines](CONTRIBUTING.md) for details on how to:\n\n- 🐛 Report bugs and issues\n- ✨ Suggest new features\n- 🔧 Submit code contributions\n- 📚 Improve documentation\n- 🧪 Add or improve tests\n- 🔒 Report security vulnerabilities\n\nFor more information, please read our [Code of Conduct](CODE_OF_CONDUCT.md) and [Security Policy](SECURITY.md) before participating.\n\n---\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n---\n\n## **Support Us**\n\n- ⭐ **Star our repositories** if you find them useful!  \n- 🔄 **Share** with your network to help us grow  \n- 💡 **Contribute** your ideas and code    \n- ☕ **A coffee**:\n    - [Buy Me a Coffee](https://ko-fi.com/grosse)\n    - [Paypal](https://www.paypal.com/paypalme/dungto213)\n    - [VietQR](https://github.com/user-attachments/assets/e1f319d6-9d11-4082-8248-55b55e645caa)\n    - [Momo](https://me.momo.vn/gMIMulsaUqsbf6iAiXt3)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frfs-adreno%2Fzca-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frfs-adreno%2Fzca-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frfs-adreno%2Fzca-js/lists"}