WIDGET API

Access to API

After the button is uploaded, the callback feature is called$owidgetOnLoad. You can call the API feature using theowidgetobject.

<script type="text/javascript">
  (function () {
    var scr = document.createElement('script'); scr.type = 'text/javascript'; scr.async = true; scr.charset = 'UTF-8';
    scr.src = '//app.mluvii.com/widget/OOWidget.js';
    scr.$owidgetOnLoad = function (owidget) {
      if (!owidget.isSupported) { return; }
      // owidget.init(...);
      // ...
      // owidget.connectToServer();
    };
    var ffs = document.getElementsByTagName('script')[0]; ffs.parentNode.insertBefore(scr, ffs);
  })();
</script>


Api feature

init

Syntax

owidget.init(companyId, [widgetPreset], [language]);

Parameters

  • companyIdGUID identifying the company.

  • widgetPresetPackage name. If the parameter is missing, the default package is used.

  • languagePackage language. If the parameter is missing, the default package is used.

connectToServer

It uploads the configuration from the server and starts tracking the status of the operator groups.

Syntax

owidget.connectToServer();

setAppEventCallback

Sets the callback feature to track defined events.

Syntax

owidget.setAppEventCallback(callback);

Parameters

  • callbackCallback function:function (e) {}. The feature will be called each time one of the defined events occurs. The feature parameterEwill contain a structure describing an event with elements:
    • typeEvent type.

Event Types

  • chatWindowOpen Chat window open.

  • chatWindowClosed Chat window closed.

  • chatSessionCreated The client waits for the operator.

  • chatSessionStarted Session with the operator began.

  • chatSessionEnded The session is over.

setStatusUpdateCallback

Sets the callback feature to monitor the status of the button.

Syntax

owidget.setStatusUpdateCallback(callback);

Parameters

  • callbackCallback feature:function (code) {}. The feature will be called each time the button status changes. The parametercodeacquires one of the three values described.

Button status codes

  • 0 the button is “offline”

  • 1 the button is “online”

  • 2 the button is “busy”

setCustomNumberNormalization

Sets the custom function to normalize phone number

Syntaxe

owidget.setCustomNumberNormalization(callback);

Parameters

  • callback Callback function: function (phoneNumber) { }. The function will replace the default phone number normalisation function

Expected return values

  • null If the number is in a non-invalid format, the function should return null
  • Normalize phone number If the entered number is in the correct format, the string with the phone number in the international format is returned, eg even +420 777 666 555 even if the entry was only 777 666 555

results matching ""

    No results matching ""