An unofficial WhatsApp API signs in to a normal WhatsApp number as a linked device, the way WhatsApp Web does, and exposes that session to your code. Three open-source libraries do the work underneath almost every option: Baileys (TypeScript, over a WebSocket), whatsapp-web.js (Node.js, driving a real WhatsApp Web page in a headless browser) and whatsmeow (Go, over a WebSocket). WAHA and Evolution API wrap them into self-hosted REST servers, and hosted services such as Swarmhit's Raw API, Unipile or Whapi.Cloud run the sessions for you. None of them is affiliated with WhatsApp, and none replaces Meta's official Business Platform.
We read the README of each project and pulled their GitHub data on 14 November 2026. The choice between them is mostly about runtime, memory and who handles the session when WhatsApp logs it out.
How does an unofficial WhatsApp API work?
WhatsApp lets one phone link up to four other devices, by scanning a QR code or by entering the phone number, according to WhatsApp's help center. An unofficial API is one of those linked devices. Your server holds the session keys, receives every message the number receives, and sends as the number, with no approved templates and no per-message fee from Meta.
There are two ways to be that device. The WebSocket approach speaks WhatsApp's multi-device protocol directly, with no browser: that is Baileys in TypeScript and whatsmeow in Go. The browser approach opens WhatsApp Web in a headless Chromium through Puppeteer and calls the page's own functions: that is whatsapp-web.js, which says in its README that running a managed browser instance is meant "to reduce the risk of being blocked". The trade is memory against fidelity. A WebSocket session is a few objects in a process, while a browser session is a whole Chromium instance per number.
Two rules from WhatsApp itself apply to every option. Linked devices are logged out when the primary phone is not used for more than 14 days, and a linked device that stays inactive for 30 days is disconnected automatically. Whatever library you pick, reconnection is part of the product.
How do Baileys, whatsapp-web.js and whatsmeow compare?
| Project | Language | How it connects | License | GitHub stars | Last push |
|---|---|---|---|---|---|
| Baileys (WhiskeySockets) | TypeScript, JavaScript | WebSocket, no browser | MIT | 11,635 | 13 November 2026 |
| whatsapp-web.js (wwebjs) | Node.js | Puppeteer driving WhatsApp Web | Apache-2.0 | 22,908 | 12 November 2026 |
| whatsmeow (tulir) | Go | WebSocket, multi-device protocol | MPL-2.0 | 7,854 | 13 November 2026 |
| WAHA (devlikeapro) | TypeScript server, Docker | Choice of engines: browser (WEBJS, WPP) or WebSocket (NOWEB, GOWS) | Apache-2.0 | 7,823 | 11 November 2026 |
| Evolution API | TypeScript server | Baileys for WhatsApp Web, or Meta's official Cloud API | Apache-2.0 with brand conditions | 10,117 | 12 November 2026 |
| WPPConnect | TypeScript | Browser automation of WhatsApp Web | Not identified by GitHub | 3,527 | 14 November 2026 |
Every project was pushed to within the last week, which says less about quality than about pace: WhatsApp changes its web client often, and these libraries follow. Check the last release date before you depend on any of them.
Baileys is the default for Node.js teams that want many sessions on one server. whatsapp-web.js is the easiest to start with and the closest to what a person sees in WhatsApp Web, at the price of a browser per number. whatsmeow is the Go option, with a short feature list in its README that is precise about gaps: broadcast lists and calls are not implemented, and status messages are experimental.
What about WAHA and Evolution API?
They are servers, not libraries. You run them in Docker, open a session per number, scan the QR code, and call a REST API instead of writing code against a library.
WAHA lets you pick the engine per deployment. Its documentation describes WEBJS and WPP as browser engines that run a real WhatsApp Web instance, NOWEB and GOWS as WebSocket engines that skip Chromium to "save you CPU and Memory", and GOWS as the future replacement for NOWEB. Since version 2026.6, the features that used to need a WAHA Plus subscription ship in the free image, with unlimited sessions, and the project is funded by a voluntary $5 a month Community tier.
Evolution API runs on Baileys for WhatsApp Web and can also drive Meta's official Cloud API, with integrations such as Typebot, Chatwoot, OpenAI, RabbitMQ, Amazon SQS and S3 storage. Its license is Apache 2.0 with added brand-protection conditions, logo and copyright preservation plus a usage notification requirement, which matters if you plan to resell it inside your product.
What does the code look like?
whatsapp-web.js has the shortest path from install to a working bot. This is the example from its README:
const { Client } = require('whatsapp-web.js');
const qrcode = require('qrcode-terminal');
const client = new Client();
client.on('qr', (qr) => {
qrcode.generate(qr, { small: true });
});
client.on('ready', () => {
console.log('Client is ready!');
});
client.on('message', (msg) => {
if (msg.body == '!ping') {
msg.reply('pong');
}
});
client.initialize();Everything the example leaves out is the work. The session lives in memory until you add an auth strategy that persists it, the QR code shows up in a terminal instead of in your user's browser, and nothing in it handles a disconnect. Baileys and whatsmeow have the same shape with fewer moving parts and no browser.
Will WhatsApp ban a number used with these libraries?
It can, and the libraries say so. WhatsApp's terms of service forbid "bulk messaging, auto-messaging, auto-dialing" and allow WhatsApp to disable or suspend accounts. The Baileys README ends with "Do not spam people with this. We discourage any stalkerware, bulk or automated messaging usage." Both Baileys and whatsapp-web.js state that they are not affiliated with, authorized or endorsed by WhatsApp.
In practice, the realistic use is the conversation a person would have anyway, from their own number: a support agent replying, a sales rep following up a deal after a call, an assistant that reads and drafts. A number that sends the same message to hundreds of strangers looks like spam to WhatsApp whichever library sends it. For notifications and promotions at volume, Meta's Business Platform is the supported route, and our guide to WhatsApp Business API pricing prices it per message by country.
What does self-hosting really cost?
The libraries are free, and the cost moves to operations. You need a server that keeps one long-lived session per number, persistent storage for the session keys, a way to show the QR code or pairing code to whoever owns the number, reconnect logic for the 14-day and 30-day logouts, and someone who updates the library when WhatsApp ships a change. On the browser engines, each number is also a Chromium process, so the server grows with the number of numbers, which is why WAHA points users who need many sessions to its WebSocket engines.
Hosted services sell that operations layer. Whapi.Cloud lists $40 a month per number with unlimited messages, shown at $29 with a 33% discount on 14 November 2026. Unipile bills per connected account across channels, $55 a month for up to 10, then $5.50 each. Swarmhit's Raw API, in early access, costs $3.90 per number a month, down to $2.50 with volume, from 15 accounts, and links numbers with a QR code or a pairing code and exposes chats, text, files, voice messages, groups and reactions on the same paths as its LinkedIn and email actions, with client_id so a retried send goes out once. The full grid is on the Raw tab of the pricing page, and the Unipile review covers Unipile in depth. The hosted options, official and linked-number, are compared in our guide to WhatsApp API providers.
What breaks in production?
Sessions that vanish overnight. The symptom is a number that stops receiving messages with no error. The cause is usually WhatsApp's logout rules, the phone unused for 14 days or the linked device idle for 30, or a session file lost on a redeploy. The fix is to persist sessions outside the container, listen for the library's disconnect events, and alert the number's owner to scan again before customers notice.
A library update that breaks sending. WhatsApp changes its web client, the library ships a fix within days, and a deployment pinned to an old version stops working. Pin versions, but watch the project's releases and keep the upgrade path short.
Duplicate messages after a reconnect. A send that timed out during a reconnect is retried and goes out twice, from a person's number, to a prospect. Give every outgoing message your own id and check it before retrying, the same discipline our guide to LinkedIn API rate limits recommends for 429s.
Too many sessions on one box. On browser engines, every number is a Chromium instance, and a server sized for ten numbers falls over at fifty. Move to a WebSocket engine or split numbers across workers before you scale.
Should you build on a library or on a hosted API?
Build on a library when WhatsApp is the product, you have a few numbers, and someone on the team will own session handling as a real job. Use a hosted API when WhatsApp is one channel among several and your team would rather spend its time on the product: the session, the reconnects and the library upgrades become someone else's on-call. The same split exists on LinkedIn, where teams weigh writing their own LinkedIn outreach tool against an outreach API that already runs the accounts.
Swarmhit sits on the hosted side twice. The Raw API gives your code one endpoint per WhatsApp action. The Smart API goes one level up: a rep's WhatsApp number joins the same sequence as their LinkedIn account and cold email mailboxes, the engine paces each number, and a reply on any channel stops the follow-ups. WhatsApp is in early access on both, and the WhatsApp channel page shows what each one covers.
FAQ
Is there a free WhatsApp API?
Yes, if you host it yourself. Baileys, whatsapp-web.js and whatsmeow are open source under MIT, Apache-2.0 and MPL-2.0, and WAHA has shipped its former paid features in the free image since version 2026.6. What you pay for is a server, storage and the time to keep sessions alive. Meta's official Cloud API is not free per message: it bills each delivered template by category and country.
Is Baileys better than whatsapp-web.js?
For running many numbers, usually yes, because Baileys speaks the protocol over a WebSocket while whatsapp-web.js runs a headless Chromium per session. whatsapp-web.js is closer to the real web client and has more GitHub stars, 22,908 against 11,635 on 14 November 2026, and its README frames the browser as a way to reduce the risk of being blocked. Pick on runtime and scale rather than popularity.
Is whatsmeow reliable?
It is actively maintained, written in Go, and was pushed to on 13 November 2026, a day before we checked. Its README lists what works, private and group messages, media, receipts, app state, and what does not: broadcast lists and calls are not implemented, and status messages are marked experimental. Like every unofficial library, it can break when WhatsApp changes its protocol, so watch its releases.
What is Evolution API?
An open-source REST server for WhatsApp, built on Baileys for WhatsApp Web, that can also drive Meta's official Cloud API. It adds integrations with tools such as Typebot, Chatwoot, OpenAI, RabbitMQ, Amazon SQS and S3. Its license is Apache 2.0 with extra brand-protection conditions, keeping its logo and copyright notices plus a usage notification requirement, so read it before embedding Evolution API in a product you sell.
How many WhatsApp sessions can one number have?
One phone can link up to four devices at once, so an unofficial API session uses one of those four slots alongside WhatsApp Web or Desktop. WhatsApp logs linked devices out when the phone goes unused for more than 14 days and disconnects a linked device that has been inactive for 30 days, so a server holding sessions must handle both cases and ask the owner to link again.
Can I use an unofficial WhatsApp API for marketing?
Not safely. WhatsApp's terms forbid bulk messaging and auto-messaging, and Baileys asks its users not to spam and discourages bulk or automated messaging. A number that broadcasts to people who never wrote to it can be disabled. For promotions and notifications at volume, use Meta's Business Platform with opted-in recipients and approved templates, and keep linked numbers for one-to-one conversations.




