Laravel Rust came out on Monday, and by Tuesday we had a Laravel Rust WhatsApp package: hypersender-laravel-rust. We ported our Laravel package for Hypersender, our WhatsApp and SMS API, so it now sits next to our Laravel, Node.js, Python and Go SDKs.

It sends WhatsApp messages from a number you already own and turns incoming webhooks into Laravel events. It also covers SMS from an Android phone and OTP codes. Here's the whole setup.

Install the Laravel Rust package

cargo add hypersender-laravel-rust 

Register the service provider in src/app.rs:

Application::configure() .with_providers(|providers| { providers.add(hypersender_laravel_rust::HypersenderServiceProvider); }) 

Then add two values to .env. They're the same names our PHP package uses, so moving an app over is mostly copy and paste:

HYPERSENDER_WHATSAPP_API_KEY=your-api-key HYPERSENDER_WHATSAPP_INSTANCE_ID=your-instance-id 

The instance is your WhatsApp number. You link it in the Hypersender dashboard by scanning a QR code, the same way WhatsApp Web links. There's no Meta business verification and no templates to get approved.

Send a WhatsApp message from Laravel Rust

use hypersender_laravel_rust::Whatsapp; use laravel::container::Inject; pub async fn send(whatsapp: Inject<Whatsapp>) -> laravel::Result<String> { whatsapp.send_text("201234567890@c.us", "Your order #1042 has shipped").await?; Ok("Sent".into()) } 

The chat ID is the number with its country code, followed by @c.us. The same service has send_image_url, send_file, send_voice_url, send_location, send_poll, reply_text, react_to_message and start_typing.

Receive WhatsApp messages as Laravel events

The provider registers /api/whatsapp/webhook and /api/sms/webhook. Point your Hypersender webhook at the first one, and every incoming webhook becomes a Laravel event, dispatched in the background:

#[listener] pub async fn on_message(event: Event<hypersender_laravel_rust::events::MessageAny>) { tracing::info!(payload = %event.payload, "WhatsApp message"); } 

There's an event per webhook: MessageAny, MessageAck for delivery and read receipts, MessageRevoked for deleted messages, MessageReaction, and the SMS ones.

OTP codes over WhatsApp or SMS

otp.request_code("201234567890@c.us", 6, "YourApp", 300).await?; // later, with what the user typed otp.validate_code("201234567890@c.us", "482913").await?; 

generate_link creates a WhatsApp sign-in link instead: the user taps it and sends one message, with no code to type.

Testing

It uses Laravel Rust's HTTP client, so client::fake() works in your tests:

let http = client::fake().with("app.hypersender.com/*", json!({ "id": "msg-1" })); let whatsapp = laravel::resolve::<Whatsapp>().await?; whatsapp.send_text("201234567890@c.us", "Hello from Laravel Rust").await?; 

Before you ship it

Hypersender links your number as a device, so it isn't Meta's official WhatsApp Business Platform, and WhatsApp's normal rules apply. Message people who expect to hear from you.

Plans start at $9.99 a month per number with unlimited messages, and there's a 5-day free trial.

If you're porting your own Laravel package to Rust and want to compare notes, the repo is MIT and issues are open.