serv5group/whatscloudapi
最新稳定版本:v1.0.0.0
Composer 安装命令:
composer require serv5group/whatscloudapi
包简介
whatsapp api cloud
README 文档
README
A library used with the Laravel framework to enable you to send WhatsApp messages as well as deal with bulk messages and get WhatsApp qrcode and login using OTP and other things.
Installation
Install WhatsCloudApi with composer
composer require serv5group/whatscloudapi
Support
- you can dependent on app.needbots.com for get token and instance .
- You must make sure that the phone number starts with 20. example 20101234576
Laravel env
WHATSAPP_DOMAIN="https://app.needbots.com/api"
Usage/Examples
use serv5group\whatscloudapi\WebCloud; class Examples { /* * Create WhatsCloudApi new instance * @return WebCloud */ public function connect() { $connect = WebCloud::accessToken("token")->setInstance("instanceId"); return $connect; } /* * send whatsapp message * @return Void */ public function sendMessage() { $response = $this->connect()->to("phone")->message("template")->send(); if( $response->status == 'success' ){ // The message was sent successfuly }else{ \Log::error($response->message); }//@endif } /* * send whatsapp bulk message * @return Void */ public function sendBulkMessage() { foreach ($contacts as $contact) { $response = $this->connect()->to("contact")->message("template")->send(); if( $response->status == 'success' ){ // The message was sent successfuly }else{ \Log::error($response->message); }//@endif } //@endforeach }//@endfunction /* * send whatsapp message and media * @return Void */ public function sendMessage() { $response = $this->connect()->to("phone") ->message("template")->media("path")->send(); if( $response->status == 'success' ){ // The message was sent successfuly }else{ \Log::error($response->message); }//@endif } /* * send whatsapp bulk message and attachments * @return Void */ public function sendBulkMessage() { foreach ($contacts as $contact) { $response = $this->connect()->to("contact")->message("template")->media("path")->send(); if( $response->status == 'success' ){ // The message was sent successfuly }else{ \Log::error($response->message); }//@endif } //@endforeach }//@endfunction }
🛠 Skills
PHP , LARAVEL
License
统计信息
- 总下载量: 161
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-11-12