📦WhiskeySockets / Baileys
← 返回首页
Socket-based TS/JavaScript API for WhatsApp Web
⚖️ MIT#bun#deno#nodejs#reverse-engineering#typescript🌐 baileys.wiki📅 创建于 2022-01-12🔄 更新于 2026-10-27
🔗 GitHub JavaScript

📄 仓库 README

在 GitHub 查看 ↗
来自 GitHub 仓库自述文件 · 版权归原作者所有

Baileys logo

Baileys is a WebSockets-based TypeScript library for interacting with the WhatsApp Web API.

[!CAUTION] NOTICE OF BREAKING CHANGE.

As of 7.0.0, multiple breaking changes were introduced into the library.

Please check out https://whiskey.so/migrate-latest for more information.

Important Note

This is a temporary README.md, the new guide is in development and will this file will be replaced with .github/README.md (already a default on GitHub).

New guide link: https://baileys.wiki

Get Support

If you'd like business to enterprise-level support from Rajeh, the current maintainer of Baileys, you can book a video chat. Book a 1 hour time slot by contacting him on Discord or pre-ordering here. The earlier you pre-order the better, as his time slots usually fill up very quickly. He offers immense value per hour and will answer all your questions before the time runs out.

If you are a business, we encourage you to contribute back to the high development costs of the project and to feed the maintainers who dump tens of hours a week on this. You can do so by booking meetings or sponsoring below. All support, even in bona fide / contribution hours, is welcome by businesses of all sizes. This is not condoning or endorsing businesses to use the library. See the Disclaimer below.

Sponsor

If you'd like to financially support this project, you can do so by supporting the current maintainer here.

Disclaimer

This project is not affiliated, associated, authorized, endorsed by, or in any way officially connected with WhatsApp or any of its subsidiaries or its affiliates. The official WhatsApp website can be found at whatsapp.com. "WhatsApp" as well as related names, marks, emblems and images are registered trademarks of their respective owners.

The maintainers of Baileys do not in any way condone the use of this application in practices that violate the Terms of Service of WhatsApp. The maintainers of this application call upon the personal responsibility of its users to use this application in a fair way, as it is intended to be used. Use at your own discretion. Do not spam people with this. We discourage any stalkerware, bulk or automated messaging usage.

  • Baileys does not require Selenium or any other browser to be interface with WhatsApp Web, it does so directly using a WebSocket.
  • Not running Selenium or Chromium saves you like half a gig of ram :/
  • Baileys supports interacting with the multi-device & web versions of WhatsApp.
  • Thank you to @pokearaujo for writing his observations on the workings of WhatsApp Multi-Device. Also, thank you to @Sigalor for writing his observations on the workings of WhatsApp Web and thanks to @Rhymen for the go implementation.

[!IMPORTANT] The original repository had to be removed by the original author - we now continue development in this repository here. This is the only official repository and is maintained by the community. Join the Discord here

Example

Do check out & run example.ts to see an example usage of the library. The script covers most common use cases. To run the example script, download or clone the repo and then type the following in a terminal: 1. cd path/to/Baileys 2. yarn 3. yarn example

Install

Use the stable version:

yarn add @whiskeysockets/baileys

Use the edge version (no guarantee of stability, but latest fixes + features)

yarn add github:WhiskeySockets/Baileys

Then import your code using:

import makeWASocket from '@whiskeysockets/baileys'

Links

Index

Connecting Account

WhatsApp provides a multi-device API that allows Baileys to be authenticated as a second WhatsApp client by scanning a QR code or Pairing Code with WhatsApp on your phone.

[!NOTE] Here is a simple example of event handling

[!TIP] You can see all supported socket configs in the SocketConfig type alias (Recommended)

Starting socket with QR-CODE

[!TIP] You can customize browser name if you connect with QR-CODE, with Browser constant, we have some browsers config, see the BrowsersMap type alias

import makeWASocket from '@whiskeysockets/baileys'

const sock = makeWASocket({
    // can provide additional config here
    browser: Browsers.ubuntu('My App'),
    printQRInTerminal: true
})

If the connection is successful, you will see a QR code printed on your terminal screen, scan it

📈 近 7 天 Star 趋势

每日新增 Star(柱)与累计 Star(线)· 数据来自 GitHub

🏆 排名变化趋势

在各榜单中的排名历史(数字越小越靠前)

📋 历史上榜记录

每次快照的详细数据
日期 榜单 排名 周期新增 总 STAR