{"id":16293397,"url":"https://github.com/jonalan7/hydra-bot","last_synced_at":"2025-04-05T05:03:03.400Z","repository":{"id":36981619,"uuid":"491578351","full_name":"jonalan7/Hydra-bot","owner":"jonalan7","description":"The most reliable WhatsApp tool for chatbots with advanced features.  Hydra bot is an open source project developed by the JavaScript community with the aim of exporting functions from WhatsApp Web to the node js, .  The most complete javascript library for Whatsapp, 100% Open Source. ","archived":false,"fork":false,"pushed_at":"2025-03-27T19:09:58.000Z","size":6188,"stargazers_count":65,"open_issues_count":12,"forks_count":20,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-29T04:04:08.113Z","etag":null,"topics":["api","bot","bot-javascript","chatbot","chatbots","message","nodejs","puppeteer","whatsapp","whatsapp-api","whatsapp-bot","zap-api","zap-bot"],"latest_commit_sha":null,"homepage":"","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/jonalan7.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-12T15:53:24.000Z","updated_at":"2025-03-27T19:09:14.000Z","dependencies_parsed_at":"2024-10-27T10:52:22.843Z","dependency_job_id":"e58c630e-7006-4141-b4ae-4c54bdf7a143","html_url":"https://github.com/jonalan7/Hydra-bot","commit_stats":{"total_commits":231,"total_committers":5,"mean_commits":46.2,"dds":0.316017316017316,"last_synced_commit":"b8ab0fa398fdb3e902b670bd9b7ff313fa4e90ac"},"previous_names":[],"tags_count":39,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonalan7%2FHydra-bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonalan7%2FHydra-bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonalan7%2FHydra-bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonalan7%2FHydra-bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonalan7","download_url":"https://codeload.github.com/jonalan7/Hydra-bot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247289409,"owners_count":20914464,"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","bot","bot-javascript","chatbot","chatbots","message","nodejs","puppeteer","whatsapp","whatsapp-api","whatsapp-bot","zap-api","zap-bot"],"created_at":"2024-10-10T20:11:14.261Z","updated_at":"2025-04-05T05:03:03.378Z","avatar_url":"https://github.com/jonalan7.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Status repository\n\n[![npm version](https://img.shields.io/npm/v/hydra-bot.svg?color=green)](https://www.npmjs.com/package/hydra-bot)\n[![Downloads](https://img.shields.io/npm/dm/hydra-bot.svg)](https://www.npmjs.com/package/hydra-bot)\n[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/jonalan7/hydra-bot.svg)](http://isitmaintained.com/project/jonalan7/hydra-bot 'Average time to resolve an issue')\n[![Percentage of issues still open](http://isitmaintained.com/badge/open/jonalan7/hydra-bot.svg)](http://isitmaintained.com/project/orkestral/hydra-bot 'Percentage of issues still open')\n\n## Our online channels\n\n[![WhatsApp Group](https://img.shields.io/badge/WhatsApp-Group-25D366?logo=whatsapp)](https://chat.whatsapp.com/FkweAzEKOTp3WaFAUzvKne)\n[![Discord](https://img.shields.io/discord/987415785653817384?color=blueviolet\u0026label=Discord\u0026logo=discord\u0026style=flat)](https://discord.gg/rBBeSxjgdg)\n[![YouTube](https://img.shields.io/youtube/channel/subscribers/UCMBtZ3CjcLCAtjqotleiOOQ?label=YouTube)](https://www.youtube.com/user/ANONIMUism)\n[![Telegram Group](https://img.shields.io/badge/Telegram-Group-32AFED?logo=telegram)](https://t.me/hydra_bot_io)\n\n# Welcome to Hydra Bot\n\n\u003cimg height=\"150\" src=\"img/hydra.png\"\u003e\u003c/img\u003e\n\n\u003e This project was developed to help the community that uses whatsapp as a way to implement an API quickly and effectively, for companies and much more! Thank you for being part of this family.\n\nYou can use this project in two ways, the first is using Web Services using a set of well-defined operations, the POST, GET, PUT and DELETE methods, the second option is to use the bot in raw form, without using a Web Services.\n\n \u003ca target=\"_blank\" href=\"https://jonalan7.github.io/Hydra-bot/\" target=\"_blank\"\u003e\n  \u003cimg title=\"documentation\" height=\"50\" width=\"190\" src=\"img/documentation.png\"\u003e\n \u003c/a\u003e\n\n## WhatSapp Group\n\n\u003ca target=\"_blank\" href=\"https://chat.whatsapp.com/FkweAzEKOTp3WaFAUzvKne\" target=\"_blank\"\u003e\n \u003cimg title=\"whatzapp\" height=\"50\" width=\"190\" src=\"https://upload.wikimedia.org/wikipedia/commons/thumb/f/f7/WhatsApp_logo.svg/2000px-WhatsApp_logo.svg.png\"\u003e\u003c/a\u003e\n\nDo you have any doubt? Need help? Join our whatsapp group and ask your questions with other people!\n\n## Installation\n\nUse the stable version:\n\n```bash\n\u003e npm i --save hydra-bot\n```\n\nor for [Nightly releases](https://github.com/jonalan7/Hydra-bot/releases/tag/nightly):\n\n```bash\n\u003e npm i --save https://github.com/jonalan7/Hydra-bot/releases/download/nightly/hydra-nightly.tgz\n```\n\nTerminal Admin:\n\n```bash\n\u003e yarn admin\n```\n\nInstall yarn Ubuntu:\n\n```bash\n\u003e curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -\n\u003e echo \"deb https://dl.yarnpkg.com/debian/ stable main\" | sudo tee /etc/apt/sources.list.d/yarn.list\n\u003e sudo apt update \u0026\u0026 sudo apt install yarn\n\u003e yarn\n```\n\n## Getting started Web Service\n\nThe service will be started on localhost on port 8080\n\n```javascript\nconst hydraBot = require('hydra-bot');\n(async () =\u003e {\n  // start Web Service\n  const WS = await hydraBot.initWs();\n})();\n```\n\n## Getting started bot (the bot in raw form, without using a Web Services).\n\nIf you want to work in free mode, using only the bot, dry the necessary information!\n\n```javascript\nconst hydraBot = require('hydra-bot');\nconst mime = require('mime-types');\nconst fs = require('fs');\n\n(async () =\u003e {\n  let client;\n  let checkConnect = false;\n\n  // start bot service\n  const ev = await hydraBot.initServer();\n\n  // return to current whatsapp interface\n  ev.on('interfaceChange', (change) =\u003e {\n    console.log('interfaceChange: ', change);\n  });\n\n  // return qrcode parameters\n  ev.on('qrcode', (qrcode) =\u003e {\n    console.log('qrcode: ', qrcode);\n  });\n\n  // return connection information\n  ev.on('connection', async (conn) =\u003e {\n    // browser information!\n    if (conn.statusFind === 'browser') {\n      console.log('info Browser: ', conn.text);\n    }\n\n    // Was connected to whatsapp chat\n    if (conn.connect \u0026\u0026 !checkConnect) {\n      checkConnect = true;\n      client = conn.client; // class client from hydra-bot\n      const getMe = await client.getHost();\n      const hostNumber = getMe.id._serialized; // number host\n      console.log('Host Number: ', hostNumber);\n\n      // send a text message\n      await client\n        .sendMessage({\n          to: hostNumber, // you can pass the contact number or group number\n          body: \"hi i'm hydra bot\", // message text\n          options: {\n            type: 'sendText', // shipping type\n          },\n        })\n        .then((result) =\u003e {\n          console.log(result); // message result\n        })\n        .catch((error) =\u003e {\n          console.log(error); // message error\n        });\n    }\n  });\n\n  // return receive new messages\n  ev.on('newMessage', async (newMsg) =\u003e {\n    // when is received\n    if (!newMsg.result.fromMe) {\n      // message received!\n      console.log('NewMessageReceived: ', newMsg.result);\n      // dowload files\n      if (newMsg.result.isMedia) {\n        const buffer = await client.decryptFile(newMsg.result);\n        // At this point you can do whatever you want with the buffer\n        // Most likely you want to write it into a file\n        const fileName = `some-file-name.${mime.extension(\n          newMsg.result.mimetype\n        )}`;\n        fs.writeFile(fileName, buffer, (err) =\u003e {\n          if (err) {\n            console.log(err);\n          }\n        });\n      }\n    }\n    // when is it sent\n    if (!!newMsg.result.fromMe) {\n      // Message sent\n      console.log('NewMessageSent: ', newMsg.result);\n    }\n  });\n\n  // returns the status of each message\n  ev.on('newOnAck', async (event) =\u003e {\n    console.log('id Message: ', event.result.id._serialized); // message id\n    console.log('Status Message: ', event.result.ack); // -7 = MD_DOWNGRADE, -6 = INACTIVE, -5 = CONTENT_UNUPLOADABLE, -4 = CONTENT_TOO_BIG, -3 = CONTENT_GONE, -2 = EXPIRED, -1 = FAILED, 0 = CLOCK, 1 = SENT, 2 = RECEIVED, 3 = READ, 4 = PLAYED\n    console.log('From Message: ', event.result.from); // from message\n    console.log('To Message: ', event.result.to); // to message\n  });\n})();\n```\n\n## Initialization Types\n\nThere are two ways to initialize: using a **QR Code** or a phone number.\n\n### QR Code Initialization\n\nTo start the service using a **QR Code**, use the following code:\n\n```javascript\nconst hydraBot = require('hydra-bot');\n\n(async () =\u003e {\n  const ev = await hydraBot.initServer();\n  // Returns QR Code parameters\n  ev.on('qrcode', (qrcode) =\u003e {\n    console.log('QR Code: ', qrcode);\n  });\n})();\n```\n\n### Phone Number Initialization\n\nTo start using a **phone number**, you can input the number and receive a verification code on the phone:\n\n```javascript\nconst hydraBot = require('hydra-bot');\n\n(async () =\u003e {\n  const ev = await hydraBot.initServer({\n    loginWithPhoneNumber: {\n      phoneNumber: '0000000000000', // Phone number with country code\n      timeRefeshCode: 120000, // Time to refresh the code (in milliseconds)\n      isOn: true, // Enable login with phone number\n    },\n  });\n\n  // Returns the code sent to the phone number\n  ev.on('codePhoneNumber', (status) =\u003e {\n    console.log('Code Phone Number: ', status);\n  });\n})();\n```\n\n## Downloading Files\n\nPuppeteer takes care of the file downloading. The decryption is being done as\nfast as possible (outruns native methods). Supports big files!\n\n```javascript\nconst hydraBot = require('hydra-bot');\nconst fs = require('fs');\nconst mime = require('mime-types');\n\n(async () =\u003e {\n  let client;\n  // start bot service\n  const ev = await hydraBot.initServer();\n\n  // return connection information\n  ev.on('connection', async (conn) =\u003e {\n    // Was connected to whatsapp chat\n    if (conn.connect) {\n      client = conn.client;\n    }\n  });\n\n  ev.on('newMessage', async (newMsg) =\u003e {\n    // when is received\n    if (!newMsg.result.fromMe) {\n      // message received!\n      console.log('NewMessageReceived: ', newMsg.result);\n      // dowload files\n      if (newMsg.result.isMedia) {\n        const buffer = await client.decryptFile(newMsg.result);\n        // At this point you can do whatever you want with the buffer\n        // Most likely you want to write it into a file\n        const fileName = `some-file-name.${mime.extension(\n          newMsg.result.mimetype\n        )}`;\n        fs.writeFile(fileName, buffer, (err) =\u003e {\n          if (err) {\n            console.log(err);\n          }\n        });\n      }\n    }\n  });\n})();\n```\n\n## Optional create parameters (the bot in raw form, without using a Web Services)\n\n```javascript\nconst hydraBot = require('hydra-bot');\n\nhydraBot.initServer({\n  loginWithPhoneNumber: {\n    // Init login with phone number\n    phoneNumber: '000000000000', // phone number with country\n    timeRefeshCode: 120000, // time to refresh code\n    isOn: false, // Login with phone number\n  },\n  session: 'session', // Name of the token to be generated, a folder with all customer information will be created\n  pathNameToken: 'token', // The path and name of the folder where the client tokens will be saved\n  printQRInTerminal: true, // The QR CODE will be printed on the terminal if true\n  updatesLog: true, // Logs info updates automatically in terminal\n  timeAutoClose: 60000, // If you don't read the QR CODE by default 60 seconds, it will automatically close the client's browser to save memory, if you want to disable it, set 0 or false\n  mkdirFolderToken: '', // Token folder path, only inside the project\n  puppeteerOptions: {\n    headless: true, // Start the project with the browser open or not!\n    args: [], // Additional arguments to pass to the browser instance. adding any parameter you will replace the default args of the project\n    executablePath: 'useChrome', // The browser that will be used for the project, you can specify a path, if you don't pass any parameters it will open the installed browser.\n  },\n});\n```\n\n## Optional create parameters Web Services\n\n```javascript\nconst hydraBot = require('hydra-bot');\n\nhydraBot.initWs({\n  hostServer: 'http://localhost',\n  port: '8080',\n  url: '', // point a URL to receive a callback!\n  authentication: true, // ask for authentication in routes\n  pathNameToken: 'token', // The path and name of the folder where the client tokens will be saved\n  printQRInTerminal: true, // The QR CODE will be printed on the terminal if true\n  updatesLog: true, // Logs info updates automatically in terminal\n  timeAutoClose: 60000, // If you don't read the QR CODE by default 60 seconds, it will automatically close the client's browser to save memory, if you want to disable it, set 0 or false\n  mkdirFolderToken: '', // Token folder path, only inside the project\n  puppeteerOptions: {\n    headless: true, // Start the project with the browser open or not!\n    args: [], // Additional arguments to pass to the browser instance. adding any parameter you will replace the default args of the project\n    executablePath: 'useChrome', // The browser that will be used for the project, you can specify a path, if you don't pass any parameters it will open the installed browser.\n  },\n});\n```\n\n### Commands for administration via terminal\n\nTo start the administration interface use:\n\n```bash\n\u003e yarn admin\n```\n\nList of commands in the terminal:\n\n| Command       | Description                                      |\n| ------------- | :----------------------------------------------- |\n| `/create`     | Create user                                      |\n| `/delete`     | Delete user                                      |\n| `/selectid`   | Show user by id                                  |\n| `/selectname` | Select user by name                              |\n| `/getall`     | List all users                                   |\n| `/deactivate` | Disable user                                     |\n| `/activate`   | Activate User                                    |\n| `/changename` | Change username                                  |\n| `/password`   | Change user password                             |\n| `/cls`        | Clear screen/terminal                            |\n| `/help`       | List all commands for administration in terminal |\n| `/exit`       | Exit manager                                     |\n\n## Routes for handling and querying users.\n\n### List of commands using `REST API`\n\n##### All user wheels have a pattern of `Headers`, to be able to access them, to create a administrator\n\n```json\n{\n  \"Content-Type\": \"application/json\",\n  \"admin\": \"admin\",\n  \"admin_pass\": \"admin\"\n}\n```\n\n### List of routes for user management:\n\n| Type | Route to browser         | Description          | Body                                                |\n| ---- | ------------------------ | -------------------- | --------------------------------------------------- |\n| POST | `/create_user`           | Create user          | `{\"name\":\"USE\",\"password\":\"USER PASSWORD\"}`         |\n| DEL  | `/delete_user/ID_USE`    | Delete user          | `EMPTY`                                             |\n| GET  | `/get_user_by_id/ID_USE` | Show user by ID      | `EMPTY`                                             |\n| GET  | `/get_all_users`         | List all users       | `EMPTY`                                             |\n| PUT  | `/deactivate_user`       | Disable user         | `{\"id\":\"USER ID\"}`                                  |\n| PUT  | `/activate_user`         | Activate User        | `{\"id\":\"USER ID\"}`                                  |\n| PUT  | `/change_name`           | Change username      | `{\"id\":\"USER ID\",\"name\":\"NEW USERNAME\"}`            |\n| PUT  | `/change_password`       | Change user password | `{\"id\":\"USER ID\",\"password\":\"NEW SECURE PASSWORD\"}` |\n\n## Web Service Routes (more features still under development)\n\n\u003e Note: Parameters can be changed during development!\n\n### List of routes for managing whatsapp:\n\n##### All whatsapp connection wheels have a pattern of `Headers` of user (default, username = 'user', password = 'user').\n\nThe headers must be parameterized as :\n\n```json\n{\n  \"Content-Type\": \"application/json\",\n  \"user\": \"user\",\n  \"user_pass\": \"user\"\n}\n```\n\n# Using Webhook\n\nif you want to receive a callback on a specific url, pass the url parameter in the connect route.\n\n### Methods POST\n\n| Type | Route to browser | Description                      | Body                                                                                                                            |\n| ---- | ---------------- | -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |\n| POST | `/connect`       | Start connection with Whatsapp   | `{ \"url\": \"http://localhost:8080/webhooktest\" }`                                                                                |\n| POST | `/sendtext`      | Send a text to a number          | `{ \"to\": \"contact number\", \"body\": \"message\"}`                                                                                  |\n| POST | `/sendFile`      | Send file to a number            | `{ \"to\": \"contact number\", \"file_path\": \"https://docs.marklogic.com/guide/node-dev.pdf\", \"file_name\": \"node.js\" }`              |\n| POST | `/sendAudio`     | Send audio                       | `{ \"to\": \"contact number\", \"url_mp3\": \"https://cdn.freesound.org/previews/620/620094_4935038-lq.mp3\", \"file_name\": \"node.js\" }` |\n| POST | `/sendImage`     | Send image message               | `{ \"to\": \"contact number\", \"url_img\": \"https://i.pinimg.com/564x/a9/b1/18/a9b118761788b1ab260aae2835c468cd.jpg\" }`              |\n| POST | `/disconnect`    | Disconnecting from the server    | EMPTY                                                                                                                           |\n| POST | `/check_user`    | Check if the entered user exists | EMPTY                                                                                                                           |\n\n### Methods GET\n\n| Type | Route to browser    | Description                      | Body    |\n| ---- | ------------------- | -------------------------------- | ------- |\n| GET  | `/get_all_contacts` | Retrieve contacts                | `EMPTY` |\n| GET  | `/check_connect`    | check if the client is connected | `EMPTY` |\n| GET  | `/last_qrcode`      | Check if the QR-Code is active   | `EMPTY` |\n| GET  | `/screenshot`       | Get screenshot                   | `EMPTY` |\n\n## Basic send options functions (more features still under development)\n\nYou must be logged in to use these functions!\n\n##### Here, `to` can be `\u003cphone Number\u003e@c.us` or `\u003cphone Number\u003e-\u003cgroupId\u003e@g.us` or `\u003cphone Number\u003e\u003cgroupId\u003e@g.us`\n\nyou can send messages only using one function!\n\n```javascript\n// send text message\nawait client\n  .sendMessage({\n    to: '0000000000@c.us', // you can pass the contact number or group number\n    body: 'A message sent by hydra-bot', // message text\n    options: {\n      type: 'sendText', // shipping type\n    },\n  })\n  .then((result) =\u003e {\n    console.log(result); // message result\n  })\n  .catch((error) =\u003e {\n    console.log(error); // message error\n  });\n\n// send files\nawait client\n  .sendMessage({\n    to: '0000000000@c.us', // you can pass the contact number or group number\n    body: './file.pdf', // you can use a directory or use a url\n    options: {\n      type: 'sendFile', // shipping type\n      filename: 'filename', // put the file name here\n    },\n  })\n  .then((result) =\u003e {\n    console.log(result); // message result\n  })\n  .catch((error) =\u003e {\n    console.log(error); // message error\n  });\n\n// send file audio\nawait client\n  .sendMessage({\n    to: '0000000000@c.us', // you can pass the contact number or group number\n    body: './file.mp3', // you can use a directory or use a url\n    options: {\n      type: 'sendAudio', // shipping type\n    },\n  })\n  .then((result) =\u003e {\n    console.log(result); // message result\n  })\n  .catch((error) =\u003e {\n    console.log(error); // message error\n  });\n\n// Send audio file base64\nawait client\n  .sendMessage({\n    to: '0000000000@c.us', // you can pass the contact number or group number\n    body: base64MP3, // you can use a directory or use a url\n    options: {\n      type: 'sendAudioBase64', // shipping type\n    },\n  })\n  .then((result) =\u003e {\n    console.log(result); // message result\n  })\n  .catch((error) =\u003e {\n    console.log(error); // message error\n  });\n\n// Send image message\nawait client\n  .sendMessage({\n    to: '0000000000@c.us', // you can pass the contact number or group number\n    body: './file.jpg', // you can use a directory or use a url\n    options: {\n      type: 'sendImage', // shipping type\n      caption: 'image text', // image text\n    },\n  })\n  .then((result) =\u003e {\n    console.log(result); // message result\n  })\n  .catch((error) =\u003e {\n    console.log(error); // message error\n  });\n\n// Send image Base64\nawait client\n  .sendMessage({\n    to: '0000000000@c.us', // you can pass the contact number or group number\n    body: base64IMG, // you can use a directory or use a url\n    options: {\n      type: 'sendImageFromBase64', // shipping type\n      caption: 'image text', // image text\n    },\n  })\n  .then((result) =\u003e {\n    console.log(result); // message result\n  })\n  .catch((error) =\u003e {\n    console.log(error); // message error\n  });\n```\n\n## Basic send functions\n\n```javascript\n// Sends a text message to given chat\nawait client\n  .sendText('0000000000@c.us', 'A message sent by hydra-bot')\n  .then((result) =\u003e {\n    console.log(result); // message result\n  })\n  .catch((error) =\u003e {\n    console.log(error); // message error\n  });\n\n// Sends file from path\nawait client\n  .sendFile('0000000000@c.us', './file.pdf', { filename: 'filename' })\n  .then((result) =\u003e {\n    console.log(result); // message result\n  })\n  .catch((error) =\u003e {\n    console.log(error); // message error\n  });\n\n// Send audio file\nawait client\n  .sendAudio('0000000000@c.us', './file.mp3')\n  .then((result) =\u003e {\n    console.log(result); // message result\n  })\n  .catch((error) =\u003e {\n    console.log(error); // message error\n  });\n\n// Send audio base64\nawait client\n  .sendAudioBase64('0000000000@c.us', base64MP3)\n  .then((result) =\u003e {\n    console.log(result); // message result\n  })\n  .catch((error) =\u003e {\n    console.log(error); // message error\n  });\n\n// Send image message\nawait client\n  .sendImage('0000000000@c.us', './file.jpg', { caption: 'image text' })\n  .then((result) =\u003e {\n    console.log(result); // message result\n  })\n  .catch((error) =\u003e {\n    console.log(error); // message error\n  });\n\n// Send image base64\nawait client\n  .sendImageFromBase64('0000000000@c.us', base64IMG, { caption: 'image text' })\n  .then((result) =\u003e {\n    console.log(result); // message result\n  })\n  .catch((error) =\u003e {\n    console.log(error); // message error\n  });\n```\n\n## Profile Functions\n\n```javascript\n// Get device info\nawait client.getHost();\n\n// Logout from WhatsApp Web\nawait client.logoutSession();\n\n// Closes page and browser client\nawait client.browserClose();\n\n// This function captures an image of the browser screen return base64 image\nawait client.screenshot();\n```\n\n## Retrieving Data\n\n```javascript\n// returns a list of contacts\nconst contacts = await client.getAllContacts();\n\n// return whatsapp version\nconst version = await client.getWAVersion();\n\n// Load all messages in chat by date\nconst listMsg = await client.loadAndGetAllMessagesInChat(\n  '\u003cphone Number\u003e@c.us',\n  'YYYY-MM-DD'\n);\n```\n\n## Group Management\n\nGroup number example `\u003cphone Number\u003e-\u003cgroupId\u003e@g.us` or `\u003cphone Number\u003e\u003cgroupId\u003e@g.us`\n\n```javascript\n// get all participants in the group\nawait client\n  .getGroupParticipant('00000000000-0000000000@g.us')\n  .then((result) =\u003e {\n    console.log('Participants: ', result);\n  })\n  .catch((error) =\u003e {\n    console.log('Error Participants: ', error);\n  });\n\n// Get all Group\nconst allGroups = await client.getAllChatsGroups();\n\n// Get all Chats\nconst AllChats = await client.getAllChats();\n\n// Create group\nawait client\n  .createGroup('Group name', ['111111111111@c.us', '222222222222@c.us'])\n  .then((result) =\u003e {\n    console.log(result); // message result\n  })\n  .catch((error) =\u003e {\n    console.log(error); // message error\n  });\n\n// Add participant to Group\nawait client\n  .addParticipant('00000000-000000@g.us', [\n    '111111111111@c.us',\n    '222222222222@c.us',\n  ])\n  .then((result) =\u003e {\n    console.log(result); // message result\n  })\n  .catch((error) =\u003e {\n    console.log(error); // message error\n  });\n\n// Change group description\nawait client\n  .setGroupDescription('00000000-000000@g.us', 'group description')\n  .then((result) =\u003e {\n    console.log(result); // message result\n  })\n  .catch((error) =\u003e {\n    console.log(error); // message error\n  });\n\n// Change group image\nawait client\n  .setGroupImage('00000000000000@g.us', './file.jpg')\n  .then((result) =\u003e {\n    console.log(result); // message result\n  })\n  .catch((error) =\u003e {\n    console.log(error); // message error\n  });\n```\n\n## Events\n\nList of events triggered in the project\n\n```javascript\n\n// Event triggered when there's a change in the WhatsApp interface\n// The change information can include elements like screen changes or navigation.\nev.on(\"interfaceChange\", (change: any) =\u003e {\n  // Processes the interface change, like navigation between screens\n  console.log(\"Interface change detected:\", change);\n});\n\n// Event triggered when a QR code is generated, typically used for authentication\n// The QR code is sent to the client as a string or object containing data for login.\nev.on(\"qrcode\", (qrcode) =\u003e {\n  // Displays the generated QR code for WhatsApp Web authentication\n  console.log(\"QR Code for authentication:\", qrcode);\n});\n\n// Event triggered when there is a connection change, such as connection loss or establishment\n// Connection data may include network status or connection errors.\nev.on('connection', async (conn) =\u003e {\n  // Displays information about the connection status\n  console.log(\"Connection status:\", conn);\n  if (conn.connect) {\n    // Was connected to whatsapp chat\n    console.error(\"Has connected\");\n  }\n});\n\n// Event triggered when a new message is received\n// The message may include data such as sender, content, timestamp, etc.\nev.on(\"newMessage\", (newMsg) =\u003e {\n  // Displays the data of the new received message\n  console.log(\"New message received:\", newMsg);\n});\n\n// Event triggered when a message is edited\n// The edited message may include the previous content and the new content.\nev.on(\"newEditMessage\", async (editMessage) =\u003e {\n  // Processes the edited message by checking changes in content\n  console.log(\"Message edited:\", editMessage);\n});\n\n// Event triggered when a message is deleted\n// The deleted message may include the message ID and other related details.\nev.on(\"newDeleteMessage\", async (deleteMessage) =\u003e {\n  // Processes the deletion of the message and notifies the user\n  console.log(\"Message deleted:\", deleteMessage);\n});\n\n// Event triggered when there is a new intro reaction (emoji) to a message\n// This can be used to analyze which reactions were added to new messages.\nev.on(\"onIntroReactionMessage\", async (introReaction) =\u003e {\n  // Processes the intro reaction (emoji) to the new message\n  console.log(\"New intro reaction received:\", introReaction);\n});\n\n// Event triggered when an emoji reaction is added to an existing message\n// The reaction may include details like the emoji, sender, and associated message.\nev.on(\"onReactionMessage\", async (reaction) =\u003e {\n  // Processes the reaction added to an existing message\n  console.log(\"Reaction added to message:\", reaction);\n});\n\n// Event triggered to return the status of each message (e.g., read, delivered, etc.)\n// This can include data such as delivery and read status, allowing message state tracking.\nev.on(\"newOnAck\", async (event) =\u003e {\n  // Processes the acknowledgment status of the message\n  console.log(\"Message ack status:\", event);\n});\n\n```\n\n### Debugging\n\nBuilding the hydra-bot is very simple\n\n## Development\n\nTo build the entire project just run\n\n```bash\n\u003e npm run build\n```\n\n## Test\n\nRun a test inside the project\n\n```bash\n\u003e npm run build:dev\n```\n\n## Maintainers\n\nMaintainers are needed, I cannot keep with all the updates by myself. If you are\ninterested please open a Pull Request.\n\n## Contributing\n\nPull requests are welcome. For major changes, please open an issue first to\ndiscuss what you would like to change.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonalan7%2Fhydra-bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonalan7%2Fhydra-bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonalan7%2Fhydra-bot/lists"}