Public methods in javascript

Public methods in javascript

Warning
These instructions are intended for people with a basic understanding of web programming languages: HTML and JavaScript. If this does not apply to you, we recommend that you contact your developers and provide them with these instructions. The installation will be very easy for them. 

Oct8ne provides clients with a set of predefined JavaScript functions to enable specific behaviors. This allows end users to call the functions they need to achieve their desired goals.
Info
These methods can be called from clients' web pages using YOUR OWN JAVASCRIPT.
This brief documentation compiles all the methods that can be called.

GENERAL METHODS
  1. oct8ne.open(enterType: string, message: string)
This method starts the Oct8ne chat with an “input type” and an initial chat message, sent as an agent.
This function supports 2 optional parameters:
enterType:  This is a string that can take the values: ‘TRIGGER’, ‘CUSTOM’, ‘LIVECHAT’. If the input type is not specified, it defaults to TRIGGER.
message: This refers to the message to be conveyed at the start of that session.
* This function does not return a value.



  1. oct8ne.isVisible()
This method checks the client settings to see if chat is enabled (or disabled) on the website.

This function does not support parameters.

* This function returns a Boolean value: ‘true’ if chat is enabled and ‘false’ if it is disabled.

  1. oct8ne.getVisitorStatus()
This function checks the visitor's status.
This function does not accept parameters.
* This function returns a string (“Just Looking,” “Waiting,” “Attending”) depending on the visitor’s status at the time the call is made.

  1. oct8ne.agentsAvailable()
Checks agent availability at the time the function is called.
This function does not accept any parameters.
* This function returns a boolean value: ‘true’ if agents are connected, and ‘false’ if no agents are connected to the Oct8ne dashboard.

  1. oct8ne.isMobile()
Check whether the user is browsing from a mobile device (or not)
This function does not support parameters.
* This function returns a Boolean value: ‘true’ if the user is on a mobile device, and ‘false’ if the user is on another device (desktop computer)

  1. oct8ne.updateTriggerValue(key: string, value: string)
This method updates the values of the specified property in "oct8ne.customData" and re-evaluates the triggers.
It is only used if the "oct8ne.customData" object is embedded in the page.
This function supports two parameters:
key: A string corresponding to the property you want to update.
value: A string containing the new value you want to assign to the trigger.
* This function does not return anything as a response.

  1. oct8ne.restart()
This function reloads the Oct8ne API, simulating a page refresh. Useful for SPA environments.
This function does not support parameters.
* This function does not return a response.

  1. oct8ne.updateOct8neOptions(object:object)
A method that updates context variables so that the agent can see them reflected in the Oct8ne dashboard.
This function accepts 1 required parameter. It must be a key-value object containing the variables to be updated or added.
* This function does not return a value.


Info
Example:
  1. var object = {
  2.       'id':'123456',
  3.       'location':'Barcelona'
  4. }
  5. oct8ne.updateOct8neOptions(object);






METHODS RELATED TO CHAT SIZE.

They change the size of the chat window. 

Info
For these methods to work properly, a conversation must already be open in the Oct8ne chat.

  1. oct8ne.ui.showMinimized()
A method that minimizes the Oct8ne window.
This function does not accept any parameters.
* This function does not return a value.

  1. oct8ne.ui.showChat()
Opens Oct8ne, using only the size of the chat module. 
This function does not support parameters.
* This function does not return a response.

  1. oct8ne.ui.showCoviewer()
Open Oct8ne fully; that is, display the expanded chat module with the preview pane open (if the client settings allow it).
This function does not support parameters.
* This function does not return a response.




METHODS RELATED TO THE BOT

  1. oct8ne.bot.getContext()
Retrieves the values of the visitor's variables in the bot.
This function does not support parameters.
* This function does not return a response.

  1. oct8ne.bot.updateBotContext(updateVars: object)
Updates the values of the visitor's context variables in the Bot.
This is only used if the ‘oct8ne.options’ object is embedded in the page.
This function supports 1 required parameter. It must be a key-value object containing the variables to be updated.
* This function does not return a response.

Info
Ejemplo:         
  1. var newVars= {
  2.        'sessionId':'XXXXXXXXX'
  3. }
  4. oct8ne.updateOct8neOptions(newVars);         

  1. oct8ne.bot.gotoHome()
When this method is called, the bot goes to the root node of the main tree it has defined.
This function does not accept any parameters.
* This function does not return a value.

  1. oct8ne.bot.gotoAction(treeId: int, nodeId: string)
When this method is called, the current conversation is “moved” to a specific node in a tree.
This function supports two optional parameters:
treeId: An integer that refers to the selected tree.
nodeId: The node or module to which the conversation is to be moved.
* This function does not return a value.

Info
•    If only the treeId is specified, the function navigates to the root node of the specified tree.
•    If treeId and nodeId are specified, it jumps to the specified node and tree.
•    If used without parameters, it goes to the root node of the main tree (equivalent to oct8ne.bot.gotoHome.)



ADDITIONAL CONSIDERATION


Info
If ALL of these methods are added when the page loads, they should be placed within an event callback that ensures Oct8ne has already loaded, such as oct8ne.onReady.
Example:
  1. oct8ne.onReady = function () {
  2.     oct8ne.bot.gotoHome();
  3. };



    • Related Articles

    • Oct8ne API for custom CSM integration

      Oct8ne API documentation API version 2.4 Contents 1. Introduction 2. Architecture 3. Overview 3.1. Downloading and installing plug-ins and extensions 3.2. Registering as a developer and enabling the platform 3.3. Inserting the oct8ne widget 3.4. ...
    • Integrate Oct8ne with your mobile app (using webviews)

      These instructions are intended for people with a basic understanding of web programming languages: HTML and JavaScript. If this does not apply to you, we recommend that you contact your developers and provide them with these instructions. The ...
    • Customised or personalised triggers

      These instructions are intended for people with a basic understanding of web programming languages: HTML and JavaScript. If this does not apply to you, we recommend that you contact your developers and provide them with these instructions. The ...
    • Contextual Information

      These instructions are intended for individuals with a basic understanding of web programming languages: HTML and CSS. If this does not apply to you, we recommend contacting your developers and providing them with these instructions. The installation ...
    • Bot Instruction Manual for Web and Messaging

      TABLE OF CONTENTS 1. OVERVIEW 1.1. Flow Designer 2. WEB BOT: GETTING STARTED 2.1. Create a conversation 2.2. Specific tools in the conversation designer 2.3. Turning the Bot on and off 3. BOT MESSAGING: GETTING STARTED 3.1. Create a conversation 3.2. ...