See events/WhatsAppEventListener.php.
require 'events/WhatsAppEventListenerBase.php';
class MyEventListener extends WhatsAppEventListenerBase {
function onGetMessage(
$phone, // The user phone number including the country code.
$from, // The sender JID.
$msgid, // The message id.
$type, // The message type.
$time, // The unix time when send message notification.
$name, // The sender name.
$message // The message.
) {
print( "onGetMessage(" . $phone . ", " . $from . ", " . $msgid . ", " . $type . ", " . $time . ", " . $name . ", " . $message . ")\n" );
}
}
require 'MyEventListener.php';
$w = new WhatsProt($userPhone, $userIdentity, $userName, $debug);
w->eventManager()->addEventListener(new MyEventListener());
$w->connect();
$w->loginWithPassword($password);
[...]