Configuration Variables
- define the connection to the server (using Softdial.config. See below)
- localize the displayed text
- show or hide elements
- set CSS styles
All variables are contained in the Softdial object.
Remember that any changes can have a deep and unpredictable effect, so they must be checked before final implementation of the customer client. This is important specially when you change sizes or layout of elements as they are interdependent.

Each method below contains an example showing how to:
- hide the balloon when maximized
- make the agent's statements border colour red
- make the agent's statements background colour pink
- turn off floating of the whole chat window (it is floating by default)
- display company name as title (always, even when minimized)
The configuration variables may be sent to the server in 3 different ways.

For this method,
- the main script must be included in either the HEAD or BODY of the page
- a separate configuration script snippet (see example below) must be placed in the BODY part of the page
For this configuration script, all properties must be named explicitly as described in The Softdial object below.
For example, to hide the balloon:
Softdial.balloon.visibleWhenMaximized = false;
When using this method, the function Softdial.run() must be invoked as the final command.

<script type="text/javascript">
Softdial.balloon.visibleWhenMaximized = false;
Softdial.chat.agent.borderColor = "red";
Softdial.chat.agent.css = "background: pink";
Softdial.floating = false;
Softdial.bar.minimized.title = "Company name";
Softdial.bar.normal.title = "Company name";
Softdial.run();
</script>

According to HTML5 rules, each tag may contain additional user variables and their values. They can be passed to the main script and set as part of configuration process. To create a variable that might be placed as an attribute of the <script> tag, convert object property names (as described in The Softdial object below) by replacing
- Softdial with data
- dots with dashes
For the same example given above, the variable takes the following form:
data-balloon-visibleWhenMaximized = "false"

<script type="text/javascript"
src='http://[SCC-web-server]:8888/softdial/chat2/js/softdialchat.js'
data-balloon-visibleWhenMaximized = "false"
data-chat-agent-borderColor = "red"
data-chat-agent-css = "background: pink"
data-floating = "false"
data-bar-minimized-title = "Company name"
data-bar-normal-title = "Company name">
</script>

The user can send a set of variables and their values directly to the file as part of a URL. This is called the GET method.
The URL should take the following form:
<script type="text/javascript" src='http://[SCC-web-server]:8888/softdial/chat2/js/softdialchat.js?balloon-visibleWhenMaximized=false'></script>
The following rules for formatting the src URL apply:
- Single line string limited to 256 characters (for both location and variable definitions)
- Softdial is omitted
- Replace dots with dashes
- All spaces in values must be converted to %20 according to the URL definition
- If you include more than one variable, they must be divided by the “&” (ampersand) character.

<script type='text/javascript'
src='http://[SCC-web-server]:8888/softdial/chat2/js/softdialchat.js?
balloon-visibleWhenMaximized=false&
chat-agent-borderColor=red&
chat-agent-css=background:%20pink&
floating=false&
bar-minimized-title=Company%20name&
bar-normal-title=Company%20name'>
</script>

Properties

Description | Type | Default value |
---|---|---|
If set to true and the parent of the chat is the document body, then the chat window becomes a floating window that can be dragged into another place using top bar. The chat window can consume considerable graphical resources. If dragging the floating window is slow, disable it by setting the floating variable to false. |
boolean | true |

Description | Type | Default value |
---|---|---|
The language to be used. See also Softdial.chatLocale below. | string | en |

Description | Type | Default value |
---|---|---|
Contains the ID of the outer element – either the parent layer, or the body of the page. If equal to page body then the whole chat window can be made floating and movable (see Softdial.floating). By default, the customer client fills all the possible space of parent object | string | body |

Description | Type | Default value |
---|---|---|
State of the chat on start. Either:
|
string | max |
Objects

The balloon part of the UI
Fig. 1 - Waiting for Input screen
Properties

Description | Type | Default value |
---|---|---|
A single color for the whole border of the balloon | CSS colour string | empty |

Description | Type | Default value |
---|---|---|
Inline style for the balloon. Alternative to the external definition in .masterClass | Valid css string | empty |

Description | Type | Default value |
---|---|---|
CSS class for the balloon. Alternative to the inline definition in .css. New CSS classes can be defined in css/softdialchat.css. The default value balloon is already present, but others can be added as required. | string | balloon |

Description | Type | Default value |
---|---|---|
Text appearing in the balloon, beneath the title | string | Balloon text |

Description | Type | Default value |
---|---|---|
Alignmant for all text in the balloon (left, right or center) | string | left |

Description | Type | Default value |
---|---|---|
Text displayed as the balloon title | string | Balloon title |

Description | Type | Default value |
---|---|---|
Shows or hides the balloon when the application is minimized. | boolean | true |

Description | Type | Default value |
---|---|---|
Shows or hides the balloon when the application is maximized. | boolean | true |
Objects

Definition for the close button on a balloon
Properties

Description | Type | Default value |
---|---|---|
Inline style for the close button | Valid css string | empty |

Top bar of the chat window
Fig. 2 - Waiting for Input screen
Properties

Description | Type | Default value |
---|---|---|
Inline style for the bar. Alternative to the external definition in .masterClass | Valid css string | empty |

Description | Type | Default value |
---|---|---|
CSS class for the top bar. Alternative to the inline definition in .css. New CSS classes can be defined in css/softdialchat.css. | string | empty |

Description | Type | Default value |
---|---|---|
Shows or hides the top bar | boolean | true |
Objects

Definition of variables for the button which enables the customer to leave the chat
Properties

Description | Type | Default value |
---|---|---|
Inline style for the button | Valid CSS string | empty |

Description | Type | Default value |
---|---|---|
Hint displayed when mouse hovers over the button | string | Exit chat |

Description | Type | Default value |
---|---|---|
Text displayed on the button | string | Exit |

Description | Type | Default value |
---|---|---|
Shows or hides the button | boolean | true |

Minimized state of the chat
Properties

Description | Type | Default value |
---|---|---|
Inline style for the title bar when chat is minimized | Valid CSS string | empty |

Description | Type | Default value |
---|---|---|
Title to be displayed in the top bar when chat is minimized | string | Minimized Softdial Chat |

Definition of variables for the button which minimizes or maximizes the chat window
Properties

Description | Type | Default value |
---|---|---|
Inline style for the button | Valid CSS string | empty |

Description | Type | Default value |
---|---|---|
Hint displayed when mouse hovers over the button | string | Minimize chat |

Description | Type | Default value |
---|---|---|
Shows or hides the button | boolean | true |

Maximized state of the chat
Properties

Description | Type | Default value |
---|---|---|
Inline style for the title bar when chat is maximized | Valid CSS string | empty |

Description | Type | Default value |
---|---|---|
Title to be displayed on a top bar when chat is maximized | string | Softdial Chat |

Chat window when displayed.
Fig. 3 - Chat in Progress screen
Properties

Description | Type | Default value |
---|---|---|
Inline style for the window. Alternative to the external definition in .masterClass | Valid CSS string | empty |

Description | Type | Default value |
---|---|---|
CSS class for the chat window. Alternative to the inline definition in .css. New CSS classes can be defined in css/softdialchat.css. | string | empty |
Objects

Settings for the agent part of the conversation.
Properties

Description | Type | Default value |
---|---|---|
A single color for the whole border of the agent part of the conversation | Valid color string | empty |

Description | Type | Default value |
---|---|---|
Inline style for agent's part of the conversation. Alternative to the external definition in .masterClass | Valid CSS string | empty |

Description | Type | Default value |
---|---|---|
CSS class for the agent's part of the conversation. Alternative to the inline definition in .css. New CSS classes can be defined in css/softdialchat.css. | string | empty |

Settings for customer part of the conversation.
Properties

Description | Type | Default value |
---|---|---|
A single color for the whole border of the customer part of the conversation | Valid color string | empty |

Description | Type | Default value |
---|---|---|
Inline style for customer's part of the conversation. Alternative to the external definition in .masterClass | Valid CSS string | empty |

Description | Type | Default value |
---|---|---|
CSS class for the customer's part of the conversation. Alternative to the inline definition in .css. New CSS classes can be defined in css/softdialchat.css. | string | empty |

Value is an array of lists containing translations of program statements that are used across the application.
The default language, English (en), contains a list of statements in English:
en: {
pleaseEnterYourName: 'Please enter your name',
isTyping: 'is typing...',
joined: 'joined',
left: 'left',
errorCouldNotInitServerConnection: 'Could not connect to chat hub',
errorUnknown: 'Unknown server error',
msgSessionEnded: 'Your chat session has ended',
errorMissingParams: 'Error: missing chat
connection parameters: tenant, campaign, queue',
errorServerNotFound: 'Server not found. Please contact the System Administrator',
pleaseWriteAMessage: 'Please write a message in a message box provided on start'
}
To enhance the list, add more languages (e.g. pl for Polish) to the array, translating the full list into this language.e.g:
Softdial.chatLocale = {
en: {pleaseEnterYourName:'Please enter your name', ...},
pl: {pleaseEnterYourName:'Proszę podać imię', ...}
}
To select which language to display, use Softdial.lang (above)

Set of configuration variables
Properties

Description | Type | Default value |
---|---|---|
Campaign where the chat will connect. Usually set by the company that runs the service | string | empty |

Description | Type | Default value |
---|---|---|
Part of the URL after the server address (i.e. Softdial.config.server) | string | softdial/chatserver |

Description | Type | Default value |
---|---|---|
Queue where the chat will connect | string | ChatQueue |

Description | Type | Default value |
---|---|---|
Server URL where the chat service is running | string | The server from where the script was invoked |

Description | Type | Default value |
---|---|---|
The tenant running this service | string | default |

Settings for the list of departments displayed on start screen
Fig. 4 - Waiting for Input screen
Properties

Description | Type | Default value |
---|---|---|
Message to be displayed above the drop down box | string | Please choose department |

Description | Type | Default value |
---|---|---|
Shows or hides the departments drop down box | boolean | false |
Objects

Contains a list of comma-separated key:value pairs where
- key - an option value
- value - the text to be displayed in the dropdown list.
For example:
Softdial.departments.list: {first: "Dept 1",second: "Dept 2"}
becomes the following generated HTML code:
<option value='first'>Dept 1</option>
<option value='second'>Dept 2</option>

Settings for the message bar.
Fig. 5 - Chat in Progress screen
Properties

Description | Type | Default value |
---|---|---|
Inline style for the message bar. Alternative to the external definition in .masterClass | string | empty |

Description | Type | Default value |
---|---|---|
CSS class for the message bar. Alternative to the inline definition in .css. New CSS classes can be defined in css/softdialchat.css. | string | empty |
Objects

Settings for the message box itself
Properties

Description | Type | Default value |
---|---|---|
Inline style for the message box. Alternative to the external definition in .masterClass | string | empty |

Description | Type | Default value |
---|---|---|
CSS class for the message box. Alternative to the inline definition in .css. New CSS classes can be defined in css/softdialchat.css. | string | empty |

Description | Type | Default value |
---|---|---|
Placeholder text displayed when message box is empty | string | Type in here... |

Settings for the OK button
Properties

Description | Type | Default value |
---|---|---|
Inline style for the OK button. Alternative to the external definition in .masterClass | string | empty |

Description | Type | Default value |
---|---|---|
Hint displayed when mouse hovers over the button | string | Send message... |

Description | Type | Default value |
---|---|---|
CSS class for the OK button. Alternative to the inline definition in .css. New CSS classes can be defined in css/softdialchat.css. | string | empty |

Description | Type | Default value |
---|---|---|
Text displayed on the button | string | OK |

Settings to position and size the chat window inside the parent.
Properties

Description | Type | Default value |
---|---|---|
Bottom of the chat window | Valid CSS string | 3em |

Description | Type | Default value |
---|---|---|
Height of the chat window | Valid CSS string | 400px |

Description | Type | Default value |
---|---|---|
Left side of the chat window | Valid CSS string | empty |

Description | Type | Default value |
---|---|---|
Right side of the chat window | Valid CSS string | 2em |

Description | Type | Default value |
---|---|---|
Top of the chat window | Valid CSS string | empty |

Description | Type | Default value |
---|---|---|
Width of the chat window | Valid CSS string | 300px |

Settings for the message displayed over the message input box on a start screen
Fig. 6 - Waiting for Input screen
Properties

Description | Type | Default value |
---|---|---|
The actual message | string | Please write your message |
Functions

When using a separate configuration script, this function must be invoked as the last command in the script, after all changes in configuration have been made.