Skip to content

whatsapp-rubyRuby client for WhatsApp

Send and receive WhatsApp messages from Ruby via a local Node.js bridge powered by Baileys. Includes Rails integration with multi-session support.

whatsrb logo

WARNING

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.

Quick example ​

ruby
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 ​

ruby
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 ​

ruby
class Hotel < ApplicationRecord
  has_whatsapp :phone, account: true
end

hotel.whatsapp.connect
hotel.whatsapp.send_message(to: "+33612345678", text: "Bienvenue!")

MIT License