{"id":14986927,"url":"https://github.com/hacxk/easy-baileys","last_synced_at":"2025-04-11T23:10:25.756Z","repository":{"id":247933876,"uuid":"827219638","full_name":"hacxk/easy-baileys","owner":"hacxk","description":"Tired of writing complex code for simple WhatsApp bots? This Node.js module simplifies bot creation, making it accessible to all levels of developers. Harness the power of @whiskeysockets/baileys without the hassle.","archived":false,"fork":false,"pushed_at":"2024-08-20T07:02:12.000Z","size":228,"stargazers_count":19,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-01T00:22:56.439Z","etag":null,"topics":["0001","baileys","code","code-whatsapp-bot","easy-baileys","free","hacxk","multi-auth","multi-device","open-source","trending-repositories","whatsapp","whatsapp-api","whatsapp-bot","whatsapp-web","whiskeysockets"],"latest_commit_sha":null,"homepage":"https://easybaileys.vercel.app","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hacxk.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":"2024-07-11T08:16:47.000Z","updated_at":"2024-09-07T13:24:35.000Z","dependencies_parsed_at":"2024-07-11T12:07:04.973Z","dependency_job_id":"5c75f5cb-98e4-43b6-91ae-c750777c2e73","html_url":"https://github.com/hacxk/easy-baileys","commit_stats":{"total_commits":36,"total_committers":1,"mean_commits":36.0,"dds":0.0,"last_synced_commit":"d7d20902adb0654d144c7ad6d37e87781fb3ee08"},"previous_names":["hacxk/easy-baileys"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hacxk%2Feasy-baileys","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hacxk%2Feasy-baileys/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hacxk%2Feasy-baileys/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hacxk%2Feasy-baileys/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hacxk","download_url":"https://codeload.github.com/hacxk/easy-baileys/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219850446,"owners_count":16556318,"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":["0001","baileys","code","code-whatsapp-bot","easy-baileys","free","hacxk","multi-auth","multi-device","open-source","trending-repositories","whatsapp","whatsapp-api","whatsapp-bot","whatsapp-web","whiskeysockets"],"created_at":"2024-09-24T14:13:48.235Z","updated_at":"2024-10-14T00:02:53.173Z","avatar_url":"https://github.com/hacxk.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# easy-baileys 🤖\n\n[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n[![npm version](https://img.shields.io/npm/v/easy-baileys.svg)](https://www.npmjs.com/package/easy-baileys)\n[![baileys](https://img.shields.io/npm/v/baileys?logo=data:image/png;base64,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\u0026label=baileys\u0026color=rgb(0,165,135))](https://github.com/WhiskeySockets/Baileys)\n[![GitHub Issues or Pull Requests](https://img.shields.io/github/issues-raw/hacxk/easy-baileys?logo=circle\u0026logoColor=white)](https://github.com/hacxk/easy-baileys/issues)\n[![Discord](https://img.shields.io/discord/484464227067887645.svg)](https://discord.gg/9NGwqaV5)\n\n**easy-baileys** is a Node.js package designed to streamline WhatsApp connectivity and automate message handling, offering robust flexibility. It leverages the powerful capabilities of [@whiskeysockets/baileys](https://github.com/WhiskeySockets/Baileys).\n\n## ✨ GIVE A STAR ON GITHUB ⭐\n\n[easy-baileys](https://github.com/hacxk/easy-baileys)\n\n# IF YOU FOUND ANY ISSUE OR NEED A NEW FEATURES FEEL FREE TO OPEN A ISSUE ON GITHUB\n\n[easy-baileys](https://github.com/hacxk/easy-baileys)\n\n## Installation 📦\n\n```bash\nnpm install easy-baileys\n```\n\n## Usage 🛠️\n\n### 1. Importing the Module\n\n```javascript\nconst { WhatsAppClient } = require('easy-baileys');\n```\n\n### 2. Creating a Client Instance with MongoDB Authentication (+ Multiple Session ✅)\n\n```javascript\nconst { WhatsAppClient } = require('easy-baileys');\n\nconst customOptions = {\n    browser: [\"Ubuntu\", \"Chrome\", \"20.0.04\"],\n    printQRInTerminal: true, // Set to true for QR code in terminal\n    mobile: false,\n};\n\nasync function main() {\n    try {\n        // Initialize WhatsAppClient with MongoDB authentication\n        const clientMongo = await WhatsAppClient.create(\"mongo\", 'YOUR MONGO DB URI', customOptions);\n        const sockMongo = await clientMongo.getSocket();\n\n        // Example event listener for incoming messages\n        sockMongo.ev.on(\"messages.upsert\", async ({ messages }) =\u003e {\n            for (const m of messages) {\n                console.log(m)\n                if (m.message?.conversation.toLowerCase() === 'hi') {\n                    await sockMongo.reply(m, 'Hello! 👋');\n                    sockMongo.sendImage()\n                }\n            }\n        });\n\n    } catch (error) {\n        console.error('Error initializing WhatsApp client with MongoDB authentication:', error.message);\n    }\n}\n\nmain()\n```\n\n### 3. Creating a Client Instance with MySQL Authentication (+ Multiple Session ✅)\n\n```javascript\nconst { WhatsAppClient } = require('easy-baileys');\n\n// Example MySQL configuration\nconst mysqlConfig = {\n    session: 'session1', // Required\n    host: 'localhost', // Required\n    port: 3306, // Optional\n    user: 'your_mysql_user', // Optional\n    password: 'your_mysql_password', // Optional\n    database: 'your_database_name', // Optional\n    tableName: 'auth' // Optional\n};\n\nconst customOptions = {\n  browser: [\"Ubuntu\", \"Chrome\", \"20.0.04\"],\n  printQRInTerminal: false, // Set to true for QR code in terminal\n  mobile: false,\n};\n\n(async () =\u003e {\n  try {\n    // Initialize WhatsAppClient with MySQL authentication\n    const client = await WhatsAppClient.create(\"mysql\", mysqlConfig, customOptions);\n    const sockMySQL = await client.getSocket();\n\n    // Example event listener for incoming messages\n    sockMySQL.ev.on(\"messages.upsert\", async ({ messages }) =\u003e {\n      for (const m of messages) {\n        if (m.message?.conversation.toLowerCase() === 'hi') {\n          await sockMySQL.reply(m, 'Hello! 👋');\n        }\n      }\n    });\n\n  } catch (error) {\n    console.error('Error initializing WhatsApp client with MySQL authentication:', error.message);\n  }\n})();\n```\n\n### 4. Creating a Client Instance with MultiFile Authentication\n\n```javascript\nconst { WhatsAppClient } = require('easy-baileys');\n\nconst customOptions = {\n  browser: [\"Ubuntu\", \"Chrome\", \"20.0.04\"],\n  printQRInTerminal: false, // Set to true for QR code in terminal\n  mobile: false,\n};\n\n(async () =\u003e {\n  try {\n    // Initialize WhatsAppClient with MultiFile authentication\n    const clientMulti = await WhatsAppClient.create(\"multi\", './authFiles', customOptions);\n    const sockMulti = await clientMulti.getSocket();\n\n    // Example event listener for incoming messages\n    sockMulti.ev.on(\"messages.upsert\", async ({ messages }) =\u003e {\n      for (const m of messages) {\n        if (m.message?.conversation.toLowerCase() === 'hi') {\n          await sockMulti.reply(m, 'Hello! 👋');\n        }\n      }\n    });\n\n  } catch (error) {\n    console.error('Error initializing WhatsApp client with MultiFile authentication:', error.message);\n  }\n})();\n```\n\n### Explanation\n\n- **MongoDB Authentication Example**: Initializes the `WhatsAppClient` instance using MongoDB credentials and sets up event listeners to respond to messages.\n- **MultiFile Authentication Example**: Initializes the `WhatsAppClient` instance using authentication files stored locally and handles incoming messages similarly.\n\n### 5. Obtain a pairing code (Optional)\n\n```javascript\nconst sock = client.getSocket();\nconst code = await client.getPairingCode(123456789); // Your WhatsApp number (Without +)\nconsole.log(code); \n```\n\n## Example: Pairing Code with Validated Phone Number 📞\n\n```javascript\nconst { WhatsAppClient } = require('easy-baileys');\n\n(async () =\u003e {\n  try {\n    const customOptions = {\n        browser: [\"Ubuntu\", \"Chrome\", \"20.0.04\"],\n        printQRInTerminal: false, // Set to true for QR code in terminal\n        mobile: false,\n    };\n\n    const client = await WhatsAppClient.createMultiAuth('./auth', customOptions);\n    const sock = await client.getSocket();\n    const code = await client.getPairingCode(123456789); // Your WhatsApp number (Without +)\n    console.log(code); // Outputs code with validated phone number\n  } catch (error) {\n    console.error('Error initializing WhatsApp client:', error.message);\n  }\n})();\n```\n\n## Example: Display QR Code in Terminal 📱\n\n```javascript\n(async () =\u003e {\n  try {\n    const customOptions = {\n      // ... other options\n      printQRInTerminal: true, \n    };\n    const client = await WhatsAppClient.createMultiAuth('./auth', customOptions);\n    const sock = await client.getSocket();\n  } catch (error) {\n    console.error('Error initializing WhatsApp client:', error.message);\n  }\n})();\n```\n\nThe QR code will be printed directly in your terminal.\n\n---\n\n## Simple Example Code\n\n```javascript\n\nconst { WhatsAppClient } = require('easy-baileys');\n\n(async () =\u003e {\n    try {\n        const customOptions = {\n            browser: [\"Ubuntu\", \"Chrome\", \"20.0.04\"],\n            printQRInTerminal: true,\n            mobile: false,\n        };\n\n        const client = await WhatsAppClient.createMultiAuth('./hacxk', customOptions);\n        const conn = await client.getSocket();\n\n        conn.ev.on(\"messages.upsert\", async ({ messages }) =\u003e {\n            for (const m of messages) {\n                if (m.message?.conversation.toLowerCase() === 'hi') {\n                    await conn.reply(m, 'Hello! 👋');\n                }\n            }\n        });\n\n    } catch (error) {\n        console.error('Error initializing WhatsApp client:', error.message);\n    }\n})();```\n```\n\n\n\n---\n\n\n\n### Handling Message Upserts\n\nOne of the key features of `@whiskeysockets/baileys` is the ability to handle incoming messages. The library provides an event called `messages.upsert` that you can listen to for new messages. Here’s how you can set up a listener for this event:\n\n```javascript\nsock.ev.on(\"messages.upsert\", async ({ messages }) =\u003e {\n    for (const m of messages) {\n        console.log(m);\n    }\n});\n```\n\n### Real-World Use Case\n\nIn a real-world scenario, you might want to do more than just log the messages. Here's an extended example that checks if the message contains text and replies to the sender:\n\n```javascript\nsock.ev.on(\"messages.upsert\", async ({ messages }) =\u003e {\n    for (const m of messages) {\n        console.log(m);\n        \n        if (m.message \u0026\u0026 m.message.conversation) {\n            const sender = m.key.remoteJid;\n            const messageText = m.message.conversation; \n            console.log(`Message from ${sender}: ${messageText}`);        \n        }\n    }\n});\n```\n\n\n\n---\n\n\n\n\n\n\n### Overview: 📱💬\n\nThe `connMessage` class provides methods to interact with WhatsApp messages, including sending various media types, replying, reacting, editing, and deleting messages.\n\n\n\n| Function | Parameters | Description |\n|----------|------------|-------------|\n| `sendSticker` | `m`, `bufferOrUrl` | Sends a sticker message. |\n| `sendStickerReply` | `m`, `bufferOrUrl` | Sends a sticker as a reply to a message. |\n| `sendImage` | `m`, `bufferOrUrl`, `caption` | Sends an image message with an optional caption. |\n| `sendImageReply` | `m`, `bufferOrUrl`, `caption` | Sends an image as a reply to a message. |\n| `sendVideo` | `m`, `bufferOrUrl`, `caption` | Sends a video message with an optional caption. |\n| `sendVideoReply` | `m`, `bufferOrUrl`, `caption` | Sends a video as a reply to a message. |\n| `sendDocument` | `m`, `bufferOrUrl`, `mimetype`, `fileName`, `caption` | Sends a document message. |\n| `sendDocumentReply` | `m`, `bufferOrUrl`, `mimetype`, `fileName`, `caption` | Sends a document as a reply to a message. |\n| `sendAudio` | `m`, `bufferOrUrl`, `ptt` | Sends an audio message, optionally as push-to-talk. |\n| `sendAudioReply` | `m`, `bufferOrUrl`, `ptt` | Sends an audio message as a reply, optionally as push-to-talk. \n| `sendGif` | `m`, `bufferOrUrl`, `playback` | Sends a GIF message. |\n| `sendGifReply` | `m`, `bufferOrUrl`, `playback` | Sends a GIF as a reply to a message. |\n| `reply` | `m`, `text` | Replies to a message with text. |\n| `send` | `m`, `text` | Sends a text message. |\n| `react` | `m`, `emoji` | Reacts to a message with an emoji. |\n| `editMsg` | `m`, `sentMessage`, `newMessage` | Edits a sent message. |\n| `deleteMsgGroup` | `m` | Deletes a message in a group chat. |\n| `deleteMsg` | `m` | Deletes a message. |\n| `findValue` | `obj`, `targetValue`, `currentPath` | Recursively finds a path to a value in an object. |\n| `findObject` | `obj`, `targetValue` | Recursively finds an object containing a specific value. |\n| `add` | `groupJid`, `participantJid` | Adds a participant to a group. |\n| `remove` | `groupJid`, `participantJid` | Removes a participant from a group. |\n| `isAdmin` | `groupJid` | Checks if the bot is an admin in a group. |\n| `updateParticipantStatus` | `groupJid`, `participantJid`, `action` | Promotes or demotes a participant in a group. |\n| `updateGroupSettings` | `groupJid`, `settings` | Updates group settings. |\n| `banUser` | `groupJid`, `userJid` | Bans a user from joining a group. |\n| `unbanUser` | `groupJid`, `userJid` | Unbans a user from a group. |\n| `generateInviteLink` | `groupJid` | Generates a new invite link for a group. |\n| `revokeInviteLink` | `groupJid` | Revokes the current invite link for a group. |\n| `updateGroupSubject` | `groupJid`, `newSubject` | Updates the group subject (name). |\n| `updateGroupDescription` | `groupJid`, `newDescription` | Updates the group description. |\n| `updateGroupMessagesSettings` | `groupJid`, `setting` | Updates who can send messages in the group. |\n| `scheduleMessage` | `jid`, `content`, `sendTime` | Schedules a message to be sent at a specific time. |\n| `cancelScheduledMessage` | `index` | Cancels a scheduled message. |\n| `sendBulkMessage` | `jids`, `content` | Sends a message to multiple recipients. |\n| `downloadMedia` | `m` | Downloads media from a message. |\n| `createPoll` | `groupJid`, `question`, `options` | Creates a poll in a group chat. |\n| `updateStatus` | `status` | Updates the bot's status. |\n\n\n\n\n\n\n\n### Methods \n\n\n\nSee [API Documentation](#configuration-options-%E2%9A%99%EF%B8%8F) for detailed method explanations.\n\n# JAVASCRIPT\n\n1. **`sendSticker(m, bufferOrUrl)`** 🎨\n   - **Description**: Sends a sticker message to the given chat.\n   - **Parameters**:\n     - `m` (`object`): Message object containing chat information.\n     - `bufferOrUrl` (`string`, `Buffer`, or `filepath`): URL, buffer, or filepath containing the sticker data.\n   - **Usage Example**:\n     ```javascript\n     await conn.sendSticker(m, 'https://example.com/sticker.webp');\n     ```\n\n2. **`sendStickerReply(m, bufferOrUrl)`** 🎉\n   - **Description**: Sends a sticker as a reply to a specific message.\n   - **Parameters**: Same as `sendSticker`.\n   - **Usage Example**:\n     ```javascript\n     await conn.sendStickerReply(m, 'https://example.com/sticker.webp');\n     ```\n\n3. **`sendImage(m, bufferOrUrl, caption)`** 🖼️\n   - **Description**: Sends an image message with an optional caption.\n   - **Parameters**:\n     - `m` (`object`): Message object containing chat information.\n     - `bufferOrUrl` (`string`, `Buffer`, or `filepath`): URL, buffer, or filepath containing the image data.\n     - `caption` (`string`): Optional caption for the image.\n   - **Usage Example**:\n     ```javascript\n     await conn.sendImage(m, 'https://example.com/image.jpg', 'Beautiful scenery!');\n     ```\n\n4. **`sendImageReply(m, bufferOrUrl, caption)`** 🌄\n   - **Description**: Sends an image as a reply to a specific message.\n   - **Parameters**: Same as `sendImage`.\n   - **Usage Example**:\n     ```javascript\n     await conn.sendImageReply(m, 'https://example.com/image.jpg', 'Replying with an image.');\n     ```\n\n5. **`sendVideo(m, bufferOrUrl, caption)`** 📹\n   - **Description**: Sends a video message with an optional caption.\n   - **Parameters**: Same as `sendImage`.\n   - **Usage Example**:\n     ```javascript\n     await conn.sendVideo(m, 'https://example.com/video.mp4', 'Check out this video!');\n     ```\n\n6. **`sendVideoReply(m, bufferOrUrl, caption)`** 🎥\n   - **Description**: Sends a video as a reply to a specific message.\n   - **Parameters**: Same as `sendVideo`.\n   - **Usage Example**:\n     ```javascript\n     await conn.sendVideoReply(m, 'https://example.com/video.mp4', 'Replying with a video.');\n     ```\n\n7. **`sendDocument(m, bufferOrUrl, mimetype, fileName, caption)`** 📄\n   - **Description**: Sends a document (file) message with an optional caption.\n   - **Parameters**:\n     - `m` (`object`): Message object containing chat information.\n     - `bufferOrUrl` (`string`, `Buffer`, or `filepath`): URL, buffer, or filepath containing the document data.\n     - `mimetype` (`string`): MIME type of the document.\n     - `fileName` (`string`): Name of the file.\n     - `caption` (`string`): Optional caption for the document.\n   - **Usage Example**:\n     ```javascript\n     await conn.sendDocument(m, 'https://example.com/document.pdf', 'application/pdf', 'document.pdf', 'Check out this document!');\n     ```\n\n8. **`sendDocumentReply(m, bufferOrUrl, mimetype, fileName, caption)`** 📝\n   - **Description**: Sends a document as a reply to a specific message.\n   - **Parameters**: Same as `sendDocument`.\n   - **Usage Example**:\n     ```javascript\n     await conn.sendDocumentReply(m, 'https://example.com/document.pdf', 'application/pdf', 'document.pdf', 'Replying with a document.');\n     ```\n\n9. **`sendAudio(m, bufferOrUrl, ptt)`** 🎵\n   - **Description**: Sends an audio message or voice note.\n   - **Parameters**:\n     - `m` (`object`): Message object containing chat information.\n     - `bufferOrUrl` (`string`, `Buffer`, or `filepath`): URL, buffer, or filepath containing the audio data.\n     - `ptt` (`boolean`): Whether the audio is a voice note (push-to-talk).\n   - **Usage Example**:\n     ```javascript\n     await conn.sendAudio(m, 'https://example.com/audio.mp3', true);\n     ```\n\n10. **`sendAudioReply(m, bufferOrUrl, ptt)`** 🎤\n    - **Description**: Sends an audio message as a reply to a specific message.\n    - **Parameters**: Same as `sendAudio`.\n    - **Usage Example**:\n      ```javascript\n      await conn.sendAudioReply(m, 'https://example.com/audio.mp3', true);\n      ```\n\n11. **`sendGif(m, bufferOrUrl, playback)`** 🎬\n    - **Description**: Sends a GIF message.\n    - **Parameters**:\n      - `m` (`object`): Message object containing chat information.\n      - `bufferOrUrl` (`string`, `Buffer`, or `filepath`): URL, buffer, or filepath containing the GIF data.\n      - `playback` (`boolean`): Whether to enable GIF playback.\n    - **Usage Example**:\n      ```javascript\n      await conn.sendGif(m, 'https://example.com/animated.gif', true);\n      ```\n\n12. **`sendGifReply(m, bufferOrUrl, playback)`** 🎞️\n    - **Description**: Sends a GIF as a reply to a specific message.\n    - **Parameters**: Same as `sendGif`.\n    - **Usage Example**:\n      ```javascript\n      await conn.sendGifReply(m, 'https://example.com/animated.gif', true);\n      ```\n\n13. **`reply(m, text)`** 💬\n    - **Description**: Replies to a message with text.\n    - **Parameters**:\n      - `m` (`object`): Message object containing chat information.\n      - `text` (`string`): Text message to reply with.\n    - **Usage Example**:\n      ```javascript\n      await conn.reply(m, 'Your reply message.');\n      ```\n\n14. **`send(m, text)`** ✉️\n    - **Description**: Sends a text message to a chat.\n    - **Parameters**: Same as `reply`.\n    - **Usage Example**:\n      ```javascript\n      await conn.send(m, 'Your message.');\n      ```\n\n15. **`react(m, emoji)`** 🎭\n    - **Description**: Reacts to a message with an emoji.\n    - **Parameters**:\n      - `m` (`object`): Message object containing chat information.\n      - `emoji` (`string`): Emoji reaction.\n    - **Usage Example**:\n      ```javascript\n      await conn.react(m, '😄');\n      ```\n\n16. **`editMsg(m, sentMessage, newMessage)`** 📝\n    - **Description**: Edits a previously sent message with a new message.\n    - **Parameters**:\n      - `m` (`object`): Message object containing chat information.\n      - `sentMessage` (`object`): Previously sent message object.\n      - `newMessage` (`string`): New message content.\n    - **Usage Example**:\n      ```javascript\n      await conn.editMsg(m, sentMessage, 'Updated message.');\n      ```\n\n17. **`deleteMsgGroup(m)`** 🗑️\n    - **Description**: Deletes a message in a group chat (requires admin privileges).\n    - **Parameters**:\n      - `m` (`object`): Message object containing chat information.\n    - **Usage Example**:\n      ```javascript\n      await conn.deleteMsgGroup(m);\n      ```\n\n18. **`deleteMsg(m)`** 🚫\n    - **Description**: finds a path in an object where a specified value is located.\n    - **Parameters**: Same as `deleteMsgGroup`.\n    - **Usage Example**:\n      ```javascript\n      await conn.deleteMsg(m);\n      ```\n\n19. **`findValue(m, theValue)`** 🚫\n    - **Description**: Deletes a message (self-message or sent to you).\n    - **Usage Example**:\n      ```javascript\n      await conn.findValue(m, 'image/jpeg'); // This will find current object path that value is image/jpeg\n      ```   \n\n### `add(groupJid, participantJid)` ➕\n\n**Description:** Invites a specified participant to join a WhatsApp group. Requires admin privileges.\n\n**Parameters:**\n\n* `groupJid` (string): The group's JID (e.g., `1234567890-123456@g.us`).\n* `participantJid` (string): The participant's JID (e.g., `9876543210@s.whatsapp.net`).\n\n\n# TYPESCRIPT\n\n# ConnMessage Class Documentation Typescript\n\nThe `ConnMessage` class extends the functionality of the `WASocket` class from the `@whiskeysockets/baileys` library, providing a variety of methods for sending different types of messages in a WhatsApp chat application.\n\n## Table of Contents\n1. [sendTextMessage](#sendTextMessage)\n2. [reply](#reply)\n3. [react](#react)\n4. [send](#send)\n5. [sendImage](#sendImage)\n6. [sendImageReply](#sendImageReply)\n7. [sendVideo](#sendVideo)\n8. [sendVideoReply](#sendVideoReply)\n9. [sendDocument](#sendDocument)\n10. [sendDocumentReply](#sendDocumentReply)\n11. [sendSticker](#sendSticker)\n12. [sendStickerReply](#sendStickerReply)\n13. [sendGIF](#sendGIF)\n14. [sendGIFReply](#sendGIFReply)\n15. [sendAudio](#sendAudio)\n16. [sendAudioReply](#sendAudioReply)\n17. [sendContact](#sendContact)\n18. [sendContactReply](#sendContactReply)\n19. [sendPoll](#sendPoll)\n20. [sendPollReply](#sendPollReply)\n21. [editMessage](#editMessage)\n22. [deleteMessage](#deleteMessage)\n23. [sendLocation](#sendLocation)\n24. [sendLocationReply](#sendLocationReply)\n25. [sendLiveLocation](#sendLiveLocation)\n26. [sendButton](#sendButton)\n27. [sendListMessage](#sendListMessage)\n28. [sendTemplateMessage](#sendTemplateMessage)\n\n## Method Descriptions\n\n### sendTextMessage\n\nSends a simple text message to a specified JID (WhatsApp ID).\n\n**Arguments:**\n- `jid: string` - The recipient's WhatsApp ID\n- `text: string` - The message text to send\n\n**Returns:** `Promise\u003cproto.WebMessageInfo | undefined\u003e`\n\n**Example:**\n```typescript\nconst result = await sock.sendTextMessage(\"1234567890@s.whatsapp.net\", \"Hello, World!\");\n```\n\n### reply\n\nReplies to a received message with a text message.\n\n**Arguments:**\n- `m: proto.IWebMessageInfo` - The received message to reply to\n- `text: string` - The reply text\n\n**Returns:** `Promise\u003cproto.WebMessageInfo | undefined\u003e`\n\n**Example:**\n```typescript\nconst result = await sock.reply(receivedMessage, \"Thanks for your message!\");\n```\n\n### react\n\nSends a reaction to a message using an emoji.\n\n**Arguments:**\n- `m: proto.IWebMessageInfo` - The message to react to\n- `emoji: string` - The emoji to use as a reaction\n\n**Returns:** `Promise\u003cproto.WebMessageInfo | undefined\u003e`\n\n**Example:**\n```typescript\nconst result = await sock.react(receivedMessage, \"👍\");\n```\n\n### send\n\nA generic method to send any type of content to a specified JID.\n\n**Arguments:**\n- `jid: string` - The recipient's WhatsApp ID\n- `content: AnyMessageContent` - The content to send\n- `options?: MiscMessageGenerationOptions` - Optional message generation options\n\n**Returns:** `Promise\u003cproto.WebMessageInfo | undefined\u003e`\n\n**Example:**\n```typescript\nconst result = await sock.send(\"1234567890@s.whatsapp.net\", { text: \"Hello\" }, { ephemeralExpiration: 86400 });\n```\n\n### sendImage\n\nSends an image to a specified JID.\n\n**Arguments:**\n- `jid: string` - The recipient's WhatsApp ID\n- `image: WAMediaUpload` - The image to send\n- `caption?: string` - Optional caption for the image\n- `options?: MiscMessageGenerationOptions` - Optional message generation options\n\n**Returns:** `Promise\u003cproto.WebMessageInfo | undefined\u003e`\n\n**Example:**\n```typescript\nconst result = await sock.sendImage(\"1234567890@s.whatsapp.net\", \"./image.jpg\", \"Check out this picture!\");\n```\n\n### sendImageReply\n\nSends an image as a reply to a received message.\n\n**Arguments:**\n- `m: proto.IWebMessageInfo` - The received message to reply to\n- `image: WAMediaUpload` - The image to send\n- `caption?: string` - Optional caption for the image\n- `options?: MiscMessageGenerationOptions` - Optional message generation options\n\n**Returns:** `Promise\u003cproto.WebMessageInfo | undefined\u003e`\n\n**Example:**\n```typescript\nconst result = await sock.sendImageReply(receivedMessage, \"./image.jpg\", \"Here's the image you requested.\");\n```\n\n### sendVideo\n\nSends a video to a specified JID.\n\n**Arguments:**\n- `jid: string` - The recipient's WhatsApp ID\n- `video: WAMediaUpload` - The video to send\n- `caption?: string` - Optional caption for the video\n- `options?: MiscMessageGenerationOptions` - Optional message generation options\n\n**Returns:** `Promise\u003cproto.WebMessageInfo | undefined\u003e`\n\n**Example:**\n```typescript\nconst result = await sock.sendVideo(\"1234567890@s.whatsapp.net\", \"./video.mp4\", \"Check out this video!\");\n```\n\n### sendVideoReply\n\nSends a video as a reply to a received message.\n\n**Arguments:**\n- `m: proto.IWebMessageInfo` - The received message to reply to\n- `video: WAMediaUpload` - The video to send\n- `caption?: string` - Optional caption for the video\n- `options?: MiscMessageGenerationOptions` - Optional message generation options\n\n**Returns:** `Promise\u003cproto.WebMessageInfo | undefined\u003e`\n\n**Example:**\n```typescript\nconst result = await sock.sendVideoReply(receivedMessage, \"./video.mp4\", \"Here's the video you asked for.\");\n```\n\n### sendDocument\n\nSends a document to a specified JID.\n\n**Arguments:**\n- `jid: string` - The recipient's WhatsApp ID\n- `document: WAMediaUpload` - The document to send\n- `filename: string` - The filename for the document\n- `mimeType: string` - The MIME type of the document\n- `caption?: string` - Optional caption for the document\n- `options?: MiscMessageGenerationOptions` - Optional message generation options\n\n**Returns:** `Promise\u003cproto.WebMessageInfo | undefined\u003e`\n\n**Example:**\n```typescript\nconst result = await sock.sendDocument(\"1234567890@s.whatsapp.net\", \"./document.pdf\", \"report.pdf\", \"application/pdf\", \"Monthly Report\");\n```\n\n### sendDocumentReply\n\nSends a document as a reply to a received message.\n\n**Arguments:**\n- `m: proto.IWebMessageInfo` - The received message to reply to\n- `document: WAMediaUpload` - The document to send\n- `filename: string` - The filename for the document\n- `mimeType: string` - The MIME type of the document\n- `caption?: string` - Optional caption for the document\n- `options?: MiscMessageGenerationOptions` - Optional message generation options\n\n**Returns:** `Promise\u003cproto.WebMessageInfo | undefined\u003e`\n\n**Example:**\n```typescript\nconst result = await sock.sendDocumentReply(receivedMessage, \"./document.pdf\", \"report.pdf\", \"application/pdf\", \"Here's the report you requested.\");\n```\n\n### sendSticker\n\nSends a sticker to a specified JID.\n\n**Arguments:**\n- `jid: string` - The recipient's WhatsApp ID\n- `sticker: WAMediaUpload` - The sticker to send\n- `options?: MiscMessageGenerationOptions` - Optional message generation options\n\n**Returns:** `Promise\u003cproto.WebMessageInfo | undefined\u003e`\n\n**Example:**\n```typescript\nconst result = await sock.sendSticker(\"1234567890@s.whatsapp.net\", \"./sticker.webp\");\n```\n\n### sendStickerReply\n\nSends a sticker as a reply to a received message.\n\n**Arguments:**\n- `m: proto.IWebMessageInfo` - The received message to reply to\n- `sticker: WAMediaUpload` - The sticker to send\n- `options?: MiscMessageGenerationOptions` - Optional message generation options\n\n**Returns:** `Promise\u003cproto.WebMessageInfo | undefined\u003e`\n\n**Example:**\n```typescript\nconst result = await sock.sendStickerReply(receivedMessage, \"./sticker.webp\");\n```\n\n### sendGIF\n\nSends a GIF to a specified JID.\n\n**Arguments:**\n- `jid: string` - The recipient's WhatsApp ID\n- `gif: WAMediaUpload` - The GIF to send\n- `caption?: string` - Optional caption for the GIF\n- `options?: MiscMessageGenerationOptions` - Optional message generation options\n\n**Returns:** `Promise\u003cproto.WebMessageInfo | undefined\u003e`\n\n**Example:**\n```typescript\nconst result = await sock.sendGIF(\"1234567890@s.whatsapp.net\", \"./animation.gif\", \"Check out this cool GIF!\");\n```\n\n### sendGIFReply\n\nSends a GIF as a reply to a received message.\n\n**Arguments:**\n- `m: proto.IWebMessageInfo` - The received message to reply to\n- `gif: WAMediaUpload` - The GIF to send\n- `caption?: string` - Optional caption for the GIF\n- `options?: MiscMessageGenerationOptions` - Optional message generation options\n\n**Returns:** `Promise\u003cproto.WebMessageInfo | undefined\u003e`\n\n**Example:**\n```typescript\nconst result = await sock.sendGIFReply(receivedMessage, \"./animation.gif\", \"Here's a funny GIF for you!\");\n```\n\n### sendAudio\n\nSends an audio file to a specified JID.\n\n**Arguments:**\n- `jid: string` - The recipient's WhatsApp ID\n- `audio: WAMediaUpload` - The audio file to send\n- `options?: MiscMessageGenerationOptions` - Optional message generation options\n\n**Returns:** `Promise\u003cproto.WebMessageInfo | undefined\u003e`\n\n**Example:**\n```typescript\nconst result = await sock.sendAudio(\"1234567890@s.whatsapp.net\", \"./audio.mp3\");\n```\n\n### sendAudioReply\n\nSends an audio file as a reply to a received message.\n\n**Arguments:**\n- `m: proto.IWebMessageInfo` - The received message to reply to\n- `audio: WAMediaUpload` - The audio file to send\n- `options?: MiscMessageGenerationOptions` - Optional message generation options\n\n**Returns:** `Promise\u003cproto.WebMessageInfo | undefined\u003e`\n\n**Example:**\n```typescript\nconst result = await sock.sendAudioReply(receivedMessage, \"./audio.mp3\");\n```\n\n### sendContact\n\nSends a contact card to a specified JID.\n\n**Arguments:**\n- `jid: string` - The recipient's WhatsApp ID\n- `contact: { name: string, number: string }` - The contact information\n- `options?: MiscMessageGenerationOptions` - Optional message generation options\n\n**Returns:** `Promise\u003cproto.WebMessageInfo | undefined\u003e`\n\n**Example:**\n```typescript\nconst result = await sock.sendContact(\"1234567890@s.whatsapp.net\", { name: \"John Doe\", number: \"+1234567890\" });\n```\n\n### sendContactReply\n\nSends a contact card as a reply to a received message.\n\n**Arguments:**\n- `m: proto.IWebMessageInfo` - The received message to reply to\n- `contact: { name: string, number: string }` - The contact information\n- `options?: MiscMessageGenerationOptions` - Optional message generation options\n\n**Returns:** `Promise\u003cproto.WebMessageInfo | undefined\u003e`\n\n**Example:**\n```typescript\nconst result = await sock.sendContactReply(receivedMessage, { name: \"Jane Doe\", number: \"+9876543210\" });\n```\n\n### sendPoll\n\nSends a poll to a specified JID.\n\n**Arguments:**\n- `jid: string` - The recipient's WhatsApp ID\n- `name: string` - The question or title of the poll\n- `values: string[]` - An array of poll options\n- `selectableCount?: number` - Optional number of selectable options\n\n**Returns:** `Promise\u003cproto.WebMessageInfo | undefined\u003e`\n\n**Example:**\n```typescript\nconst result = await sock.sendPoll(\"1234567890@s.whatsapp.net\", \"What's your favorite color?\", [\"Red\", \"Blue\", \"Green\"], 1);\n```\n\n### sendPollReply\n\nSends a poll as a reply to a received message.\n\n**Arguments:**\n- `m: proto.IWebMessageInfo` - The received message to reply to\n- `name: string` - The question or title of the poll\n- `values: string[]` - An array of poll options\n- `selectableCount?: number` - Optional number of selectable options\n\n**Returns:** `Promise\u003cproto.WebMessageInfo | undefined\u003e`\n\n**Example:**\n```typescript\nconst result = await sock.sendPollReply(receivedMessage, \"What's your favorite fruit?\", [\"Apple\", \"Banana\", \"Orange\"], 2);\n```\n\n### editMessage\n\nEdits a previously sent message.\n\n**Arguments:**\n- `jid: string` - The chat's WhatsApp ID\n- `m: proto.IWebMessageInfo` - The message to edit\n- `newContent: string | { text?: string, caption?: string }` - The new content for the message\n\n**Returns:** `Promise\u003cproto.WebMessageInfo | undefined\u003e`\n\n**Example:**\n```typescript\nconst result = await sock.editMessage(\"1234567890@s.whatsapp.net\", sentMessage, \"Updated message content\");\n```\n\n### deleteMessage\n\nDeletes a message.\n\n**Arguments:**\n- `jid: string` - The chat's WhatsApp ID\n- `m: proto.IWebMessageInfo` - The message to delete\n\n**Returns:** `Promise\u003cproto.WebMessageInfo | undefined\u003e`\n\n**Example:**\n```typescript\nconst result = await sock.deleteMessage(\"1234567890@s.whatsapp.net\", messageToDelete);\n```\n\n### sendLocation\n\nSends a location to a specified JID.\n\n**Arguments:**\n- `jid: string` - The recipient's WhatsApp ID\n- `latitude: number` - The latitude of the location\n- `longitude: number` - The longitude of the location\n- `options?: MiscMessageGenerationOptions` - Optional message generation options\n\n**Returns:** `Promise\u003cproto.WebMessageInfo | undefined\u003e`\n\n**Example:**\n```typescript\nconst result = await sock.sendLocation(\"1234567890@s.whatsapp.net\", 40.7128, -74.0060);\n```\n\n### sendLocationReply\n\nSends a location as a reply to a received message.\n\n**Arguments:**\n- `m: proto.IWebMessageInfo` - The received message to reply to\n- `latitude: number` - The latitude of the location\n- `longitude: number` - The longitude of the location\n- `options?: MiscMessageGenerationOptions` - Optional message generation options\n\n**Returns:** `Promise\u003cproto.WebMessageInfo | undefined\u003e`\n\n**Example:**\n```typescript\nconst result = await sock.sendLocationReply(receivedMessage, 51.5074, -0.1278);\n```\n\n### sendLiveLocation\n\nSends a live location to a specified JID.\n\n**Arguments:**\n- `jid: string` - The recipient's WhatsApp ID\n- `latitude: number` - The latitude of the location\n- `longitude: number` - The longitude of the location\n- `durationMs: number` - The duration of the live location in milliseconds\n- `options?: MiscMessageGenerationOptions \u0026 { comment?: string }` - Optional message generation options and comment\n\n**Returns:** `Promise\u003cproto.WebMessageInfo | undefined\u003e`\n\n**Example:**\n```typescript\nconst result = await sock.sendLiveLocation(\"1234567890@s.whatsapp.net\", 40.7128, -74.0060, 3600000, { comment: \"I'm here!\" });\n```\n\n### sendButton\n\nSends a message with buttons to a specified JID.\n\n**Arguments:**\n- `jid: string` - The recipient's WhatsApp ID\n- `contentText: string` - The main text content of the message\n- `buttons: proto.Message.ButtonsMessage.IButton[]` - An array of button objects\n- `options?: MiscMessageGenerationOptions` - Optional message generation options\n\n**Returns:** `Promise\u003cproto.WebMessageInfo | undefined\u003e`\n\n**Example:**\n```typescript\nconst buttons = [\n  { buttonId: '1', buttonText: { displayText: 'Button 1' }, type: 1 },\n  { buttonId: '2', buttonText: { displayText: 'Button 2' }, type: 1 },\n];\nconst result = await sock.sendButton(\"1234567890@s.whatsapp.net\", \"Please choose an option:\", buttons);\n```\n\n### sendListMessage\n\nSends a list message to a specified JID.\n\n**Arguments:**\n- `jid: string` - The recipient's WhatsApp ID\n- `message: proto.Message.ListMessage` - The list message object\n- `options?: MiscMessageGenerationOptions` - Optional message generation options\n\n**Returns:** `Promise\u003cproto.WebMessageInfo | undefined\u003e`\n\n**Example:**\n```typescript\nconst listMessage: proto.Message.ListMessage = {\n  title: \"Menu\",\n  description: \"Please select an item\",\n  buttonText: \"View Menu\",\n  listType: 1,\n  sections: [\n    {\n      title: \"Section 1\",\n      rows: [\n        { title: \"Option 1\", description: \"Description for Option 1\" },\n        { title: \"Option 2\", description: \"Description for Option 2\" },\n      ],\n    },\n  ],\n};\nconst result = await sock.sendListMessage(\"1234567890@s.whatsapp.net\", listMessage);\n```\n\n### sendTemplateMessage\n\nSends a template message with buttons to a specified JID.\n\n**Arguments:**\n- `jid: string` - The recipient's WhatsApp ID\n- `content: Templatable` - The content object containing text, footer, and template buttons\n- `options?: MiscMessageGenerationOptions` - Optional message generation options\n\n**Returns:** `Promise\u003cproto.WebMessageInfo | undefined\u003e`\n\n**Example:**\n```typescript\nconst templateContent: Templatable = {\n  text: \"Hello! Please choose an option:\",\n  footer: \"Footer text\",\n  templateButtons: [\n    { index: 1, urlButton: { displayText: \"Visit Website\", url: \"https://example.com\" } },\n    { index: 2, callButton: { displayText: \"Call us\", phoneNumber: \"+1234567890\" } },\n    { index: 3, quickReplyButton: { displayText: \"Quick Reply\", id: \"quick-reply-id\" } },\n  ],\n};\nconst result = await sock.sendTemplateMessage(\"1234567890@s.whatsapp.net\", templateContent);\n```\n\n**Example:**\n\n```javascript\ntry {\n    await conn.add('1234567890-123456@g.us', '9876543210@s.whatsapp.net');\n    console.log('Participant added successfully!');\n} catch (err) {\n    console.error(`Failed to add participant: ${err.message}`);\n}\n```\n\n\n### `remove(groupJid, participantJid)` ➖\n\n**Description:** Removes a specified participant from a WhatsApp group. Requires admin privileges.\n\n**Parameters:**\n\n* `groupJid` (string): The group's JID (e.g., `1234567890-123456@g.us`).\n* `participantJid` (string): The participant's JID (e.g., `9876543210@s.whatsapp.net`).\n\n**Example:**\n\n```javascript\ntry {\n    await conn.remove('1234567890-123456@g.us', '9876543210@s.whatsapp.net');\n    console.log('Participant removed successfully!');\n} catch (err) {\n    console.error(`Failed to remove participant: ${err.message}`);\n}\n```\n\n--------------------------------------------------------------\n\n\n\n# Setting Up Commands with easy-baileys\n\nTo create and manage commands for your WhatsApp bot using `easy-baileys`, follow these steps:\n\n1. **Import `loadCommands` and `getCommand`** from `easy-baileys` to manage your bot commands:\n\n   ```javascript\n   const { loadCommands, getCommand } = require('easy-baileys');\n   ```\n\n2. **Loading Commands:**\n   \n   Use `loadCommands` to load commands from a specified directory. Example:\n\n   ```javascript\n   // Load commands from the specified directory\n   await loadCommands('./commands');\n   ```\n\n3. **Handling Commands:**\n\n   Use `getCommand` to retrieve and execute commands based on incoming messages. Example:\n\n   ```javascript\n   // Listen for new messages\n   sock.ev.on(\"messages.upsert\", async ({ messages }) =\u003e {\n       for (const m of messages) {\n           const { message } = m;\n           const messageTypes = ['extendedTextMessage', 'conversation', 'imageMessage', 'videoMessage'];\n\n           // Extract text from the message if it matches any of the specified types\n           let text = messageTypes.reduce((acc, type) =\u003e\n               acc || (message[type] \u0026\u0026 (message[type].text || message[type].caption || message[type])) || '', '');\n\n           // Convert the extracted text to lowercase for processing\n           const response = text.toLowerCase();\n           const prefix = ['!']; // Prefixes to identify commands\n\n           // Check if the message starts with the prefix\n           if (!prefix.some(p =\u003e response.startsWith(p))) {\n               continue;\n           }\n\n           // Parse command name and arguments\n           const [commandName, ...args] = response.slice(prefix.length).trim().split(/\\s+/);\n\n           // Get the corresponding command handler\n           const command = await getCommand(commandName);\n\n           // If the command is not found, log and continue\n           if (!command) {\n               console.log(`Command not found: ${commandName}`);\n               continue;\n           }\n\n           // Execute the command\n           try {\n               await command.execute(sock, m, args);\n           } catch (cmdError) {\n               console.error(`Error executing command '${commandName}':`, cmdError.message);\n           }\n       }\n   });\n   ```\n\n### Example Command File Structure\n\nHere's an example structure for a `Ping` command (`command/Ping.js`):\n\n```javascript\nmodule.exports = {\n    usage: [\"ping\"],\n    desc: \"Checks the bot's response time.\",\n    commandType: \"Bot\",\n    isGroupOnly: false,\n    isAdminOnly: false,\n    isPrivateOnly: false,\n    emoji: '🏓', // Ping pong emoji for fun\n\n    async execute(sock, m) {\n        try {\n            // Get the timestamp before sending the message\n            const startTime = Date.now();\n            const latency = Date.now() - startTime;\n            await sock.reply(m, `🚀 Pong! ${latency}ms`);\n        } catch (error) {\n            await sock.reply(m, \"❌ An error occurred while checking the ping: \" + error);\n        }\n    }\n};\n```\n\n### Command Metadata Explanation:\n\n- **`usage`:** Array of strings defining how users can invoke the command.\n- **`desc`:** Brief description of what the command does.\n- **`commandType`:** Type of command (e.g., Bot, Admin).\n- **`isGroupOnly`:** Whether the command works only in group chats.\n- **`isAdminOnly`:** Whether the command is restricted to admins.\n- **`isPrivateOnly`:** Whether the command can only be used in private chats.\n- **`emoji`:** Emoji associated with the command for visual appeal.\n\nNow you're all set to create and manage commands for your WhatsApp bot using `easy-baileys`! 🚀✨\n\n\n### Configuration Options ⚙️\n\n- `browser`: An array specifying the browser information (e.g., `[\"Ubuntu\", \"Chrome\", \"20.0.04\"]`).\n- `printQRInTerminal`: (Boolean) Display the QR code in the terminal (default: `false`).\n- `mobile`: (Boolean) Set to `true` if connecting from a mobile device.\n- **Refer to the `@whiskeysockets/baileys` documentation for additional options.**\n\n## Contributing 🤝\n\nContributions are welcome! Please feel free to submit issues and pull requests.\n\n## Thanks to\n\n[![WhiskeySockets](https://github.com/WhiskeySockets.png?size=100)](https://github.com/WhiskeySockets/Baileys)\n[![bobslavtriev](https://github.com/bobslavtriev.png?size=100)](https://github.com/bobslavtriev/mysql-baileys)\n\n## License 📄\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhacxk%2Feasy-baileys","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhacxk%2Feasy-baileys","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhacxk%2Feasy-baileys/lists"}