Class: Omnibrowse

Overview

OmniBrowse is a SaleMove product that allows operators to conduct CoBrowsing engagements. OmniBrowse engagements can be started by operators from anywhere that has the OmniBrowse app embedded, such as CRM systems. Use the functions provided in this class to handle incoming and reestablished engagements from operators using OmniBrowse.

Instance Method Summary

Instance Method Details

# (void) setIncomingEngagementRequestHandler(handler)

Overwrites the handler for incoming engagement requests from operators using OmniBrowse. During these engagements {Engagement.upgrade} is not supported and initial media selection is restricted to 'text' option

Examples:

Handling an incoming OmniBrowse engagement request

sm.getApi({version: 'v1'}).then(function(salemove) {
  salemove.omnibrowse.setIncomingEngagementRequestHandler(function(request) {
    request.engagementPromise.then(function(engagement) {
      ...
    }).catch(function(error) {
      if (error.cause === salemove.ERRORS.TIMEOUT) {
        ...
      } else {
        ...
      }
    });
    request.accept();
    request.selectMedia('text');
  });
});

Parameters:

  • handler ( function ) The handler to use for incoming OmniBrowse engagement requests. When an Operator using OmniBrowse sends a request this handler will be called with a single argument. The argument is an IncomingEngagementRequest. See the documentation for IncomingEngagementRequest for instructions on using it.

# (void) setEngagementReestablishHandler(handler)

Sets the handler for reestablishing engagements started from OmniBrowse. For usage example see {Salemove.setEngagementReestablishHandler}.

Parameters:

  • handler ( function ) The handler to use when reestablishing an OmniBrowse engagement. When engagement has been reestablished, this handler will be called with a single argument. The argument is an Engagement.

# (Promise) getVisitorCode()

Gets the VisitorCode for current Visitor.

A Visitor code can be displayed to the Visitor. The Visitor can then inform OmniBrowse Operators of their code. OmniBrowse Operators use the Visitor's code to start an OmniBrowse Engagement with the Visitor.

Each Visitor code is generated on demand and is unique for every Visitor on a particular site. Upon the first time this function is called for a Visitor the code is generated and returned. For each successive call thereafter the same code will be returned as long as the code has not expired. The expiration time for Visitor codes is 3 hours. Once the expiration time has arrived this function will return a new Visitor code.

The expiration time is important to take note of if you plan on retrieving the code only once during the Visitor's session. A new code should be requested once the initial one has expired. When Visitor provides an expired code to Operator the Operator will not be able to connect with the Visitor.

An example use case is Operator and Visitor being in a phone call. The operator instructs the Visitor to press some combination of keys which then causes the Visitor code to be displayed to the Visitor. The Visitor then tells the Operator what their code is. When the Operator enters the code on their side they will be able to conduct an OmniBrowse engagement with the Visitor.

The Visitor code is numeric and 5 digits long. It is returned as a String.

Examples:

Showing the Visitor's Code when Visitor presses 'B'.

document.addEventListener('keypress', function(event) {
  if (event.code === 'KeyB') {
    sm.getApi({version: 'v1'}).then(function(salemove) {
      salemove.omnibrowse.getVisitorCode().then(showVisitorCode);
    });
  }
});

function showVisitorCode(visitorCodeResponse) {
  var visitorCodeContainer = document.createElement('div');
  visitorCodeContainer.textContent = visitorCodeResponse.code;
  document.body.appendChild(visitorCodeContainer);
  setTimeout(function() {
    document.body.removeChild(visitorCodeContainer);
  }, visitorCodeResponse.validDuration);
}

Returns:

  • ( Promise ) — Fulfilled with VisitorCode or rejected with Error if the process fails for any reason. The Error may have one of the following causes: INTERNAL_ERROR, NETWORK_TIMEOUT.

    Quickly fuzzy find classes, mixins, methods, file:

    Control the navigation frame:

    You can focus and blur the search input: