JavaScript API

Output Desk JavaScript API allows you to customize versatile aspects of the Chat Window.

If you experience any problems with our JavaScript API implementation, please contact us at support@srimax.com
By default, your Chat Window will be shown as like below.

Online

Output Desk default onlineAPI

Offline

Output Desk default offlineAPI

Customizing Chat Window

To change the appearance of the online Chat Window, use the following script.

<script>

   ODL('appearence',{
      "bar-background-color": “#42ABC2”, 
      "bar-text-color": “white”, 
      "online-title": “Output Desk – Online”, 
      "offline-title": “Output Desk – Offline”,
      "button-background-color": “#208ED3”, 
      "button-text-color": “white”
   });

</script>

View Demo

Parameters

  1. bar-background-color – Changes the Output Desk Header’s background color.
    Ex: “background-color”: “HtmlColorName or Hexadecimal Code”
    “background-color”: “#42ABC2”
  2. bar-text-color – Changes the Output Desk Header’s Text color.
    Ex : ”text-color”: “HtmlColorName or Hexadecimal Code”
  3. online-title – Changes the window’s Title when you are Online .
    Ex: “online-title”: “Output Desk – Online”
  4. offline-title – Changes the window’s Title when you are offline.
    Ex: “offline-title”: “Output Desk – Offline”
  5. Output Desk Custom OfflineAPI
  6. button-background-color – Changes the Chat window Submit Button’s background color.
  7. button-background-color – Changes the Chat window Submit Button’s Font color.

Open Chat Window

Use the following JavaScript to open the Chat Window.

<script>

document.getElementById(“btn”).click = function() { 
    ODL('openchat');
};

</script>

View Demo

Customize Chat Form

Send the given JavaScript to set value in the form fields in the Chat Form.

<script>

   ODL('formfields', {
      "name": "Wilson",
      "email": "wilson@gmail.com",
      "department": "Sales",
      "phone": "+919503571136",
      "country": "India”
   });

</script>

View Demo

Auto Submit Chat Form

Set ‘is_auto_submit’ property as true, to submit the chat form automatically.

<script>

ODL('openchat',function() {
    ODL('formfields',{
       "name": "Wilson",
       "email": "wilson@gmail.com",
       "message": "Hello",
       "is_auto_submit": "true"
     });
});

</script>

View Demo

Close Chat Window

With following JavaScript, you can close the Chat Window.

<script>

document.getElementById(“btn”).click = function() {
    ODL('closechat');

};

</script>

View Demo