src/whatsprot.class.php
public function sendGroupsChatCreate($subject, $participants)
    {
        if (!is_array($participants)) {
            $participants = [$participants];
        }

        $participantNode = [];
        foreach ($participants as $participant) {
            $participantNode[] = new ProtocolNode('participant', [
                'jid' => $this->getJID($participant),
            ], null, null);
        }

        $id = $this->nodeId['groupcreate'] = $this->createIqId();

        $createNode = new ProtocolNode('create',
            [
                'subject' => $subject,
            ], $participantNode, null);

        $iqNode = new ProtocolNode('iq',
            [
                'xmlns' => 'w:g2',
                'id'    => $id,
                'type'  => 'set',
                'to'    => Constants::WHATSAPP_GROUP_SERVER,
            ], [$createNode], null);

        $this->sendNode($iqNode);
        $this->waitForServer($id);
        $groupId = $this->groupId;

        $this->eventManager()->fire('onGroupCreate',
            [
                $this->phoneNumber,
                $groupId,
            ]);

        return $groupId;
    }
public function sendGroupsChatCreate($subject, $participants)
    {
        if (!is_array($participants)) {
            $participants = [$participants];
        }

        $participantNode = [];
        foreach ($participants as $participant) {
            $participantNode[] = new ProtocolNode('participant', [
                'jid' => $this->getJID($participant),
            ], null, null);
        }

        $id = $this->nodeId['groupcreate'] = $this->createIqId();

        $createNode = new ProtocolNode('create',
            [
                'subject' => $subject,
            ], $participantNode, null);

        $iqNode = new ProtocolNode('iq',
            [
                'xmlns' => 'w:g2',
                'id'    => $id,
                'type'  => 'set',
                'to'    => Constants::WHATSAPP_GROUP_SERVER,
            ], [$createNode], null);

        $this->sendNode($iqNode);
        $this->waitForServer($id);
        $groupId = $this->groupId;

        $this->eventManager()->fire('onGroupCreate',
            [
                $this->phoneNumber,
                $groupId,
            ]);

        return $groupId;
    }
public function sendGroupsChatCreate ( $ subject , $ participants ) { if ( ! is_array ( $ participants ) ) { $ participants = [ $ participants ] ; } $ participantNode = [ ] ; foreach ( $ participants as $ participant ) { $ participantNode [ ] = new ProtocolNode ( 'participant' , [ 'jid' => $ this -> getJID ( $ participant ) , ] , null , null ) ; } $ id = $ this -> nodeId [ 'groupcreate' ] = $ this -> createIqId ( ) ; $ createNode = new ProtocolNode ( 'create' , [ 'subject' => $ subject , ] , $ participantNode , null ) ; $ iqNode = new ProtocolNode ( 'iq' , [ 'xmlns' => 'w:g2' , 'id' => $ id , 'type' => 'set' , 'to' => Constants :: WHATSAPP_GROUP_SERVER , ] , [ $ createNode ] , null ) ; $ this -> sendNode ( $ iqNode ) ; $ this -> waitForServer ( $ id ) ; $ groupId = $ this -> groupId ; $ this -> eventManager ( ) -> fire ( 'onGroupCreate' , [ $ this -> phoneNumber , $ groupId , ] ) ; return $ groupId ; }
Create a group chat.

@param string $subject
The group Subject
@param array  $participants
An array with the participants numbers.

@return string
The group ID.
Create a group chat .