The RealTimeChat web hook (web call) is a paid function of the Webinato platform that enables a third party system, such as an automated bot for example, to receive chat messages posted into a Webinato room automatically with a regular interval of (by default) 180 seconds.
You may set the web hook URL and the time interval (minimum: 60) by contacting Webinato Sales.
This is a test application demonstrating the reception of real time chat from Webinato servers when a URL is set for the room, to which to send the real-time chat (every 60 seconds)
PHP Example
$inquiry = $_POST["inquiry"];
if ($inquiry == 'realTimeChat')
{
// 'roomID' in case the system is receiving messages for different rooms. roomID is a unique ID for a room within the Webinato system
$roomID = $_POST["roomID"];
// 'sender' is sent with the value: Webinato
$sender = $_POST["sender"];
// 'batchNo' indictes the index of each call. After the room starts, batch #1 is sent, followed by 2, 3... This lets you check the order of web calls
// to ensure reception occured in the right order as a webcall may arrive late
$batchNo = $_POST["batchNo"];
// The core of messages in JSON format
$msgsJSON = $_POST["msgsJSON"];
$msgsArr = json_decode($msgsJSON, true);
$nbMessages = count($msgsArr);
// msgsArr is now an array of associated array
// example:
$message = ("------------------ New RealTime Chat ( $nbMessages messages) ------------------\n");
$message.= ("Batch No: $batchNo \n");
$message.= ("roomID: $roomID \n\n");
for ($i = 0; $i < $nbMessages; $i++)
{
$msg = $msgsArr[$i];
$message.= ("----------------\n");
$message.= ("Author Name: " . $msg['authorName'] . "\n");
$message.= ("Author Role: " . $msg['authorRole'] . "\n"); // role: 0 or 1 means Attendee -- 2 means Presenter -- 3 means Organizer
$message.= ("Timestamp: " . $msg['ts'] . "\n"); // GMT time in Unix Timestamp meaning the number of seconds since Jan 1, 1970
$message.= ("Message ID: " . $msg['msgID'] . "\n"); // Webinato message ID for each message. This is incremental
$message.= ("Text : " . $msg['text'] . "\n\n");
}
$message.= ("-------------------------------------------\n\n\n");
echo($message); // You can use your own logic here.
}
else
{
echo("Bad Inquiry with inquiry = " . $inquiry);
}