Skip to content

medo172192/webcloud

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Webcloud

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 Webcloud with composer

  composer require medo172192/webcloud

Support

Laravel env

  WHATSAPP_DOMAIN="https://app.needbots.com/"

Usage/Examples

use Medo172192\Webcloud\WebCloud;

class Examples
{

  /*
  * Create Webcloud 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

MIT

Authors

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages