HOW-TO: LiveConnect Web Chat Widget
What’s on this page?
- Overview
- Install LiveConnect Web Chat widget on your website
- Configure LiveConnect Web Chat widget
Overview
Tulip LiveConnect Web Chat Widget connects customers visiting your e-commerce sites with retail store associates who are using the Tulip LiveConnect app on their iPhone or iPad.
Retailers can install the Web Chat widget on their e-commerce site to enable customers to chat with a local store associate while shopping on the site. The chat widget can be configured and customized to fit the retailer’s brand style guidelines.
Description of functionality
When a customer opens the chat widget for the first time, they’re prompted to provide their name and other configurable contact details. After providing their details, the customer will automatically be entered into the chat routing workflow to get connected to an associate at a nearby store.
Once a customer is successfully routed to a store’s Chat Requests queue, any associate from the store will be able to Accept the message and begin chatting with the customer. Customers can send text and upload photos through the web chat widget to communicate with the store associate.
All messages from web chat are indicated as such in the conversation window and in the conversations list, so associates will be able to clearly differentiate conversations on web chat from other channels.
Install LiveConnect Web Chat widget on your website
You can install this widget either via npm
, using Google Tag Manager, or linked in HTML.
Prerequisites: Package Manager
Include the package in your project using npm
:
npm i @tulipnpm/livechat@latest
Recommended option: Install using Google Tag Manager
Many e-commerce websites use Google Tag Manager to inject third-party JavaScript into their pages. This is the recommended distribution method of LiveConnect Web Chat.
To install LiveConnect using Google Tag Manager, complete the following steps:
- Open Google Tag Manager and select your e-commerce site’s account.
- Create a new Tag of type Custom HTML.
- Paste the following code in the tag. Replace <INTEGRATION_ID> with your integration ID. Additional configurations can be made in the
lwc_config
object. - Create a Trigger for DOM Ready and link it to your Tag.
- Name and save the Tag.
- Preview and publish your changes.
<script src="https://cdn.jsdelivr.net/npm/@tulipnpm/livechat@latest/dist/tuliplivechat.min.js"></script>
<script>
tuliplivechat.init({ integrationId: '<INTEGRATION_ID>' });
</script>
Alternate option: Embed LiveChat directly into HTML
<script src="https://cdn.jsdelivr.net/npm/@tulipnpm/livechat@latest/dist/tuliplivechat.min.js"></script>
Initiate the chat widget
Use the following configuration to initiate the chat widget:
tuliplivechat.init({ integrationId: '<INTEGRATION_ID>' });
Configure LiveConnect Web Chat widget
Configuration options are provided when initializing the widget with init({..})
The integrationId
is also a configuration option. It identifies your widget to Tulip. Tulip provides you with this value when you purchase Tulip LiveConnect Web Chat.
Sample configuration code
var lwc = tuliplivechat;
var config = {
integrationId: '<INTEGRATION_ID>',
displayStyle: 'button',
imageUploadEnabled: true,
fixedIntroPane: false,
buttonIconUrl: 'https://retailer.com/logo.png',
buttonWidth: '58px',
buttonHeight: '58px',
businessName: 'Retailer',
businessIconUrl: 'https://retailer.com/logo.png',
customColors: {
brandColor: 'ee3d50',
conversationColor: '151043',
actionColor: '333333',
contactUsButtonColor: '452BD6'
},
contactUsButtonUrl: 'https://retailer.com/contact',
};
lwc.init(config);
Configuration options
Option | Required or Optional | Default value | Description |
businessIconUrl | Optional | A custom business icon url. The image must be at least 200 x 200 pixels and must be in either JPG, PNG, or GIF format. | |
businessName | Optional | A custom business name | |
buttonHeight | Optional | 58px | When the displayStyle is button, you have the option of specifying the button height. |
buttonIconUrl | Optional | When the displayStyle is button, you have the option of selecting your own button icon. The image must be at least 200 x 200 pixels and must be in either JPG, PNG, or GIF format. | |
buttonWidth | Optional | 58px | When the displayStyle is button, you have the option of specifying the button width. |
contactUsButtonUrl | Optional | Link to a Contact Us page | |
customColors | Optional | See detail below | Colors used in the LiveConnect Web Chat UI. |
customText | Optional | See details below | Language and text used in the LiveConnect Web Chat UI. |
displayStyle | Optional | button | Choose how the widget will appear on your website. Must be either 'button' or 'tab'. When tab selected, it’ll appear as a pane at the bottom. |
fixedIntroPane | Optional | false | When enabled, the introduction pane will be pinned at the top of the conversation instead of scrolling with it |
imageUploadEnabled | Optional | true | Enables the image upload feature. (deprecated: use menuItems.imageUpload; if this option is false, it will disable menuIt ems.imageUpload and menuItems.fileUpload) |
prechatCapture | Optional | See detail below | Enables automatically capturing a user's name and email via a form before the start of a conversation. Disables the chat input until the form has been submitted. |
browserStorage | Optional | localStorage | See details below. Controls the longevity of the users session. Options are either localStorage or sessionStorage |
soundNotificationEnabled | Optional | false | When enabled, plays a notification sound when the user receives a message |
awayMode | Optional | See details below | Controls the behaviour when an associate is unresponsive to a customer |
integrationOrder | Required | Order of third party integrations to connect to during away mode. Speak to Tulip to get the identifiers for each integration | |
afterLoadCallback | Optional | A method that can be run after the initalization of a widget | |
saveOpenState | Optional | true | When enabled, will open or close the chat window based on the state of the chat window on the previous page |
cssOverwritePath | Optional | Path to a CSS file that can be applied to the chat window and widget. See below for details | |
supportedLanguages | Optional | All supported languages | See details below |
fallbackLanguageCode | Optional | en-US | See details below |
Child options of customColors
Option | Required or Optional | Default value | Description |
brandColor | Optional | ee3d50 | This color will be used in the messenger header and the button or tab in idle state. Must be a 3 or 6-character hexadecimal color. |
conversationColor | Optional | 151043 | This color will be used for customer messages, quick replies and actions in the footer. Must be a 3 or 6-character hexadecimal color. |
actionColor | Optional | 333333 | This color will be used for call-to-actions inside your messages. Must be a 3 or 6-character hexadecimal color. |
Capture user data before chat start
Prechat Capture allows you to capture a user’s data, like name and email, before the start of a conversation.
When configured, the chat input is initially disabled and the user is greeted by a welcome message and a form asking for their name.
Once the form is successfully submitted, a thank you message is sent to the user and the conversation is then initialized, connecting the user to your business.
Option | Description |
prechatCaptureGreetingText | Text for the initial greeting message. |
prechatCaptureNameLabel | Label displayed for the default form's first field. |
prechatCaptureNamePlaceholder | Placeholder for the default form's first field. |
prechatCaptureEmailLabel | Label displayed for the default form's second field. |
prechatCaptureEmailPlaceholder | Placeholder for the default form's second field. |
prechatCaptureConfirmationText | Text for the confirmation message sent when the form is completed. |
prechatCaptureMailgunLinkingConfirmation | Text for the notification message when a user has linked their email address. |
Child options of prechatCapture
Option | Required or Optional | Default value | Description |
enabled | Optional | true | Enables the prechat capture experience. |
fields | Optional | Overrides the default Prechat Capture fields. |
Attributes of prechatCapture.fields
Attribute | Required or Optional | Description |
type | Required | Specifies the type of field. Options are text, email, select |
name | Required | Specifies the name of the field. Each field name must be unique per form. Maximum length of 128 characters. |
label | Required | Specifies what label the field will be displayed with. Maximum length of 128 characters. |
placeholder | Optional | Specifies the placeholder text of the field that will be rendered. Maximum length of 128 characters. |
minSize | Optional | Text field only. Specifies the minimum possible length of the response. Defaults to 1 if not specified. |
maxSize | Optional | Text field only. Specifies the maximum possible length of the response. Defaults to 128 if not specified. |
options | Optional | Select field only. Array of option objects (see below) that can be selected. The array is limited to 20 options. |
Sample code: prechatCapture
configuration
config.prechatCapture: {
enabled: true,
enableEmailLinking: true,
fields: [
{
type: 'email',
name: 'email',
label: 'prechatCaptureEmailLabel',
placeholder: 'prechatCaptureEmailPlaceholder',
},
{
type: 'text',
name: 'name',
label: 'prechatCaptureNameLabel',
placeholder: 'prechatCaptureNamePlaceholder',
},
{
type: 'select',
name: 'country',
label: 'prechatCaptureCountryLabel',
placeholder: 'prechatCaptureCountryPlaceholder',
options: [
{
name: 'us',
label: 'United States',
},
{
name: 'ca',
label: 'Canada',
},
],
}
]
}
Overriding default text
In order to override the text that you set in a prechatCapture configuration, you must have a customText configuration as well. For more details, see
Customizing UI Text. The value of the label or placeholder must match the key of whatever is in the customText
configuration for it to change.
For example: if you wanted to change the name
object in the fields list of a prechatCapture
config and you wanted to customize the label
’s text in two different languages, you would have an additional config that would look like:
config.customText: {
'en-US': {
prechatCaptureNameLabel: 'this is an overridden name label',
}
'fr': {
prechatCaptureNameLabel: 'ceci est une étiquette de nom remplacée',
}
}
Note: The key prechatCaptureLabel
is the same as the value in the config.preCapture
object for the name
label. If they don’t match, it displays the text of whatever the value is in the prechatCapture
object. If they match, then the text is customized based on what language the user is in.
Default prechatCapture
configuration code
{
enabled: true,
fields: {
type: 'text',
name: 'name',
label: 'prechatCaptureNameLabel',
placeholder: 'prechatCaptureNamePlaceholder'
}
}
Handle situations when store associates are unavailable
When enabled, away mode will display a message to the user informing them that there are no associates able to chat currently after a certain period of time without a response. Away mode takes in two object arguments: pooledConversations
and assignedConversations
. The split in configurations is to allow for different behaviour between conversations that are assigned to an associate and ones that have not been accepted by anyone.
The customer can also be prompted to transfer the conversation to a third party integration. This enables the conversation to continue off of the web chat. If a conversation is switched to a third party channel, the away messages are not sent.
Attribute | Required or Optional | Default value | Description |
enabled | Optional | false | When enabled, it will turn on away mode polling. |
unresponsiveTime | Optional | null | Number of seconds without a message from an associate before showing the away mode message for conversations. |
showChannelSwitchPrompts | Optional | true | Controls whether to show the prompt to move conversation to a third party channel or not. |
Sample code: Away Mode configuration
awayMode: {
pooledConversations: {
enabled: true,
unresponsiveTime: 60,
showChannelSwitchPrompt: true
},
assignedConversations: {
enabled: true,
unresponsiveTime: 600,
showChannelSwitchPrompt: false
}
}
Modify user identity storage behavior of browsers
By default, LiveConnect Web Chat will store the identity of users in the localStorage
of the browser. Using localStorage
will persist the user identity throughout browser sessions, including page reloads and browser restarts.
To clear the user identity once the browser is closed, use sessionStorage
instead. To learn more about Web Storage, see Web Storage API reference on Mozilla.org.
Activate embedded mode
As described above, to activate the embedded
mode, call the embed
method after running your init
function. This method accepts the DOM ID of the element which will be used as the container where the widget will be rendered. The embedded widget will take the full width and height of the container.
tuliplivechat.init({
integrationId: '<integration-id>'
});
tuliplivechat.embed('chat-container');
Use custom CSS
To apply your own custom CSS to our default elements, we allow for passing in a URL to a hosted CSS file using the cssOverwritePath
configuration. This CSS file will be added to the styles used on the widget as well as the chat window. Changes to the styling can be made by using the classes and IDs on the HTML elements that already exist and modifying the properties.
For example, if you wanted to make the chat window have no border radius you could apply the following to your hosted CSS file.
#container #wrapper {
border-radius: 0px !important;
}
API reference
You can interact with the chat widget using the following exposed methods:
openChatWindow
closeChatWindow
removeChatWidget
hideChatBubble
showChatBubble
isConversationActive
setChatWindowStyle
openChatWindow
Opens the conversation widget. This method takes an optional boolean parameter. If the parameter is true, we will open the chat window and if it is false, we will close the chat window.
tuliplivechat.openChatWindow();
tuliplivechat.openChatWindow(true);
tuliplivechat.openChatWindow(false);
closeChatWindow
Closes the conversation widget.
tuliplivechat.closeChatWindow();
removeChatWidget
Removes the chat widget from the DOM. Will need to be re-initialized if needed again.
tuliplivechat.removeChatWidget();
hideChatBubble
Hides the chat widget from the DOM by changing the display on #web-messenger-container
.
tuliplivechat.hideChatBubble();
showChatBubble
Shows the chat widget to the DOM by changing the display on #web-messenger-container
to block. Does not make the chat widget appear after running removeChatWidget
. This method takes an optional boolean parameter. If the parameter is true, we will show the chat bubble and if it is false, we will hide the chat bubble.
tuliplivechat.showChatBubble();
tuliplivechat.showChatBubble(true);
tuliplivechat.showChatBubble(false);
isConversationActive
Returns a boolean whether the current conversation is active or not.
tuliplivechat.isConversationActive();
setChatWindowStyle
Takes in an object of CSS key to value pairs and applies the styles to the chat window.
tuliplivechat.setChatWindowStyle({
height: '90%',
padding-left: '10%'
});
Customizing UI text
Below is the list of customizable text strings that can be modified.
If an option is not given a custom string, the default value will be used.
Option | Default value |
actionPostbackError | An error occurred while processing your action. Please try again. |
awayModeMessageAssigned | Hi {customerName}, I am currently unavailable to respond to your message. If you leave your phone number, I will get back to you as soon as possible. |
awayModeMessagePooled | Hi {customerName}! It appears that none of our associates are currently available. If you'd like to leave us a message and your phone number, an associate will get back to you as soon as possible. |
clickToRetry | Message not delivered. Click to retry. |
clickToRetryForm | Form not submitted. Click anywhere on the form to retry. |
connectNotificationSingleButtonText | Switch to |
connectNotificationOthersText | others |
contactUsButtonText | Contact Us |
conversationTimestampHeaderFormat | MMMM D YYYY, h:mm A |
couldNotConnect | Couldn't connect. You can {retry}. |
couldNotConnectInner | retry connecting now |
couldNotConnectWithRetry | Couldn't connect. We'll keep retrying, or you can {retry}. |
couldNotConnectWithRetryInner | try now |
emailChangeAddress | Change my email |
emailDescription | To be notified by email when you get a reply, enter your email address. |
emailFieldLabel | Your email |
emailFieldPlaceholder | Your email address |
emailFormButton | Continue |
fetchHistory | Load more |
fetchingHistory | Retrieving history... |
fileTooLargeError | Max file size limit exceeded ({size}) |
fileTypeError | Unsupported file type. |
formErrorInvalidEmail | Email is invalid |
formErrorNoLongerThan | Must contain no more than ({characters}) characters |
formErrorNoShorterThan | Must contain at least ({characters}) characters |
formErrorUnknown | This doesn't look quite right |
formFieldSelectPlaceholderFallback | Choose one... |
frontendEmailChannelDescription | To talk to us using email just send a message to our email address and we'll reply shortly: |
headerMessage | Start chatting live with an associate, or reach out to customer support using the link below. |
headerText | How can we help? |
imageClickToReload | Click to reload image. |
imageClickToView | Click to view {size} image. |
imagePreviewNotAvailable | Preview not available. |
inputPlaceholder | Type a message... |
inputPlaceholderBlocked | Complete the form above... |
introAppText | Message us below or from your favourite app. |
introductionText | We're here to talk, so ask us anything! |
linkError | An error occurred when attempting to generate a link for this channel. Please try again. |
messageError | An error occurred while sending your message. Please try again. |
messageIndicatorTitlePlural | ({count}) New messages |
messageIndicatorTitleSingular | ({count}) New message |
messageRelativeTimeDay | {value}d ago |
messageRelativeTimeHour | {value}h ago |
messageRelativeTimeJustNow | Just now |
messageRelativeTimeMinute | {value}m ago |
messageTimestampFormat | h:mm A |
messageSending | Sending... |
messageDelivered | Delivered |
messengerChannelDescription | Connect your Facebook Messenger account to be notified when you get a reply and continue the conversation on Facebook Messenger. |
notificationSettingsChannelsDescription | You can also talk to us from your favourite app or service. |
notificationSettingsChannelsTitle | Other Channels |
notificationSettingsConnected | Connected |
notificationSettingsConnectedAs | Connected as {username} |
prechatCaptureGreetingText | Please fill out the form to get connected with an associate. |
prechatCaptureNameLabel | Name |
prechatCaptureNamePlaceholder | Enter your name |
prechatCaptureEmailLabel | |
prechatCaptureEmailPlaceholder | name@company.com |
prechatCaptureConfirmationText | Thanks! We are attempting to find an associate for you. |
prechatCaptureMailgunLinkingConfirmation | You'll be notified here and by email at {email} once we reply. |
sendButtonText | Send |
settingsHeaderText | Settings |
shareLocation | Share location |
smsBadRequestError | We were unable to communicate with this number. Try again or use a different one. |
smsCancel | Cancel |
smsChangeNumber | Change my number |
smsChannelDescription | Connect your SMS number to be notified when you get a reply and continue the |
smsChannelPendingDescription | Check your messages at {number} to confirm your phone number. |
smsContinue | Continue |
smsInvalidNumberError | Your phone number isn't valid. Please try again. |
smsLinkCancelled | Link to {appUserNumber} was cancelled. |
smsLinkPending | Pending |
smsPingChannelError | There was an error sending a message to your number. |
smsSendText | Send me a text |
smsStartTexting | Start Texting |
smsTooManyRequestsError | A connection for that number was requested recently. Please try again in |
smsTooManyRequestsOneMinuteError | A connection for that number was requested recently. Please try again in 1 minute. |
smsUnhandledError | Something went wrong. Please try again. |
tapToRetry | Message not delivered. Tap to retry. |
tapToRetryForm | Form not submitted. Tap anywhere on the form to retry. |
unsupportedMessageType | Unsupported message type. |
unsupportedActionType | Unsupported action type. |
uploadInvalidError | Invalid file. |
uploadPhoto | Upload photo. |
uploadVirusError | A virus was detected in your file and it has been rejected |
Localization
Customizable strings in customText
can be localized. They are contained in an object that has the locale as its key.
var textValues = {
'en-US': {
headerText: 'Hello!'
},
'fr-FR': {
headerText: 'Bonjour!'
}
};
The browser’s language (navigator.language
) is used to determine which translation to provide. en-US
is the fallback default.
Supported languages
Language | Code |
English (USA) - Default | en-US |
German | de |
French | fr |
French (Canadian) | fr-CA |
Spanish | es |
Italian | it |
Japanese | ja |
Korean | ko |
Portuguese | pt |
Chinese (Simplified) | zh-CN |
Chinese (Hong Kong) | zh-HK |
Chinese (Taiwan) | zh-TW |
Change supported languages
By default, all the languages above are supported by the web chat widget. If you only want to support a specific set of languages, simply include the supportedLanguages field with an array of the language codes you want to continue to support. If the customer’s browser is not in a language that is supported, the widget will default to the fallbackLanguageCode.
NOTE: The fallback language code must be included in the supported languages array
tuliplivechat.init({
integrationId: '<INTEGRATION_ID>',
fallbackLanguageCode: 'fr'
supportedLanguages: ['fr', 'it', 'de']
});
Sample code: customizing strings
var textValues = {
'en-US': {
prechatCaptureGreetingText: 'Please fill out the form to get connected with a fashion advisor.',
prechatCaptureConfirmationText: 'Thanks for that, so good. We are attempting to find a fashion advisor for you.',
headerText: 'Haute Couture Inc.'
}
};
tuliplivechat.init({
integrationId: '<INTEGRATION_ID>',
customText: textValues
});
Customize the Contact Us button
To change the text above the ‘Contact Us’ button, modify the headerMessage
key in your custom text overwrites. You can also change the text of the button by changing the contactUsButtonText
key.
var textValues = {
'en-US': {
headerMessage: 'Custom text above button.',
contactUsButtonText: 'Click here for service'
}
};
tuliplivechat.init({
integrationId: '<INTEGRATION_ID>',
customText: textValues
});
If you do not want a ‘Contact Us’ button, simply remove the contactUsButtonUrl
from the widget configuration. Now, instead of showing the button, we will show the text configured for introductionText
.