[TR] Baileys ile WhatsApp Otomasyonu: Gerçek Bir Ürün Geliştirme Hikayesi
WhatsApp üzerinden işletmelere otomasyon çözümü sunan bir ürün (Argonova) geliştirirken karşılaştığımız en temel karar şuydu: resmi WhatsApp Business API mi, yoksa Baileys gibi açık kaynak bir kütüphane mi?
Bu yazıda, şu anki tercihimiz olan Baileys'i neden seçtiğimizi, nasıl çalıştığını ve neden ilerleyen dönemde resmi API'ye de geçiş yapacağımızı paylaşıyorum.
Baileys Nedir?
Baileys, WhatsApp Web'in kullandığı protokolü tersine mühendislikle çözüp, Node.js üzerinden WhatsApp Web oturumu açmanızı sağlayan açık kaynak bir kütüphane. Resmi bir Meta ürünü değil — WhatsApp Web'in kendisini bir bot gibi kontrol etmenizi sağlıyor.
Temel çalışma mantığı:
WebSocket bağlantısı ile WhatsApp Web sunucularına bağlanıyor
QR kod (ya da pairing code) ile oturum açılıyor — normal WhatsApp Web'de telefonunuzla QR taradığınız aynı akış
Oturum açıldıktan sonra mesaj gönderme/alma, medya işleme, grup yönetimi gibi işlemler kod üzerinden yapılabiliyor
Neden Baileys ile Başladık?
Hızlı prototipleme: Resmi API'nin onay süreci, iş doğrulaması ve entegrasyon süreci haftalar sürebiliyor. Baileys ile dakikalar içinde çalışan bir prototip çıkarabildik.
Maliyet: Resmi API mesaj başına ücretlendiriyor, erken aşamada bu maliyeti öngörmek zordu.
Esneklik: Resmi API'nin izin vermediği bazı davranışları (örneğin belirli mesaj formatları, gruplarla etkileşim) Baileys ile test edebiliyoruz.
Dikkat Edilmesi Gereken Riskler
Dürüst olmak gerekirse, Baileys'in kendi zorlukları var ve bunları bilmeden bu yola girmemenizi öneririm:
Resmi olmayan bir yöntem — WhatsApp'ın kullanım şartlarına aykırı sayılabiliyor, hesap banlanma riski var
Kararlılık: WhatsApp Web protokolü değiştiğinde kütüphane güncellemesi gerekiyor, bu da bakım yükü demek
Ölçeklenme sınırları: Çok sayıda numarayı aynı anda, yüksek hacimli mesajlaşmayla yönetmek resmi API'ye göre daha kırılgan
Bu riskleri azaltmak için mesaj gönderim hızını insan davranışına yakın tutuyoruz (rastgele bekleme süreleri, günlük limit) — agresif toplu gönderim yerine daha organik bir gönderim paterni kullanıyoruz.
Sıradaki Adım: Resmi WhatsApp Business API
Şu anda ürünümüzün ikinci versiyonunu geliştiriyoruz — bu versiyon resmi WhatsApp Business API üzerine kurulu olacak. Amacımız iki farklı ürün sunmak:
Baileys tabanlı versiyon — hızlı başlangıç, düşük maliyet isteyen küçük işletmeler için
Resmi API tabanlı versiyon — kurumsal güvenilirlik, garantili kararlılık ve WhatsApp'ın resmi onayı isteyen işletmeler için
Bu geçişin teknik detaylarını (webhook mimarisi, mesaj şablonu onay süreci, maliyet karşılaştırması) ilerleyen yazılarda paylaşacağım.
Bu yazı, Argonova ürününü geliştirirken edindiğimiz gerçek deneyimlere dayanıyor.
[EN] Building WhatsApp Automation with Baileys: A Real Product Journey
When building a WhatsApp automation product for businesses (Argonova), the core technical decision we faced was: official WhatsApp Business API, or an open-source library like Baileys?
Here's why we currently use Baileys, how it works under the hood, and why we're building an official API version next.
What Is Baileys?
Baileys is an open-source library that reverse-engineers the WhatsApp Web protocol, letting you drive a WhatsApp Web session from Node.js. It's not an official Meta product — it essentially lets you control WhatsApp Web programmatically, the same way your browser would.
How it works, at a high level:
Connects to WhatsApp Web's servers over a WebSocket
Authenticates via QR code (or pairing code) — the same flow as scanning a QR code with your phone in a browser
Once authenticated, you can send/receive messages, handle media, and manage groups programmatically
Why We Started with Baileys
Fast prototyping: The official API's approval, business verification, and integration process can take weeks. With Baileys, we had a working prototype in minutes.
Cost predictability: The official API charges per message, which was hard to forecast at an early stage.
Flexibility: Some behaviors the official API restricts (certain message formats, group interactions) were easier to test and iterate on with Baileys.
The Trade-offs You Should Know
To be transparent: Baileys comes with real risks, and I'd encourage anyone considering it to weigh these first.
Unofficial approach — it can be considered a violation of WhatsApp's terms of service, carrying a risk of number bans
Stability — when WhatsApp Web's protocol changes, the library needs updates, which means ongoing maintenance overhead
Scaling limits — managing many numbers with high message volume is more fragile compared to the official API
To mitigate this, we keep our sending patterns closer to human behavior — randomized delays, daily send limits — rather than aggressive bulk sending.
What's Next: Official WhatsApp Business API
We're currently building a second version of our product on top of the official WhatsApp Business API. The plan is to offer two tracks:
Baileys-based version — for smaller businesses that want a fast, low-cost start
Official API-based version — for businesses that need enterprise-grade reliability and WhatsApp's official approval
I'll follow up with more technical detail on that migration — webhook architecture, message template approval, and cost comparisons — in a future post.
This post is based on real engineering decisions made while building Argonova.
Top comments (0)