the-box/box-whatsapp

The WhatsApp Box is part of the TheBox family — a lightweight PHP package that allows you to send WhatsApp messages easily

Maintainers

Package info

github.com/Onestepcom00/WhatsappBox

pkg:composer/the-box/box-whatsapp

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 2

Open Issues: 0

dev-main 2025-11-12 02:42 UTC

This package is auto-updated.

Last update: 2026-03-12 03:35:17 UTC


README

PHP Version Composer License Status Made with ❤️

The WhatsApp Box is part of the TheBox family — a lightweight PHP package that allows you to send WhatsApp messages easily.
It can be extremely useful in real-world scenarios such as user registration forms, where you can send a verification code or confirmation message directly via WhatsApp once an account is created.

🚀 Requirements

Before using this package, make sure you have the following:

  • PHP 8.0+
  • Composer installed
  • cURL extension enabled
  • A Unipile account, with an API key and DNS endpointhttps://www.unipile.com/

⚙️ Installation

Install the package via Composer:

composer require the-box/whatsapp-box

💡 Usage Example

<?php

use BoxWhatsapp\BoxWhatsapp;

$whatsapp = new BoxWhatsapp();

// Configure your Unipile API key and DNS (base URL of your Unipile instance)
$whatsapp->setKey('ENTER_YOUR_API_KEY');
$whatsapp->setDns('https://your-unipile-host/api');

// Optional: Set a default recipient number
$whatsapp->setDest('+2430000000000');

// 1️⃣ Simple message (uses the default number)
$result = $whatsapp->sendMessage('Hello there');

// 2️⃣ Direct message with a specific number
$result2 = $whatsapp->sendMessage('Hi again!', '+2430000000000');

// 3️⃣ Send to multiple recipients
$result3 = $whatsapp->sendMessageGroup('Hello everyone!', ['+2430000000000', '+2431111111111']);

// 4️⃣ (Optional) Send to a WhatsApp group using JID
// Example JID: 123456789-123456@g.us
// $result4 = $whatsapp->sendMessageToGroup('123456789-123456@g.us', 'Hello Group!');

🧠 Notes

  • The package automatically retrieves your account_id via the /accounts endpoint.
    If needed, you can manually set it with $whatsapp->setAccountId('YOUR_ACCOUNT_ID');.
  • Sending requests uses multipart/form-data on the /chats endpoint with attendees_ids and text fields.
  • Numbers are automatically converted to the WhatsApp JID format:
    +243...243...@s.whatsapp.net.

🧩 Part of TheBox

This package is designed to integrate seamlessly with the TheBox ecosystem.
For more modules and utilities, check out other TheBox projects.

You can Donate Me


Support via Donation

✨ Author

Developed with ❤️ by Exauce Stan Malka - Exauce Malumba
GitHubWebsite