iFlyChat JavaScript SDK fires an event named 'message-receive' whenever a new message is received. You may bind to this event in following manner:

iflychat.on('message-receive', function(message) {
  
  /* your code here - message object contains received message information */

});

 

Here message is a JS object with following properties:

  • fromId
  • fromName
  • toId
  • toName
  • message
  • messageId