Class

Salemove

Salemove

Examples

Getting the JS SDK as an instance of Glia

  sm.getApi({version: 'v1'}).then(function(salemove) {
    // Your code
  });

Allow visitors to queue for engagements

  var queueView = document.createElement('div');
  document.body.appendChild(queueView);

  var engagementView = document.createElement('div');
  document.body.appendChild(engagementView);

  sm.getApi({version: 'v1'}).then(function(salemove) {
    function onQueueStateUpdate(queueState) {
      if (queueState.state === queueState.QUEUE_STATES.CAN_QUEUE) {
        queueView.addEventListener('click', onClickToQueue);
        queueView.innerText = 'Click to queue.';
      } else if (queueState.state === queueState.QUEUE_STATES.QUEUED) {
        showWaitingView(queueState.ticket);
        salemove.getQueueWaitDuration()
          .then(showWaitingViewWithTimer(queueState.ticket));
      } else if (queueState.state === queueState.QUEUE_STATES.CANNOT_QUEUE) {
        queueView.removeEventListener('click', onClickToQueue);
        queueView.innerText = 'Cannot queue.';
      }
    }

    function onClickToQueue() {
      salemove.queueForEngagement('text').catch(showFailedToQueueView);
    }

    salemove.addEventListener(salemove.EVENTS.QUEUE_STATE_UPDATE, onQueueStateUpdate);
    salemove.addEventListener(salemove.EVENTS.ENGAGEMENT_START, showEngagedView);
    salemove.addEventListener(salemove.EVENTS.ENGAGEMENT_END, showNotEngagedView);
  });

  function showWaitingView(queueTicket) {
    queueView.innerText = 'Hang on.';
    queueView.appendChild(cancelButton(queueTicket));
  }

  function showWaitingViewWithTimer(queueTicket) {
    return function(waitDuration) {
      queueView.innerText = 'Hang on. This usually takes ' +
        waitDuration.averageDurationInSeconds + ' seconds.';
      queueView.appendChild(cancelButton(queueTicket));
    };
  }

  function showFailedToQueueView(error) {
    queueView.innerText = 'Failed to queue!';
  }

  function showEngagedView(engagement) {
    engagementView.innerText = 'Engaged with ' + engagement.operator.name + '!';
  }

  function showNotEngagedView(engagement) {
    engagementView.innerText = 'Not engaged.';
  }

  function cancelButton(queueTicket) {
    var button = document.createElement('span');
    button.innerText = ' Click here to cancel.';
    button.addEventListener('click', function() {
      queueTicket.cancel();
    });
    return button;
  }

Different behavior depending on how many operators are available

  var operators = [];

  function onOperatorStatusChange(updatedOperator) {
    operators = operators.map(function(operator) {
      if (operator.id == updatedOperator.id) {
        return updatedOperator;
      } else {
        return operator;
      }
    });
    updateElementUI();
  }

  function onOperatorListChange(updatedOperators) {
    operators = updatedOperators;
    updateElementUI();
  }

  function updateElementUI() {
    var availableOperators = filterAvailableOperators(operators);
    if (availableOperators.length === 0) {
      alert("No operators are available.");
      // Update application to indicate that no operators are available
    } else {
      alert("At least one operator is now available.");
      // Update application to indicate that at least one operator is available
    }
  }

  function filterAvailableOperators(operators) {
    return operators.filter(function(operator) {
      return operator.state.available;
    });
  }

  sm.getApi({version: 'v1'}).then(function(salemove) {
    salemove.addEventListener(salemove.EVENTS.OPERATOR_LIST_UPDATE, onOperatorListChange);
    salemove.addEventListener(salemove.EVENTS.OPERATOR_STATUS_UPDATE, onOperatorStatusChange);
  });

Members

Config

# config

An object with Config specific properties.
Omnibrowse

# omnibrowse

An object with Omnibrowse (also known as Call Visualizer) specific functionality.
Omnicall

# omnicall

An object with Omnicall (also known as Phone Channels) specific functionality.
Overseer

# overseer

An object with Overseer (also known as Business Rules) specific functionality.
VisitorApp

# visitorApp

An object that exposes VisitorApp functionality. Can be used to trigger UI flows programmatically. Note that if no Visitor App is configured for the site, all VisitorApp methods throw a NOT_SUPPORTED Error.

Methods

# addEventListener(type, listener)

Registers an event listener on the API.

If a listener is added while the API is processing an event, it will be not triggered with the current event.

If multiple identical listeners are registered on the same event type the duplicate instances are discarded. They do not cause the listener to be called twice and do not need to be removed with the removeEventListener method.

Parameters:
Name Type Description
type string The event type for which the listener is registering. Must be one of {Salemove.EVENTS}.
listener function The listener function that will be called when the event occurs.

# changeElementAttributesForCobrowsing(element, changeElementAttributes) → {void}

Changes an element's attributes when element is mirrored to operator during CoBrowsing.

Before the element is mirrored to the operator and after every change to the element's attributes, changeElementAttributes will be called with the attributes of the element. The element that is mirrored in the operator's CoBrowsing area will have the exactly the attributes of changeElementAttributes return value. The element's attributes will not be changed in the visitor's browser.

Every element can only have one attribute change function associated with it. When this function is called multiple times with the same element, the attributes that were received from previous changeElementAttributes are discarded and the new changeElementAttributes return value is used instead. If this function is called during CoBrowsing, the changed element attributes are immediately propagated to the operator's CoBrowsing area using the new function.

If an element no longer needs to be changed for CoBrowsing, the identity function can be passed as changeElementAttributes:


salemove.changeElementAttributesForCobrowsing(element, function(attributes) {
  return attributes;
});

Parameters:
Name Type Description
element Element A DOM element which will be changed using changeElementAttributes when it gets mirrored to operator browser.
changeElementAttributes function A function that is called when the element is mirrored to operator's CoBrowsing area. This function is called with a single argument which is an ordinary JavaScript object which enumerates current attributes of the specified element. The return value of changeElementAttributes is used as the element attributes when the element is mirrored to operator's CoBrowsing area.
void
Example

Display a placeholder iframe instead of a payment iframe in the operator CoBrowsing area

  sm.getApi({version: 'v1'}).then(function(salemove) {
    salemove.changeElementAttributesForCobrowsing(paymentIframe, function(attributes) {
      attributes.src = attributes.src.replace("payment.html", "payment-placeholder.html");
      return attributes;
    );
  );

# createAuthenticationRequest(opts) → {Promise}

Initiates visitor authentication request.

Virtual assistants use the authentication request message to initiate the visitor authentication process. The authentication request messages must include the ID of the Authentication provider selected for authentication.

Parameters:
Name Type Description
opts Object opts
authenticationProviderId string The ID of the authentication provider.
webhooks Array.<Object> Optional, array of webhooks.
webhooks[].url string The URL to which the HTTP request will be sent to.
webhooks[].method string The HTTP method that will be used for the request.
webhooks[].headers Object The HTTP headers.
webhooks[].events Array.<string> An array of Events upon which a HTTP request will be made. There are two events related to the visitor authentication: `visitor.authentication.success` and `visitor.authentication.failure`
Fulfilled with an empty object or rejected with an Error if the process fails for any reason. The Error may have one of the following causes: INVALID_INPUT, TIMEOUT, INTERNAL_ERROR.
Promise
Example
sm.getApi({version: 'v1'}).then(function(salemove) {
    var params = {
      "authenticationProviderId": "3a596532-c868-4071-befa-3706ecc2c552",
      "webhooks":[
        {
          "url": "https://example.com/authentication_request/result",
          "events": ["visitor.authentication.success", "visitor.authentication.failure"],
          "method": "POST",
          "headers": {
            "Authorization": "Bearer 77aa7777-169a-432a-a87a-23fa5a5a6f7a"
          }
        }
      ]
    };
    salemove.createAuthenticationRequest(params);
  });

# getBrowserContext() → {Promise}

Gets information about browser context.

Some REST API endpoints need visitor browser context and can take this method's output directly as their input. For example: Update visitor information

Payload must be passed to REST API endpoint unmodified.

The content of the payload is internal for Glia and should not be used for any other purpose. It might change in future versions of API.

Fulfilled with an object containing browser information.
Promise
Example

Acquiring browser context

  sm.getApi({version: 'v1'}).then(function(glia) {
    glia.getBrowserContext().then(function(context) {
      forwardToBackendForVisitorInformationUpdate(glia.getVisitorId(), glia.getSiteId(), context)
    });
  });

# getQueues() → {Promise}

Gets a list of all queues.

This information can be used to subscribe to queue state updates using Salemove#subscribeToQueueStateUpdates or to enqueue by queue ID using Salemove#queueForEngagement.

The returned Promise will be rejected with cause DISABLED if queuing is disabled for the current site. Whether queuing is enabled can be checked from Config#queuingEnabled.

Fulfilled with an array of Queue instances or rejected with an Error if the process fails for any reason. The Error may have one of the following causes: DISABLED, FORBIDDEN, INTERNAL_ERROR, NETWORK_TIMEOUT
Promise

# getQueueWaitDuration() → {Promise}

Gets information about the expected wait time for queued visitors.

This information gives visitors an idea of how long they will likely have to wait after queuing for engagement before they will be engaged with an operator.

The returned Promise will be rejected with cause DISABLED if queuing is disabled for the current site. Whether queuing is enabled can be checked from Config#queuingEnabled.

Fulfilled with a QueueWaitDuration instance or rejected with an Error if the process fails for any reason. The Error may have one of the following causes: DISABLED, INTERNAL_ERROR, NETWORK_TIMEOUT
Promise

# getRequestHeaders() → {Object}

Returns a hash of the headers and values that are required for the visitor to authenticate with the API.
Object containing request headers.
Object
Example

Making an XHR request with required headers

  sm.getApi({version: 'v1'}).then(function(salemove) {
    var xhr = new XMLHttpRequest();
    xhr.open('GET', 'https://api.salemove.com/visitor');

    var requestHeaders = salemove.getRequestHeaders();
    Object.keys(requestHeaders).forEach(function(key) {
      xhr.setRequestHeader(key, requestHeaders[key]);
    });

    xhr.onload = function() {
      if (xhr.status >= 200 && xhr.status < 300) {
        // Handle success
      } else {
        // Handle negative response from server
      }
    };
    xhr.onerror = function() {
      // Handle failure
    };
    xhr.send();
  });

# getSessionContext() → {String}

Returns a string representing the visitor and the current tab.

This function should be used to obtain the visitor session when a visitor navigates within your domain(s) and Glia is unable to restore the visitor's session after navigation. This can occur when the visitor is redirected from one URL to another and has 3rd party cookies disabled.

This function should only be used to re-establish across navigations, re-establishing the context works in a limited timeframe from the moment it was acquired.

To re-establish a session, the String acquired from this function must be specified as 'session_context' query parameter in the Glia integration script.

This value is specific to the browser tab that it was acquired from. It must be used in the same tab or in a new tab given that the previous tab has closed. Having the same context in multiple tabs results in the previous tab disconnecting from Glia.

Opaque string containing visitor session context
String
Example

Acquiring session context and re-establishing a session

  sm.getApi({version: 'v1'}).then(function(salemove) {
    var sessionContext = salemove.getSessionContext();

    // The sessionContext value must be carried through your system and
    // tied to the same visitor tab.
    postFormThatNavigatesVisitor(yourFormData, sessionContext);
  });

  // When including Glia integration script for the same visitor on a new page:

  <head>
    <script async src="//api.glia.com/salemove_integration.js?session_context=SESSION_CONTEXT_FROM_PREVIOUS_PAGE />
  </head>

# getSiteId() → {String}

Returns a string representing current site ID.
String containing site ID.
String
Example

Acquiring site ID

  sm.getApi({version: 'v1'}).then(function(glia) {
    console.log('This site ID is ' + glia.getSiteId())
  });

# getVisitorId() → {String}

Returns a string representing current sessions visitor ID.
String containing visitor ID.
String
Example

Acquiring visitor ID

  sm.getApi({version: 'v1'}).then(function(glia) {
    console.log('This visitor ID is ' + glia.getVisitorId())
  });

# isInEngagement() → {boolean}

Finds out if the visitor is currently in an engagement.
true if the visitor is in engagement, false otherwise.
boolean

# leaveMessage(opts) → {Promise}

Leaves a message for the operators. This message will be included in `inbox_message` exports. Either phone or email must be specified.
Parameters:
Name Type Attributes Description
opts Object opts
name string <nullable>
A name to include in the message.
phone string <nullable>
A phone number to include in the message.
email string <nullable>
An email address to include in the message.
message string <nullable>
The text body of the message.
Fulfilled with an empty object or rejected with an {Error} if the process fails for any reason. The {Error} may have one of the following causes: INVALID_INPUT, INTERNAL_ERROR, NETWORK_TIMEOUT.
Promise

# leaveOperatorMessage(opts) → {Promise}

Leaves a message for the operator. This message will be included in `operator_message` exports. Operator ID and either phone or email must be specified.
Parameters:
Name Type Attributes Description
opts Object opts
operatorId string The ID of the operator who will receive the message.
name string <nullable>
A name to include in the message.
phone string <nullable>
A phone number to include in the message.
email string <nullable>
An email address to include in the message.
message string <nullable>
The text body of the message.
Fulfilled with an empty object or rejected with an Error if the process fails for any reason. The {Error} may have one of the following causes: INVALID_INPUT, INTERNAL_ERROR, NETWORK_TIMEOUT.
Promise

# queueForEngagement(media, options) → {Promise}

Enqueues the visitor for engagement. On high-traffic sites, visitors looking for engagements can greatly outnumber the available operators. To be able to still provide best possible user experience under these circumstances, Glia provides a way for visitors to queue for engagements. Visitors who have entered the queue will, in turn, be engaged with an appropriate operator as soon as one becomes available. See the Allow visitors to queue for engagements example above to see how to use this method in combination with the QUEUE_STATE_UPDATE event to build a complete flow. The returned Promise will be rejected with cause DISABLED if queuing is disabled for the current site. Whether queuing is enabled can be checked from Config.queuingEnabled
Parameters:
Name Type Attributes Description
media string The starting media for the engagement. Must be one of Engagement#MEDIA_TYPES. Currently acceptable values are available through AggregateQueueState#medias, where the current {AggregateQueueState} instance is available through QUEUE_STATE_UPDATE event. If the provided value is not included in current AggregateQueueState#medias, then the returned Promise will be rejected with cause INVALID_INPUT.
options Object
phoneNumber string <nullable>
The visitor's phone number in E.164 format to use when starting media is 'phone'.
phoneExtension string <nullable>
The visitor's phone number extension, which can contain commas and up to 7 digits. The commas represent a two second wait between digits. This will be used when starting media is 'phone'.
oneWay boolean <nullable>
When true, only the operator will have the requested media, while the visitor's media will be 'text'. This option is invalid if the specified media is 'text', 'audio' or 'phone'. See also: One-Way.
queueId string <nullable>
When given an ID representing an existing queue for the current site, the visitor will be queued in the specified queue. This is useful when a site has several queues staffed by different teams. The media parameter provided must be one of the media types available for the provided queue. The promise will be rejected with {AlreadyQueuedError} if consecutive requests differ in the provided queue ID or media selection.
Fulfilled with an empty object or rejected with an Error if the process fails for any reason. The Error may have one of the following causes: INVALID_INPUT, DISABLED, INTERNAL_ERROR, ALREADY_QUEUED, NETWORK_TIMEOUT, FORBIDDEN
Promise

# removeEventListener(type, listener)

Removes an event listener from the API.

If an event listener is removed while the API is processing an event, it will not be triggered with the current event.

An event listener is never invoked after being removed.

Calling removeEventListener with arguments which do not identify any currently registered listener has no effect.

Parameters:
Name Type Description
type string The event type for which the listener is removed.
listener function The event listener to be removed.

# requestAsset(path, headers) → {Promise}

Fetches asset on a given URL. This can be used to fetch various files such as engagement files that are not publicly accessible and need visitor access tokens to be accessed.
Parameters:
Name Type Description
path string Absolute path to the asset.
headers Object Request headers, overrides default headers.
Fulfilled with a {Blob} object or rejected with an Error if the process fails for any reason. The Error may have one of the following causes: INVALID_INPUT, INTERNAL_ERROR, NETWORK_TIMEOUT.
Promise

# requestEngagement(media, options) → {EngagementRequest}

Sends an engagement request.
Parameters:
Name Type Attributes Description
media string The starting media for the engagement. Must be one of Engagement#MEDIA_TYPES.
options Object options
phoneNumber string <nullable>
The visitor's phone number in E.164 format to use when starting media is 'phone'.
phoneExtension string <nullable>
The visitor's phone number extension, which can contain commas and up to 7 digits. The commas represent a two second wait between digits. This will be used when starting media is 'phone'.
oneWay boolean <nullable>
When set to true, only the operator will have the requested media, while the visitor's media will be 'text'. This option is invalid if the specified media is 'text', 'audio' or 'phone'. See also: One-Way.
operatorId string <nullable>
The ID of the operator to engage.
The engagement request.
Example
Requesting a 'text' engagement
  sm.getApi({version: 'v1'}).then(function(salemove) {
    var engagementRequest = salemove.requestEngagement('text');
    engagementRequest.engagementPromise.then(function(engagement) {
      ...
    }).catch(function(error) {
      if (error.cause === salemove.ERRORS.OPERATOR_DECLINED) {
        ...
      } else {
        ...
      }
    });
  });

# setEngagementReestablishHandler(handler)

Sets the engagement re-establishing handler. This method provides a way to control what happens when an engagement has been re-established. It is suggested that this handler is set immediately on every page load. As engagements are always re-established shortly after page load then setting this handler immediately helps ensure the correct behavior for every engagement re-establish. The engagement will still be re-established even if no handler is set. However, not setting an handler to give visual feedback to the visitor about the ongoing engagement may create a bad user experience for the visitor.
Parameters:
Name Type Description
handler function The handler to use when re-establishing engagement. When engagement has been re-established, this handler will be called with a single argument. The argument is an Engagement.
Example
Adding an sm-engaged-operator widget onto the page after an engagement has been re-established
  sm.getApi({version: 'v1'}).then(function(salemove) {
    salemove.setEngagementReestablishHandler(function(engagement) {
      var engagedOperator = document.createElement('sm-engaged-operator');
      document.body.appendChild(engagedOperator);
    });
  });

# setIncomingEngagementRequestHandler(handler)

Overwrites the handler for incoming engagement requests.
Parameters:
Name Type Description
handler function The handler to use for incoming engagement requests. When an operator 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.
Example
Handling an incoming request
  sm.getApi({version: 'v1'}).then(function(salemove) {
    salemove.setIncomingEngagementRequestHandler(function(request) {
      promptUserToAcceptOrDeclineEngagement(request.timeout).then(function(accepted) {
        if accepted {
          return request.accept()
        } else {
          return request.decline().then(function() {
            return Promise.reject('User declined.');
          });
        }
      }).then(function() {
        return promptUserToSelectMedia();
      }).then(function(mediaSelection) {
        if mediaSelection.canceled {
          return request.decline().then(function() {
            return Promise.reject('User declined during media selection.');
          });
        } else {
          return request.selectMedia(mediaSelection.media, mediaSelection.options);
        }
      }).then(function() {
        return request.engagementPromise;
      }).then(function(engagement) {
        ...
      }).catch(function(error) {
        if (error.cause === salemove.ERRORS.TIMEOUT) {
          ...
        } else {
          ...
        }
      });
    });
  });

  function promptUserToAcceptOrDeclineEngagement(timeout) {
    var accepted = true;
    return Promise.resolve(accepted);
  }

  function promptUserToSelectMedia() {
    return Promise.resolve({
      canceled: false,
      media: 'phone',
      options: {
        phoneNumber: '+12168675309',
        phoneExtension: '1,23'
      }
    });
  }

# setLocale(locale) → {void}

Sets the locale for the Glia Visitor App. Upon initialization the Visitor App is set to the default locale configured for the site. This function can be used to change the locale of the Visitor App at any time after initialization.
Parameters:
Name Type Description
locale string The locale to which to switch the Visitor App. The parameter provided needs to be a valid locale key. For base locales this is one of: `en-US`, `de-DE`, `es-MX`, `et-EE`, `fi-FI`, `fr-CA`, `zh-CN`, `zh-TW`. For custom locales it is the locale key that you have defined.
An Error with INPUT_ERROR cause is thrown if the provided locale is not supported.
Error
void

# setupContactOperatorButton(opts) → {void}

Sets up a custom button for contacting an operator.
Parameters:
Name Type Description
opts Object arguments
withOperatorsHtml string The HTML to use to override the default button visuals when there is at least one operator available. If an empty string is provided then nothing will be shown.
withoutOperatorsHtml string The HTML to use to override the default button visuals when there are no operators available. If an empty string is provided then nothing will be shown.
withoutOperatorsCallback function The function to call when the button is clicked while there are no available operators.
Deprecated:
void

# subscribeToQueueStateUpdates(queueIds, listener)

Subscribes to state updates of one or multiple queues. Compared to QUEUE_STATE_UPDATE event, which provides {AggregateQueueState} updates, this allows to subscribe to queue state updates of a specific queue. This can be useful when there is a need to have multiple integration points, for example buttons, corresponding to different queues.
Parameters:
Name Type Description
queueIds Array.<string> Non-empty list of the IDs of the queues to subscribe to.
listener function The listener function that is called when a queue state update occurs. The listener is called with the updated Queue instance.
An Error with INPUT_ERROR cause is thrown if the provided params are invalid or undefined.
Error
Example
Subscribing to all queues state updates
  salemove.getQueues().then(function(queues) {
    var queueIds = queues.map(function(queue) {
      return queue.id;
    });
    salemove.subscribeToQueueStateUpdates(queueIds, function(queue) {
      var button = findButtonByQueue(queue.id);
      if (queue.state.status === queue.state.STATUSES.OPEN) {
        updateQueueButtonMedia(queue.state.medias);
        showQueueButton(button);
      } else {
        hideQueueButton(button);
      }
    })
  });

# updateInformation(opts) → {Promise}

Updates the current visitor's information.

The information provided by this endpoint is available to all the operators observing or interacting with the visitor. This means that this endpoint can be used to provide additional context about the visitor to all the operators. For example, if a visitor is logged into the current site and their name and email are recorded on their profile, then taking the data from the profile and passing it into this endpoint helps the operators see the real names and emails of every logged in visitor even before they start a conversation.

In a similar manner custom attributes can be used to provide additional context. For example, if your site separates paying users from free users, then setting a custom attribute of 'user_type' with a value of either 'free' or 'paying' depending on the visitor's account can help operators prioritize different visitors.

Parameters:
Name Type Attributes Description
opts Object opts
name string <nullable>
The visitor's name.
phone string <nullable>
The visitor's phone number.
email string <nullable>
The visitor's email address.
note string <nullable>
Notes related to the visitor.
customAttributes Object <nullable>
An object with custom key-value pairs to be assigned to the visitor. The server treats all keys and values as strings and also returns them as strings. Nested key-value pairs are not supported.
customAttributesUpdateMethod string <nullable>
How custom attributes are updated. When set to 'replace' (or unspecified), all existing custom attributes are overwritten with the attributes in customAttributes. When set to 'merge', only attributes present in customAttributes are added or updated. In case of `merge` it is possible to remove a custom attribute by setting its value to `null`.
externalId string <nullable>
The visitor's unique identifier in scope of the current site. Valuable information about the current visitor may often be available in CRMs and other systems external to Glia. This field allows matching the visitor to their record in such CRMs and other external systems. For example, a visitor can have an ID within Salesforce. By setting the 'external_id' to the current visitor's Salesforce ID, they can easily be matched to their record within Salesforce.
Fulfilled with an empty object or rejected with an Error if the process fails for any reason. The Error may have one of the following causes: INVALID_INPUT, TOO_MANY_REQUESTS, INTERNAL_ERROR, NETWORK_TIMEOUT.
Promise
Examples

Updating visitor's phone and custom attribute "source"

  sm.getApi({version: 'v1'}).then(function(glia) {
    glia.updateInformation({
      phone: '+10000000000',
      customAttributes: {
        source: 'search' //only attribute "source" will remain
      }
    }).then(function() {
      ...
    }).catch(function(error) {
      if (error.cause == glia.ERRORS.NETWORK_TIMEOUT) {
        ...
      } else {
        ...
      }
    });
  });

Updating visitor's custom attribute "vip" without changing others

  sm.getApi({version: 'v1'}).then(function(glia) {
    glia.updateInformation({
      customAttributesUpdateMethod: 'merge',
      customAttributes: {
        vip: 'true'
      }
    }).then(function() {
      ...
    }).catch(function(error) {
      if (error.cause == glia.ERRORS.NETWORK_TIMEOUT) {
        ...
      } else {
        ...
      }
    });
  });

# willNavigate() → {Promise}

Notifies Glia platform of an upcoming navigation with intention to return.
Deprecated:
  • This funcionality is no longer needed
Fulfilled with an empty object.
Promise

Events

# AUTHENTICATION_REQUEST

Triggered when a new authentication request is added to the visitor's state.

# CONNECTION_STATUS_UPDATE

Triggered when the client either loses or regains the connection to Glia services which are required for operation. The event listener will be called with a ConnectionStatus instance.

# ENGAGEMENT_END

Triggered when an engagement has ended. The event listener will be called with an Engagement instance.

# ENGAGEMENT_REQUEST

Triggered when an operator has requested to start an engagement with the current visitor.

# ENGAGEMENT_START

Triggered when an engagement starts, regardless of whether it was initiated by the visitor or the operator. Also triggered when the engagement is re-established. The event listener will be called with an Engagement instance.

# OPERATOR_LIST_UPDATE

Triggered when any of the operators either comes online or goes offline. Also triggered for every listener immediately when the listener is added. The event listener will be called with an array of up to date online Operator instances.

Operator is considered online whenever they are logged into the system. Thus operator can be unavailable (on a break, engaged with another Visitor) while still being online.

# OPERATOR_STATUS_UPDATE

Triggered when any of the operators' state (availability, media) changes. The event listener will be called with an updated Operator instance.

# QUEUE_STATE_UPDATE

Visitor is not always able to join the queue. For instance, there might be cases when there are no operators available or the queue is full (it reached the maximum length). Therefore visitor needs to be aware of the state of the queue to take the corresponding action. For more information about the queue states see AggregateQueueState.

The event is triggered whenever the state of the queue changes. Also triggered for every listener immediately when the listener is added. The event listener will be called with a AggregateQueueState instance.

# VISITOR_STATUS_UPDATE

Triggered when the visitor's status changes. Called with a VisitorStatus instance.

Visitor can have multiple concurrent sessions browsing the application. ENGAGEMENT_START and ENGAGEMENT_END events are only triggered in the browser session where the engagement was started. These events are not triggered in any other browser session.

Other browser sessions may want to hide some parts of the application to avoid visitor from trying to start an engagement. Only one concurrent engagement is allowed between a visitor and an operator on one site. Attempting to establish more than one engagement will fail.