ruslidev / yii2-wablas
Yii2 Extension for https://wablas.com
Installs: 4
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- php: >=7.2.0
- guzzlehttp/guzzle: ^7.3
- yiisoft/yii2: *
Requires (Dev)
- phpunit/phpunit: 8.5.*
This package is auto-updated.
Last update: 2024-10-05 13:00:27 UTC
README
Yii2 Extension for https://wablas.com/
Usage
To use this extension, simply add the following code in your application configuration:
//... 'waBlast' => [ 'class' => \ruslidev\wablas\WablasClient::className(), 'wablasEndpoint' => getenv('WABLAS_ENDPOINT'), 'apiToken' => getenv('WABLAS_API_TOKEN'), ], //...
Default config:
WABLAS_ENDPOINT=https://wablas.com/ WABLAS_API_TOKEN=123456
You can then send an whatsapp as follows:
Send Message
$message = 'Hello...'; $phone_number = '08xxxxx' $result = Yii::$app->waBlast->sendMessage($message,'08xxxxxx'); if($result instanceof StreamInterface){ $resultContent = json_decode($result->getContents()); $message = $resultContent->data->message[0]; }
Send Image
$phone_number = '08xxxxx' $result = Yii::$app->waBlast->sendImage($imageCaption, $phone_number,$imageUrl ,$secret = false, $priority = false, $type = 'random'); if($result instanceof StreamInterface){ $resultContent = json_decode($result->getContents()); }
Send Document Url
$phone_number = '08xxxxx' $result = Yii::$app->waBlast->sendDocumentUrl($docUrl, $phone_number = null , $secret = false, $priority = false, $type = 'random'); if($result instanceof StreamInterface){ $resultContent = json_decode($result->getContents()); }
Send Document File
$phone_number = '08xxxxx' $result = Yii::$app->waBlast->sendDocumentFile($file, $phone_number = null, $secret = false, $priority = false, $type = 'random'); if($result instanceof StreamInterface){ $resultContent = json_decode($result->getContents()); }