Skip to content
FacebookYouTubeX (Twitter)

JavaScript API - Attributes

You can customize the widget passing the following parameters to window.pingstreamsSettings object.

These set of attributes modify the general widget behaviour

AttributeTypeDescription
projectidstringThe Pingstreams project id. Find your Pingstreams ProjectID in the Pingstreams Dashboard under the Widget menu
departmentIDstringTo skip departments selection, you can set the department ID upon which the widget must start the new conversation (See the tutorial here)
welcomeTitlestringThe welcome title to show on the widget home page
welcomeMsgstringSet the widget welcome message
widgetTitlestringSet the widget title label shown in the widget header. The default value is ‘Pingstreams’
calloutTitlestringThe title of the callout window
calloutMsgstringThe message of the callout window
calloutTimerintegerProactively open the chat windows to increase the customer engagement. Permitted values: -1 (Disabled), 0 (Immediately) or a positive integer value (e.g. 5 (After 5 seconds), 10 (After 10 seconds))
logoChatstringThe url of the logo to show on the widget home page
langstringAn ISO 639-two-letter-code. With this configuration it is possible to force the widget lang. The widget will try to get the browser lang, if it is not possible it will use the default “en” lang
recipientIdstringEnable the widget to open a specific conversation
userFullnamestringCurrent user fullname. Set this parameter to specify the visitor fullname
userEmailstringCurrent user email address. Set this parameter to specify the visitor email address
persistencestringYou can specify how the Authentication state persists when using the Pingstreams JS SDK. This includes the ability to specify whether a signed in user should be indefinitely persisted until explicit sign out or cleared when the window is closed. Permitted values: local, session. Default value: local. Local value indicates that the state will be persisted even when the browser window is closed. An explicit sign out is needed to clear that state. Session value indicates that the state will only persist in the current session or tab, and will be cleared when the tab or window in which the user authenticated is closed
singleConversationbooleanThis property if true, allow you to transform widget from multi conversation channel to a single conversation channel (See more here)
typingLocationstringSet the location of the typing indicator between ‘header’ or ‘content’ locations. Default value:‘content’. Permitted values: ‘content’, ‘header’

These set of attributes modify the Widget style (i.e theme color, page position, etc.)

AttributeTypeDescription
alignstringMake the chat available on the Right or on the Left of the screen. Permitted values: ‘right’, ‘left’. Default value is right.
marginXstringSet the side margin, left or right depending on the align property. Default value: “20px”
marginYstringSet the distance from the page bottom margin. Default value: “20px”
mobileMarginXstringSet the side margin, left or right depending on the align property on mobile. Default value: “0px”. (See example here)
mobileMarginYstringSet the distance from the page bottom margin on mobile. Default value: “0px”. (See example here)
themeColorstringAllows you to change the main widget’s color (color of the header, color of the launcher button, other minor elements). Permitted values: Hex color codes(e.g. #87BC65) and RGB color codes (e.g. rgb(135, 188, 101))
themeColorOpacitynumber [0..100]Allows you to change opacity of the theme color in the widget’s backgrounds (color of the header, color of the home). Permitted values: numbers from 0 to 100. Default value: 50
themeForegroundColorstringAllows you to change text and icons’ color. Permitted values: Hex color codes (e.g. #425635) and RGB color codes (e.g. rgb(66, 86, 53))
launcherWidthstringAllow you to change launcher width dimension. Default value: “60px”
launcherHeightstringAllows you to change launcher height dimension. Default value: “60px”
baloonImagestringAllows you to change baloon image with custom image URL. Minimum size: 60x60px. Allowed image format: *.jpg, *.jpeg, *.jfif, *.JPG, *.JPE.
baloonShapestringAllows you to change baloon shape with custom dimension. Permitted values: string with four values (e.g. ‘10px 10px 10px 10px’), three values (e.g. ‘15px 50px 30px’), two values (e.g. ‘15px 50px’), one values (e.g. ‘15px’), percentage dimension (e.g. ‘10%’). Default value: “50%“.
fullscreenModebooleanIf it is true, the chat window is open in fullscreen mode. Default value: false

General settings for the widget

AttributeTypeDescription
allowTranscriptDownloadbooleanAllows the user to download the chat transcript. The download button appears when the chat is closed by the operator. Default value: false
allowReopenbooleanAllows you to continue writing in a conversation even if it was archived by an agent or the user himself. Default value: false
hideHeaderCloseButtonbooleanHide the close button in the widget header. The default value is false.
hideHeaderConversationOptionsMenubooleanEnable you to show/hide options menu in a conversation header. Default value: false
hideCloseConversationOptionMenubooleanEnable you to show/hide ‘Close chat’ menu option in conversation header top-right menu. Default value: false
hideRestartConversationOptionsMenubooleanEnable you to show/hide ‘Restart chat’ menu option in conversation header top-right menu. Default value: false
hideSettingsbooleanEnable you to show/hide options menu in home component. Default value: false
openExternalLinkButtonbooleanEnable you to open or not a link in an action button externally. Default value: true
showWaitTimebooleanShow the expected response time from your agents in the home widget window. Default value: true.
dynamicWaitTimeReplybooleanEnable you to decide whether or not to share the average response time of his team. Default value: true
showAvailableAgentsbooleanShow the available agents with avatar in the home widget window. Default value: true.
showLogoutOptionbooleanShow the logout options in the home widget window. Default value: false.
showAttachmentButtonbooleanEnable you to show/hide attachment button in the footer of a conversation. Default value: true
showAllConversationsbooleanEnable you to show/hide the list of all conversations. Default value: true
soundEnabledbooleanEnable you to allow or not sound when new message arrived. Default value: true
openbooleanSet the status of the widget: true(open) or false (close). If it is true the Widget suddenly opens right after loading. Default value: false
isLogEnabledbooleanEnable the widget log. The default value is false.
logLevelstringAllows you to change the level of the log. Value type: string. Permitted values: ‘ERR’ < ‘WARN’ < ‘INFO’ < ‘DEBUG’. Default value: ‘ERROR’
startFromHomebooleanIf false when loaded the widget starts directly with a new conversation. If true the widget shows the home component. Default value: true
autoStartbooleanSet if the widget performs an automatic anonymous authentication at the startup. Default value: true
startHiddenbooleanSet if the widget starts in hidden mode. Default value: false
preChatFormbooleanYou can require customers to enter information like name and email before sending a chat message by enabling the Pre-Chat form. Default value: false.
preChatFormJsonArrayYou can customize the information you request from customers in the pre-chat form before start a new conversation. (See docs)
customAttributesObjectYou can add customAttributes to widget as a key-value object. It is required to use ” ” for each key-value parameter. ‘userFullname’ and ‘userEmail’ special key allow you to set user info from external. See example above here for more detail
nativeRatingbooleanAllow you to show or not widget rating page. Default value: true
showInfoMessagestringYou can show/hide an info message in a conversion by specifying a comma separated list of keys. The keys in question are: ‘MEMBER_JOINED_GROUP’ to manage the information of when an agent is added to your conversion; ‘MEMBER_LEFT_GROUP’ to manage the information of when an agent left the conversation; ‘CHAT_CLOSED’ to manage the information of when a chat is closed; ‘CHAT_REOPENED’ to manage the information of when a chat already archived is subsequently reopened; ‘TOUCHING_OPERATOR’ to manage the information of when a conversation is assigned to an agent; ‘LEAD_UPDATED’ to manage an update of the widget user’s name and email. Ex: ‘MEMBER_JOINED_GROUP,CHAT_CLOSED’: allows you to see information about the joining of an agent within a conversation and when the current chat is archived. Default value: ‘MEMBER_JOINED_GROUP’
restartConversationbooleanThis property if true, only when singleConversation is enabled, allow you to start always a new conversation at each page refresh or widget restart. Default value: false
participantsbooleanThis property if true allow you to talk only with specific user passed as a comma separated list of ids. Ex: ‘ID_user1,ID_user2’
fileUploadAcceptstringThis define which file types is allowed to be upload by the user as an attachment. It takes as its value a comma-separated list of one or more file types. See more here. Default value: ‘image/*,.pdf,.txt’

These set of attributes modify the Widget style for messages (i.e. message background color, text color, buttons color etc.)

AttributeTypeDescription
bubbleSentBackgroundstringAllow you to change the bubble sent message background color. Permitted values: Hex color codes (e.g. #2a6ac1) and RGB color codes (e.g. rgb(42, 106, 193))
bubbleSentTextColorstringAllow you to change the bubble sent message text color. Permitted values: Hex color codes (e.g. #ffffff) and RGB color codes (e.g. rgb(255, 255, 255))
bubbleReceivedBackgroundstringAllow you to change the bubble received message background color. Permitted values: Hex color codes (e.g. #f7f7f7) and RGB color codes (e.g. rgb(247, 247, 247))
bubbleReceivedTextColorstringAllow you to change the bubble received message text color. Permitted values: Hex color codes (e.g. #1a1a1a) and RGB color codes (e.g. rgb(26, 26, 26))
fontSizestringallow you to change the font size of bubble messages. Permitted values: medium
buttonFontSizestringAllow you to change the font size of all the attachment buttons of a message. Permitted values: medium
buttonBackgroundColorstringAllow you to change the background color of all the attachment buttons of a message. Permitted values: Hex color codes (e.g. #1a1a1a) and RGB color codes (e.g. rgb(26, 26, 26))
buttonTextColorstringAllow you to change the text color of all the attachment buttons of a message. Permitted values: Hex color codes (e.g. #1a1a1a) and RGB color codes (e.g. rgb(26, 26, 26))
buttonHoverBackgroundColorstringAllow you to change the background color of all the attachment buttons of a message when when you mouse over them. Permitted values: Hex color codes (e.g. #1a1a1a) and RGB color codes (e.g. rgb(26, 26, 26))
buttonHoverTextColorstringAllow you to change the text color of all the attachment buttons of a message when when you mouse over them. Permitted values: Hex color codes (e.g. #1a1a1a) and RGB color codes (e.g. rgb(26, 26, 26))

*These properties if not provided will automatically be calculated starting from themeColor value

These set of attributes can manage the visibility of the widget on mobile and desktop platforms

AttributeTypeDescription
displayOnDesktopbooleanAllow you to display/hide widget on desktop. Default value: true
onPageChangeVisibilityDesktopstringAllow to decide the widget status (opened or closed) when the page is loaded or changed on web browser. You can always open the widget, always close the widget or restore the last status of it (if closed, stay close; if opened, open it). Permitted values: ‘open’, ‘close’, ‘last’. Default value: ‘close’
displayOnMobilebooleanAllow you to display/hide widget on mobile. Default value: true
onPageChangeVisibilityMobilestringAllow to decide the widget status (opened or closed) when the page is loaded or changed on web browser. You can always open the widget, always close the widget or restore the last status of it (if closed, stay close; if opened, open it). Permitted values: ‘open’, ‘close’, ‘last’. Default value: ‘close’

(available only in window.pingstreamsSettings object)

These set of attributes allow the owner to be reachable in their own social media channels (whatsapp business, facebook messenger page, telegram). Buttons, when available, will be shown at the bottom of the home page, as displayed below.

AttributeTypeDescription
whatsappNumberstringThis property allows the user of the widget to start a conversation on your official whatsapp business account
messangerPageTitlestringThis property allows the user of the widget to start a conversation on your official Facebook Page with Messenger
telegramUsernamestringThis property allows the user of the widget to start a conversation on your official Telegram account
AttributeTypeDescription
isShownstringThis property returns the visibility of the whole widget including the widget balloon. If true the widget is visible otherwise (false) the widget is hidden. Use window.pingstreams.show() and window.pingstreams.hide() methods to change the widget visibility

You can also pass the above configurations as a Url parameter with the pingstreams_ prefix. For example:

https://widget.pingstreams.com/v6/assets/twp/index.html?pingstreams_projectid=<YOUR_PROJECT_ID>&pingstreams_isOpen=true&pingstreams_align=right&project_name=Virtual%20Assistant

Example 1. Widget with user fullname and email

Section titled “Example 1. Widget with user fullname and email”
<script type="application/javascript">
window.pingstreamsSettings =
{
projectid: "6480a7f683b1e1001370a6b1",
userFullname: "Andrea Leo",
userEmail: "andrea@example.com"
};
(function(d, s, id) {
var w=window; var d=document; var i=function(){i.c(arguments);};
i.q=[]; i.c=function(args){i.q.push(args);}; w.Pingstreams=i;
var js, fjs=d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js=d.createElement(s);
js.id=id; js.async=true; js.src="https://widget.pingstreams.com/v6/launch.js";
fjs.parentNode.insertBefore(js, fjs);
}(document,'script','pingstreams-jssdk'));
</script>

Example 2. Widget with preChatForm and left alignment:

Section titled “Example 2. Widget with preChatForm and left alignment:”
<script type="application/javascript">
window.pingstreamsSettings =
{
projectid: "6480a7f683b1e1001370a6b1",
preChatForm: true,
align: 'left'
};
(function(d, s, id) {
var w=window; var d=document; var i=function(){i.c(arguments);};
i.q=[]; i.c=function(args){i.q.push(args);}; w.Pingstreams=i;
var js, fjs=d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js=d.createElement(s);
js.id=id; js.async=true; js.src="https://widget.pingstreams.com/v6/launch.js";
fjs.parentNode.insertBefore(js, fjs);
}(document,'script','pingstreams-jssdk'));
</script>

Widget allow you to pass some custom attributes as key-value object in window.pingstreamsSettings object or as a Url parameter with the pingstreams_customAttributes prefix.

<script type="application/javascript">
window.pingstreamsSettings =
{
projectid: "6480a7f683b1e1001370a6b1",
align: 'left',
customAttributes: {
"user_country": "Italy",
"user_code": "E001"
}
};
(function(d, s, id) {
var w=window; var d=document; var i=function(){i.c(arguments);};
i.q=[]; i.c=function(args){i.q.push(args);}; w.Pingstreams=i;
var js, fjs=d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js=d.createElement(s);
js.id=id; js.async=true; js.src="https://widget.pingstreams.com/v6/launch.js";
fjs.parentNode.insertBefore(js, fjs);
}(document,'script','pingstreams-jssdk'));
</script>

customAttributes is shown in conversation detail as payload key under attributes accordion as shown above

Set ‘userFullname’ or ‘userEmail’ special key to manage user information from external (e.g. from your mobile app after an internal login). Above example of how to set it:

<script type="application/javascript">
window.pingstreamsSettings =
{
projectid: "6480a7f683b1e1001370a6b1",
align: 'left',
customAttributes: {
"userFullname": "Andrea Leo",
"userEmail": "andrea@example.com"
}
};
(function(d, s, id) {
var w=window; var d=document; var i=function(){i.c(arguments);};
i.q=[]; i.c=function(args){i.q.push(args);}; w.Pingstreams=i;
var js, fjs=d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js=d.createElement(s);
js.id=id; js.async=true; js.src="https://widget.pingstreams.com/v6/launch.js";
fjs.parentNode.insertBefore(js, fjs);
}(document,'script','pingstreams-jssdk'));
</script>