onMessageReceived event

If a call object is added to the program, this event can occur on it. It occurs when a message is received to your phone number. To get your actual phone number, please visit this page, and check the Code Example 2.

Callback method input parameters

message: Type: string. The received message.

Event usage example

In this example we make the myFirstCall object in the call class, we set the called number and start the call, then we register to the onMessageReceived notification. When the connected incoming receives a message the MSGreceived function starts which writes out the message onto the console. From now on every time when a message is received, it will be written onto the console (Code example 1).

var calledNumber = "1000";
//constructor of the call
var myFirstCall = OzWebClient.createCall(calledNumber); 

myFirstCall.start();	//starts the call

//registers to the onMessageReceived event
myFirstCall.onMessageReceived(MSGreceived); 

function MSGreceived(message){
   console.log("msg: " + message)
}
	
Code example 1 - onMessageReceived event example

More information