whatsapp-ruby
Ruby client for WhatsApp via a local Node.js bridge powered by Baileys.
Send and receive WhatsApp messages from Ruby. Includes Rails integration with multi-session support.
Get started API Reference View on GitHub
This project uses WhatsApp Web’s unofficial API via Baileys. It is not affiliated with or endorsed by WhatsApp/Meta. Your account may be banned. Do not use for spam.
Features
- Send & receive — text, image, video, audio, document, sticker, location, contact
- Rich messages — reactions, quoted replies, polls
- Presence & receipts — typing indicators, read receipts, online status
- Contacts — lookup, profile pictures, status, business profiles
- Groups — create, update, manage participants
- Anti-ban safety — presets, progressive warmup, typing simulation, new chat limits
- Rails integration — model macro, ActiveJob, view helpers, generators
- Multi-session — each record can be its own WhatsApp account
- Rate limiting — dual-layer (Ruby + Node) with gaussian jitter
- Health check — periodic heartbeat with events
- Webhook — message handler for incoming messages
Quick example
require 'whatsapp'
client = Whatsapp.client
client.on_qr { |qr| puts qr }
client.on_message { |msg| puts "#{msg.from}: #{msg.text}" }
client.connect
client.send_message(to: "+33612345678", text: "Hello from Ruby!")
Rails example
class User < ApplicationRecord
has_whatsapp :phone
end
user.whatsapp.send_message("Your code is 1234")
user.whatsapp.send_image("receipt.jpg", caption: "Your invoice")
Multi-session example
class Hotel < ApplicationRecord
has_whatsapp :phone, account: true
end
hotel.whatsapp.connect
hotel.whatsapp.send_message(to: "+33612345678", text: "Bienvenue!")