onNewMessage ( messageArray )

You can perform some actions upon the event of arrival of new chat message.

The messageArray array is being passed to a handler as an argument, whose each element is an object message containing the following properties:

PropertyTypeDescription
a integer Message author code. Possible values:
260 Operator message
270, 271 Visitor message
450, 451 Automatic operator message
m string Message text.
n String Message author name
s binary true -- absolutely new message. false -- repeat rendering of old message
t string Message registration time in "hh:mm" by Moscow standard time.

Most often this event is used to set up additional notifications for the visitor, informing of the arrival of a new message.

Examples

  1. Using jQuery 
    $(document).on("netroxnewmessage", function(event, message) {
        // Your actions
    });       
  2. Using the nsc_API object
    nsc_API = { /* ... */ };
    
    nsc_API.onNewMessage = function(message) {
        // Your actions
    };        

All rights reserved. Copyright © 2017 Netrox SC
Host CMS