{"id":24993759,"url":"https://github.com/zeative/zaileys","last_synced_at":"2025-04-19T21:15:14.563Z","repository":{"id":275753276,"uuid":"927078607","full_name":"zeative/zaileys","owner":"zeative","description":"Zaileys - Simplify Typescript/Javascript WhatsApp NodeJS API","archived":false,"fork":false,"pushed_at":"2025-02-09T13:21:20.000Z","size":312,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-09T12:04:19.037Z","etag":null,"topics":["automation","bot-zaileys","js-whatsapp","multi-device","wa-simplify","whatsapp","whatsapp-api","zaileys"],"latest_commit_sha":null,"homepage":"https://zeative.github.io/zaileys/","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/zeative.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}},"created_at":"2025-02-04T11:18:05.000Z","updated_at":"2025-02-09T13:21:24.000Z","dependencies_parsed_at":"2025-02-04T12:41:47.629Z","dependency_job_id":null,"html_url":"https://github.com/zeative/zaileys","commit_stats":null,"previous_names":["zeative/zaileys"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeative%2Fzaileys","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeative%2Fzaileys/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeative%2Fzaileys/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeative%2Fzaileys/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zeative","download_url":"https://codeload.github.com/zeative/zaileys/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246188591,"owners_count":20737737,"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":["automation","bot-zaileys","js-whatsapp","multi-device","wa-simplify","whatsapp","whatsapp-api","zaileys"],"created_at":"2025-02-04T14:28:01.366Z","updated_at":"2025-03-29T13:24:24.354Z","avatar_url":"https://github.com/zeative.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align='center'\u003e\n  \u003cimg alt=\"Zaileys - Simplify Typescript/Javascript WhatsApp NodeJS API\" src=\"https://socialify.git.ci/zeative/zaileys/image?description=1\u0026amp;descriptionEditable=Zaileys%20is%20a%20simplified%20version%20of%20the%20Baileys%20package%20%0Awhich%20is%20easier%20and%20faster.\u0026amp;font=KoHo\u0026amp;forks=1\u0026amp;issues=1\u0026amp;language=1\u0026amp;name=1\u0026amp;owner=1\u0026amp;pattern=Circuit%20Board\u0026amp;pulls=1\u0026amp;stargazers=1\u0026amp;theme=Auto\"\u003e\n\u003c/div\u003e\n\n\u003ch1 align=\"center\"\u003eZaileys - Simplify Typescript/Javascript WhatsApp NodeJS API\u003c/h1\u003e\n\n\u003cdiv align='center'\u003e\n\n[![NPM Version](https://img.shields.io/npm/v/zaileys.svg)](https://www.npmjs.com/package/zaileys)\n[![NPM Downloads](https://img.shields.io/npm/dw/zaileys?label=npm\u0026color=%23CB3837)](https://www.npmjs.com/package/zaileys)\n[![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/zeative/zaileys)](https://www.npmjs.com/package/zaileys)\n[![GitHub License](https://img.shields.io/github/license/zeative/zaileys)](https://github.com/zeative/zaileys)\n[![GitHub Repo stars](https://img.shields.io/github/stars/zeative/zaileys)](https://github.com/zeative/zaileys)\n[![GitHub forks](https://img.shields.io/github/forks/zeative/zaileys)](https://github.com/zeative/zaileys)\n\n\u003c/div\u003e\n\n\u003e [!WARNING]\n\u003e This is beta version, not recomended to use in production. Join whatsapp community for latest info [WhatsApp Channel](https://whatsapp.com/channel/0029VazENbmInlqHIWzgn33h)\n\nZaileys is a powerful and flexible WhatsApp API library for Node.js, built on top of [Baileys](https://github.com/WhiskeySockets/Baileys). It simplifies the process of integrating WhatsApp functionalities into your applications, providing a comprehensive set of features for building robust and scalable WhatsApp-based solutions.\n\n## # Features\n\n- **Multi-Device Support:** Leverage the latest WhatsApp multi-device features for enhanced reliability and performance.\n- **Customizable:** Adapt the library to your specific needs with flexible configuration options and modular design.\n\n## # Installation\n\n```bash\nnpm add zaileys\n\npnpm add zaileys\n\nyarn add zaileys\n\nbun add zaileys\n\ndeno add npm:zaileys\n```\n\n## # Example Code\n\n\u003e [!TIP]\n\u003e If you don't want to take time for setup and configuration, use the [example.ts](https://github.com/zeative/zaileys/blob/main/test/example.ts) file that I have provided.\n\n## # Usage \u0026 Configuration\n\n### 📦 Import Library\n\n```js\n// ESM\nimport { Client } from \"zaileys\";\n\n// CJS\nconst { Client } = require(\"zaileys\");\n```\n\n### ⚙️ Configuration\n\n\u003e [!WARNING]\n\u003e Warning! in beta version this library uses built-in Baileys [`makeInMemoryStore`](https://github.com/WhiskeySockets/Baileys?tab=readme-ov-file#implementing-a-data-store) function which will most likely use quite a lot of RAM.\n\u003e If you experience this, you can delete the `.zaileys/memory.json` file then restart the server.\n\n```ts\nconst wa = new Client({\n  prefix: \"/\", // for command message, example '/'\n  ignoreMe: true, // ignore messages from bot (bot phone number)\n  phoneNumber: 628xxx, // fill bot phone number if auth type is 'pairing'\n  authPath: \".zaileys\", // auth directory path for session and chat store\n  authType: \"pairing\", // auth type 'pairing' or 'qr'\n  showLogs: true, // show logs of any chats\n  autoMentions: true, // bot will be auto mentioned if text contains sender number with '@' prefix\n  autoOnline: true, // bot status will be mark online\n  autoRead: true, // auto read message from any chats\n  autoRejectCall: true,  // auto reject call if someone call you\n  citation: {\n    // your citation will be boolean object based on validate with your value\n    // system will be validate your value with 'senderId' and 'roomId'\n    // if one is valid then the key will return 'boolean'\n    // sample output: { isAuthors: boolean }\n\n    // just sample, you can rename with any key\n    authors: () =\u003e [\"628xxxx\"], // key 'authors' will be 'isAuthors'\n    myGroups: () =\u003e [\"1203633xxxxx\"], // key 'myGroups' will be 'isMyGroups'\n    ...otherKey // key 'otherKey' will be 'isOtherKey'\n  },\n});\n```\n\n\u003chr\u003e\n\n\u003e [!NOTE]\n\u003e The functions and parameters below may change at any time considering that this library is a beta version. So when you update a library to the latest version but an error occurs, there may be changes to certain functions and parameters.\n\n### 🛎️ Event Handler\n\nYou can find out the output type of each object in the listener below:\n\n- ctx for [`connection`]()\n- ctx for [`message`]()\n- ctx for [`command`]()\n- ctx for [`call`]()\n\n```ts\nwa.on(\"connection\", (ctx) =\u003e {}); // listener for current connection\nwa.on(\"message\", (ctx) =\u003e {}); // listener for message from any chats\nwa.on(\"command\", (ctx) =\u003e {}); // listener for message that starts with prefix at beginning of word\nwa.on(\"call\", (ctx) =\u003e {}); // listener for someone call to bot\n```\n\n\u003chr\u003e\n\n### 🔹 Connection Handler\n\n```ts\nwa.on(\"connection\", (ctx) =\u003e {\n  if (ctx.status == \"open\") {\n    // do something\n  }\n});\n```\n\n\u003chr\u003e\n\n### 🔹 Send Text Message\n\n[Here](#) you can find out the complete parameters for the `.sendText()` function\n\n```ts\nwa.on(\"message\", (ctx) =\u003e {\n  if (ctx.text == \"ping\") {\n    wa.sendText(\"Hello! \" + ctx.senderName);\n  }\n\n  // text from reply message\n  if (ctx.reply?.text == \"ping\") {\n    wa.sendText(\"Pong from reply!\");\n  }\n\n  // text from nested reply message\n  // you can retrieve reply messages of any depth\n  if (ctx.reply?.reply?.reply?.text == \"ping\") {\n    wa.sendText(\"Pong from nested reply!\");\n  }\n\n  // text with footer message (doesn't work on whatsapp desktop)\n  if (ctx.text == \"pong\") {\n    wa.sendText(\"Ping!\", { footer: \"Footer message\" });\n  }\n});\n```\n\n\u003chr\u003e\n\n### 🔹 Send Reply Message\n\n[Here](#) you can find out the complete parameters for the `.sendReply()` function\n\n```ts\nwa.on(\"message\", (ctx) =\u003e {\n  if (ctx.text == \"ping\") {\n    wa.sendReply(\"Pong!\");\n  }\n\n  // reply with footer message (doesn't work on whatsapp desktop)\n  if (ctx.text == \"pong\") {\n    wa.sendReply(\"Ping!\", { footer: \"Footer message\" });\n  }\n\n  // reply with fake verified badge\n  if (ctx.text == \"fake\") {\n    wa.sendReply(\"Fake Verified!\", { fakeVerified: \"whatsapp\" });\n  }\n});\n```\n\n[Here](#) you can find out all the **verified** platforms provided\n\n\u003chr\u003e\n\n### 🔹 Send Sticker Message\n\n[Here](#) you can find out the complete parameters for the `.sendSticker()` function\n\n```ts\nwa.on(\"message\", async (ctx) =\u003e {\n  if (ctx.chatType == \"sticker\") {\n    const sticker = await ctx.media?.buffer!();\n\n    wa.sendSticker(sticker);\n  }\n\n  if (ctx.text == \"sticker\") {\n    wa.sendSticker(\"https://gtihub.com/zeative.png\");\n  }\n});\n```\n\n\u003chr\u003e\n\n### 🔹 Send Image Message\n\n[Here](#) you can find out the complete parameters for the `.sendImage()` function\n\n```ts\nwa.on(\"message\", async (ctx) =\u003e {\n  if (ctx.chatType == \"image\") {\n    const image = await ctx.media?.buffer!();\n\n    wa.sendImage(image);\n  }\n\n  if (ctx.text == \"image\") {\n    wa.sendImage(\"https://gtihub.com/zeative.png\");\n  }\n\n  if (ctx.text == \"mypp\") {\n    const picture = await ctx.senderImage();\n\n    wa.sendImage(picture);\n  }\n});\n```\n\n\u003chr\u003e\n\n### 🔹 Send Video Message\n\n[Here](#) you can find out the complete parameters for the `.sendVideo()` function\n\n```ts\nwa.on(\"message\", async (ctx) =\u003e {\n  if (ctx.chatType == \"video\") {\n    const video = await ctx.media?.buffer!();\n\n    wa.sendVideo(video);\n  }\n\n  if (ctx.text == \"video\") {\n    wa.sendVideo(\"https://gtihub.com/zeative.png\");\n  }\n});\n```\n\n\u003chr\u003e\n\n### 🔹 Send Audio Message\n\n[Here](#) you can find out the complete parameters for the `.sendAudio()` function\n\n```ts\nwa.on(\"message\", async (ctx) =\u003e {\n  if (ctx.chatType == \"audio\") {\n    const audio = await ctx.media?.buffer!();\n\n    wa.sendAudio(audio);\n  }\n\n  if (ctx.text == \"audio\") {\n    wa.sendAudio(\"https://gtihub.com/zeative.png\");\n  }\n});\n```\n\n\u003chr\u003e\n\n### 🔹 With Prefix Message\n\n\u003e [!NOTE]\n\u003e You must set `prefix` option to anything character\n\n```ts\nwa.on(\"message\", async (ctx) =\u003e {\n  // for example set prefix to \"/\"\n  // and user text \"/test\"\n  if (ctx.command == \"test\") {\n    wa.sendText(\"From command message!\");\n  }\n});\n```\n\n\u003chr\u003e\n\n### 🔹 Mentioned User\n\n\u003e [!NOTE]\n\u003e You must set `autoMentions` option to `true` and bot will send text as mentions\n\n```ts\nwa.on(\"message\", async (ctx) =\u003e {\n  if (ctx.text == \"mentions\") {\n    wa.sendText(\"Here user mentioned: @0 @18002428478\");\n    // example output: \"Here user mentioned: @WhatsApp @ChatGPT\"\n\n    // if `autoMentions` is inactive or `false`\n    // output can be plain text: \"Here user mentioned: @0 @18002428478\"\n  }\n});\n```\n\n\u003chr\u003e\n\n### 🔹 Citation Handler\n\n\u003e [!NOTE]\n\u003e You must set `citation` like [example](https://github.com/zeative/zaileys?tab=readme-ov-file#%EF%B8%8F-configuration) above before\n\n```ts\nconst wa = new Client({\n  ...,\n\n  // just example you can edit with your own\n  citation: {\n    authors: () =\u003e [\"628xxxx\"],\n    myPrivateGroups: () =\u003e [\"1203633xxxxx\"],\n    bannedUsers: async () =\u003e {\n      const res = await fetch(\"/get/user/banned\")\n      const users = await res.json()\n\n      return users // [\"628xx\", \"628xx\", \"628xx\"]\n    }\n  }\n})\n\nwa.on(\"message\", async (ctx) =\u003e {\n  const isAuthors = ctx.citation?.isAuthors;\n  const isMyPrivateGroups = ctx.citation?.isMyPrivateGroups;\n  const isBannedUsers = ctx.citation?.isBannedUsers;\n\n  if (isAuthors \u0026\u0026 ctx.text == \"test1\") {\n    wa.sendText(\"Message for my author: kejaa\");\n  }\n\n  if (isMyPrivateGroups \u0026\u0026 ctx.text == \"test2\") {\n    wa.sendText(\"Message for my private group!\");\n  }\n\n  if (isBannedUsers \u0026\u0026 ctx.text) {\n    wa.sendText(\"Your number is banned!\");\n  }\n});\n```\n\n## # Contributing\n\nContributions are welcome! Please follow these steps to contribute:\n\n1.  Fork the repository.\n2.  Create a new branch for your feature or bug fix (`git checkout -b feature/your-feature-name` or `git checkout -b fix/bug-description`).\n3.  Make your changes and commit them (`git commit -m 'Add some AmazingFeature'`).\n4.  Push your changes to your forked repository (`git push origin feature/your-feature-name`).\n5.  Submit a pull request to the main repository.\n\nPlease ensure your code follows the project's coding standards and includes appropriate tests.\n\n## # License\n\nThis project is licensed under the [MIT License](LICENSE) - see the [LICENSE](LICENSE) file for details.\n\n## # Acknowledgements\n\n- [Baileys](https://github.com/WhiskeySockets/Baileys) - The WhatsApp Web API library this project is based on.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzeative%2Fzaileys","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzeative%2Fzaileys","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzeative%2Fzaileys/lists"}