コード例 #1
0
ファイル: WhatsAppApi.php プロジェクト: djade007/WhatsApp
 /**
  * Sends a broadcast Message to a group of contacts.
  *
  * Currenly only sends a normal message to
  * a group of contacts.
  *
  * @param $toNumbers
  * @param $message
  * @param $type
  * @return array|null|string
  */
 public function sendBroadcast($toNumbers, $message, $type)
 {
     $this->connectToWhatsApp();
     $messagesId = array();
     if ($type === self::MESSAGE_TYPE_TEXT) {
         $messagesId = $this->wa->sendBroadcastMessage($toNumbers, $message);
     }
     if ($type === self::MESSAGE_TYPE_IMAGE) {
         $messagesId = $this->wa->sendBroadcastImage($toNumbers, $message);
     }
     if ($type === self::MESSAGE_TYPE_AUDIO) {
         $messagesId = $this->wa->sendBroadcastAudio($toNumbers, $message);
     }
     if ($type === self::MESSAGE_TYPE_VIDEO) {
         $messagesId = $this->wa->sendBroadcastVideo($toNumbers, $message);
     }
     if ($type === self::MESSAGE_TYPE_LOCATION) {
         $messagesId = $this->wa->sendBroadcastLocation($toNumbers, $message['userlong'], $message['userlat'], $message['locationname'], null);
     }
     return $messagesId;
 }