chatapi / whatsapp
Library for WhatsApp api
This package's canonical repository appears to be gone and the package has been frozen as a result.
Installs: 3 630
Dependents: 0
Suggesters: 0
Security: 0
Stars: 42
Watchers: 8
Forks: 20
Open Issues: 3
Requires
- guzzlehttp/guzzle: ^6.3
Requires (Dev)
- phpunit/phpunit: ^5.7
This package is not auto-updated.
Last update: 2023-02-04 20:18:49 UTC
README
Lightweight PHP library for interact with WhatsApp api provided by chat-api.com.
Installing
The recommended way to install is through Composer.
# Install Composer curl -sS https://getcomposer.org/installer | php
Next, run the Composer command to install the latest stable version:
php composer.phar require chatapi/whatsApp
After installing, you need to require Composer's autoloader:
require 'vendor/autoload.php';
You can then later update library using composer:
composer.phar update
Usage
Create client instance
$client = Client::getInstance([ 'url' => 'your_url', 'token' => 'your_token' ]);
Send message
$client->sendMessage([ 'phone' => '78005553535', 'body' => 'Hi there!' ]);
Send file
$data = $client->sendFile([ 'phone' => '78005553535', 'body' => 'some_file', // file in base64 'filename' => 'sample.jpg' ]);
Create group
$client->createGroup( 'New chat', ['78005553535'], 'First message' );
Get list of all incoming messages
$data = $client->getMessages();
Get not sent messages queue
$data = $client->getMessagesQueue();
Clear not sent messages queue
$data = $client->clearMessagesQueue();
Get account status
$data = $client->getStatus();
Get QR-code
$data = $client->getQrCode();
Set webhook
$data = $client->setWebHook('http://<some_url>');
Get webhook
$data = $client->getWebHook();
Reboot application
$data = $client->reboot();
Logout
$data = $client->logout();