octinix / chatzify-whatsapp
A Laravel package for Chatzify WhatsApp API integration
dev-master
2025-05-20 08:05 UTC
Requires
- php: ^7.4|^8.0
- guzzlehttp/guzzle: ^7.0
- illuminate/support: ^8.0|^9.0|^10.0
Requires (Dev)
- phpunit/phpunit: ^9.0
This package is auto-updated.
Last update: 2025-05-20 08:05:35 UTC
README
A Laravel package for easy integration with the Chatzify WhatsApp API.
Installation
You can install the package via composer:
composer require octinix/chatzify-whatsapp
Configuration
Publish the configuration file:
php artisan vendor:publish --provider="Octinix\ChatzifyWhatsapp\ChatzifyWhatsappServiceProvider" --tag="config"
Add the following environment variables to your .env file:
CHATZIFY_TOKEN=your_token_here
CHATZIFY_INSTANCE_ID=your_instance_id_here
CHATZIFY_BASE_URL=https://chatzify.com/api/v1
Usage
Send Text Message
use Octinix\ChatzifyWhatsapp\Facades\ChatzifyWhatsapp; // Send a text message ChatzifyWhatsapp::sendText('919999999999@s.whatsapp.net', 'Hello, World!');
Send Image Message
// Send an image with caption ChatzifyWhatsapp::sendImage( '919999999999@s.whatsapp.net', 'https://example.com/image.jpg', 'Check out this image!' );
Send Video Message
// Send a video with caption ChatzifyWhatsapp::sendVideo( '919999999999@s.whatsapp.net', 'https://example.com/video.mp4', 'Watch this video!' );
Send Audio Message
// Send an audio file ChatzifyWhatsapp::sendAudio( '919999999999@s.whatsapp.net', 'https://example.com/audio.mp3' );
Send Document Message
// Send a document with caption ChatzifyWhatsapp::sendDocument( '919999999999@s.whatsapp.net', 'https://example.com/document.pdf', 'Important document' );
Error Handling
All methods throw a ChatzifyException
if something goes wrong:
use Octinix\ChatzifyWhatsapp\Facades\ChatzifyWhatsapp; use Octinix\ChatzifyWhatsapp\Exceptions\ChatzifyException; try { ChatzifyWhatsapp::sendText('919999999999@s.whatsapp.net', 'Hello, World!'); } catch (ChatzifyException $e) { // Handle the exception echo $e->getMessage(); }