DEV Community

Cover image for Building a SaaS on Baileys: Legal, Technical and Business Risks
epifive
epifive

Posted on Originally published at epifive.com

Building a SaaS on Baileys: Legal, Technical and Business Risks

You can write a product on Baileys, but you cannot make it a supported WhatsApp product: the library says it is not affiliated with or authorized by WhatsApp, WhatsApp's terms restrict unauthorized access and bulk messaging, and WhatsApp can suspend access at any time. A SaaS built this way passes that risk to every customer who scans a QR code into it.

This article is for founders, developers and product owners who are deciding whether to build, buy or resell a "WhatsApp API" on an unofficial library. By the end you will have a risk register covering the legal, technical and business sides, a comparison with the official route, and a short list of questions to answer before writing the first line of code. It is an architecture-level discussion only. It contains no setup code for unofficial tools and no help with bulk or unsolicited messaging. It is general information, not legal advice.

What Baileys is, and what it promises

Baileys describes itself as "a WebSockets-based TypeScript library for interacting with the WhatsApp Web API", and its repository is at github.com/WhiskeySockets/Baileys. Three things in its README matter for anyone building a business on it.

  • The disclaimer. The project states it is "not affiliated, associated, authorized, endorsed by, or in any way officially connected with WhatsApp". The maintainers also say they do not condone uses that violate WhatsApp's Terms of Service, and they write: "We discourage any stalkerware, bulk or automated messaging usage."
  • The license. It is licensed under the MIT License, with a standard warranty disclaimer and a limitation of liability for the authors and copyright holders. The license lets you build on the code. It makes no promise that the code will keep working or that WhatsApp will tolerate it.
  • Breaking changes. The README carries a breaking-change notice for version 7.0.0 and points to a migration guide. For a SaaS this is a preview of the maintenance burden: you track an upstream project whose target, WhatsApp's own protocol, you do not control.

For a plain-language introduction to how QR-login services work, read Baileys and QR-login WhatsApp APIs explained. This article goes one level up: what changes when you are the vendor.

Who carries the risk when you are the vendor

When one person scans a QR code for their own number, they accept their own risk. When you operate a service, three parties are involved: WhatsApp, your customer and you. The risk lands in different places.

Party What they can lose Why
Your customer Their business number, chat history access, message flow WhatsApp can suspend access; the number is theirs
You Revenue, reputation, support load, possibly legal exposure Every ban becomes a support ticket and a churn event
WhatsApp Nothing from this arrangement It has no contract with you

The key point is the last row. WhatsApp's Terms of Service, which show an effective date of January 4, 2021 on the page, say WhatsApp "may modify, suspend, or terminate your access to or use of our Services anytime for any reason". You have no agreement with WhatsApp that gives you notice, an appeal route or an account manager. The people who hold the contract with WhatsApp are your customers, as end users, and they did not agree to a third-party automation layer.

Legal risks

Terms of Service

The WhatsApp Terms of Service list prohibited conduct under "Acceptable Use Of Our Services". The clauses that matter for an unofficial integration include a ban on reverse engineering ("reverse engineer, alter, modify, create derivative works from, decompile, or extract code from our Services"), a ban on gaining "unauthorized access to our Services or systems", a ban on creating accounts "through unauthorized or automated means", and a ban on sending "illegal or impermissible communications such as bulk messaging".

The terms do not name Baileys or any other library, so whether a given product breaches them is a question for a lawyer reading the whole document. The safe planning assumption is that an unofficial client is not an approved route, and that WhatsApp's right to suspend access is unconditional.

The business messaging policy

If your customers send marketing messages, WhatsApp's Business Messaging Policy sets the standard. It requires that "you have received opt-in permission from the recipient confirming that they wish to receive subsequent messages", and it tells businesses not to "confuse, deceive, defraud, mislead, spam, or surprise people". It also says users can block or report businesses, that WhatsApp's systems may limit the number of messages a business can send, and that WhatsApp may prohibit an organization "from all future use of WhatsApp products and services". The policy page shows "Last updated: September 23, 2026".

As the vendor, you decide whether your product makes opt-in easy to record or easy to skip. A product with no consent features and a "send to a list" button invites exactly the use the Baileys maintainers discourage.

Data protection

A multi-tenant service that keeps live sessions to customers' numbers can read their conversations, including their customers' names, numbers and messages. Under India's Digital Personal Data Protection Act, 2023, a business that decides why and how personal data is processed carries duties, and hiring a processor does not remove them. We could not open the Act's text in this run, so this article does not quote section numbers. Read WhatsApp customer data privacy and the DPDP Act and take legal advice on your role as processor, your contracts and your breach plan.

Contract and liability

The MIT License shields the Baileys maintainers from you. Nothing shields you from your customers. If your terms of service promise uptime, delivery or "official API" status, a mass ban or a protocol change turns that promise into a breach of contract or a misleading claim. Do not describe an unofficial product as official, approved or "Meta-verified".

Technical risks

Each of these follows from building on a client that is reverse engineered from WhatsApp Web rather than a documented API.

  • Protocol drift. When WhatsApp changes its protocol, your product can break for every customer at once, and the fix depends on an upstream volunteer project or your own reverse engineering. There is no changelog from WhatsApp for you to read.
  • Session state. Linked-device sessions must be stored securely and kept alive. A lost or corrupted session means every affected customer has to scan a QR code again, and customers who are not at their phone are offline.
  • No delivery contract. The official platform documents error codes and webhooks. An unofficial client gives you whatever the library exposes.
  • Scale behavior you cannot tune. The official platform has published limits you can plan around (see the table below). With an unofficial client, the limit is whatever WhatsApp's anti-abuse systems decide today, and you learn it when numbers get banned.
  • Security surface. Your servers hold credentials equivalent to a logged-in WhatsApp account for every customer. A breach of your database is a breach of every customer's chats. Treat session storage like a password vault: encryption at rest, access logging, per-tenant isolation and a tested way to revoke sessions.

Business risks

Churn from bans

Every ban hits a customer's operations: they lose a number their own customers know. Even if bans are rare, the tail is expensive, because the affected customers are often the ones sending the most messages. Plan for the support cost, refunds and lost trust, and do not model a ban rate you cannot measure.

Unfavorable economics over time

Unofficial products often compete on price because they skip Meta's per-message charges and template approval. Meta's pricing page says it "charges on a per-message basis", that only delivered messages are billed, and that inbound messages from users to businesses are free. It also says every business phone number gets a free tier of 1,000 service messages per month, and its current rate cards are effective October 1, 2026, with new rates effective January 1, 2027 (page read on 2026-12-04). That pricing is predictable. If your edge is only "no Meta fees", you are selling the cost of a risk your customers do not see.

Platform dependence without a contract

Any product depends on a platform. The difference here is that an official provider operates under WhatsApp's Business Terms and has defined rules, whereas you would depend on tolerance. The WhatsApp Business Platform terms, which show "Effective September 23, 2026", also let WhatsApp suspend access, but they come with a documented relationship and, for companies established in the EU or UK, a 30-day prior-notice process in most cases. That process is not a guarantee for anyone else, but it shows what an actual agreement can offer.

The official route in numbers

If you decide to build on the official WhatsApp Business Platform, these are the documented figures that shape a SaaS design (Meta's Cloud API overview and messaging limits pages, read on 2026-12-04).

Item Documented value
Prerequisite A business portfolio and a business phone number
Throughput Up to 80 messages per second per business phone number by default
Pair rate limit About one message every 6 seconds to the same user; exceeding it returns error code 131056
API request limit 200 requests per hour per Messaging account by default; 5,000 per hour for active accounts with a registered phone number
Messaging limit, new portfolio 250 unique users in a moving 24-hour period (TIER_250)
Next tiers 2,000, then 10,000, 100,000, then unlimited, via business verification or automatic scaling

Some of these are tighter than a QR-login product feels. A new portfolio can start a conversation with only 250 unique users per 24 hours, and scaling requires high-quality messages. That friction is the price of an approved route, and it is also the reason an approved route is stable. For prices in India, see WhatsApp Cloud API pricing in India.

Questions to answer before you build

  1. Who is the customer's contract with? If your terms leave the customer alone with WhatsApp's rules, say so plainly and in writing.
  2. What happens on a ban? Decide the support process, the refund policy and the data export before launch.
  3. Where do sessions live? Name the storage, the encryption, the access controls and the revocation procedure.
  4. How is opt-in recorded? If your product cannot show consent per recipient, you are shipping a spam tool whether you intend it or not.
  5. What is your exit? Write down how a customer would move to the Cloud API. The article Migrate from an unofficial WhatsApp API to the Cloud API covers the move.
  6. What do you promise in marketing? Never claim official status, and do not hide the dependency from buyers.

A safer way to structure the product

  • Build your application layer against an interface you own (send message, receive message, record consent, report status), so the WhatsApp transport can be swapped.
  • Implement the official Cloud API transport first if the customer is a business that depends on WhatsApp for revenue.
  • If you must offer a lightweight unofficial option, label it as unofficial in the product, in the contract and in onboarding, keep it off business-critical numbers, and do not build bulk-send features on it.
  • Compare options on the same criteria in unofficial WhatsApp API vs the official Cloud API.

Checklist

  • [ ] I have read WhatsApp's Terms of Service and Business Messaging Policy, not only a summary of them.
  • [ ] My contract does not call an unofficial product official or approved.
  • [ ] I have a documented plan for bans, protocol changes and session loss.
  • [ ] Sessions are encrypted, isolated per tenant and revocable.
  • [ ] Opt-in is recorded per recipient and my product does not encourage bulk or unsolicited sending.
  • [ ] I have taken legal advice on data-protection duties in every country where my customers operate.
  • [ ] I have an official Cloud API path ready for customers who need reliability.

What we checked

  • Opened the Baileys repository README on 2026-12-04: confirmed the "not affiliated, associated, authorized, endorsed by, or in any way officially connected with WhatsApp" disclaimer, the "We discourage any stalkerware, bulk or automated messaging usage" line, the MIT License and the version 7.0.0 breaking-change notice. The README does not mention account bans.
  • Opened the WhatsApp Terms of Service on 2026-12-04 and quoted the reverse-engineering, unauthorized-access, automated-account, bulk-messaging and termination clauses above. The page shows an Effective Date of January 4, 2021.
  • Opened the WhatsApp Business Messaging Policy (whatsappbusiness.com/policy) on 2026-12-04: opt-in wording, enforcement language and "Last updated: September 23, 2026".
  • Opened the WhatsApp Business Platform terms on 2026-12-04: "Effective September 23, 2026", the right to suspend access and the 30-day notice wording for EU and UK companies. The page has no dedicated automated-access clause, so we do not claim one.
  • Cross-checked Meta's Cloud API overview and messaging limits pages on 2026-12-04: 80 messages per second, the pair rate limit and error code 131056, the 200 and 5,000 requests-per-hour figures and the 250, 2,000, 10,000, 100,000 and unlimited tiers. Read the pricing page the same day for the per-message model, the 1,000 free service messages per month and the October 1, 2026 and January 1, 2027 rate-card dates.
  • Not checked: the text of India's DPDP Act (the official PDFs returned HTTP 403 in this run), WhatsApp's help-center pages on account bans (the pages we tried returned "Page not found"), and any hands-on test of Baileys or a hosted product. We did not run or test any unofficial tool.

Last tested: 2026-12-04

References


This guide was researched and drafted with AI assistance and checked against the vendor documentation listed in its References. Read the maintained version and related guides on EpiFive.

Top comments (0)