Javascript API
You can communicate with Coview and control the chat widget through the provided JavaScript API.
start
Initiates the chat widget on the current page.
projectKey
property is required, see "Page settings" for more options.
coview('start', {
projectKey<string>: 'YOUR_UNIQUE_PROJECT_KEY'
})
clearSession
Clears current user session. This is useful when a user logs out of your application and should not see their previous conversations. It will also stop Coview on the current page.
coview('clearSession');
stop
Stops Coview from running on the current page.
coview('stop')
updateUser
You can call this method if you want to create / update a profile for initially unidentified user after the conversation has begun.
One-step profile creation
Alternatively, you can provide user's name and email (if you know them) before a chat starts when calling the
start()
method. See "Identifying your users" for more details.
coview('updateUser', {
id<string>: 'secure_user_id',
email<string?>: '[email protected]',
name<string?>: 'user_name',
})
showChatButton
Displays the chat icon in the bottom right corner of the page. Counterpart of the hideChatButton()
method.
If a user has unread messages or receives a new message from an agent, the chat button with the message notification appears and stays until the user clicks on it. Icon will disappear when they close the chat or reload the page.
coview('showChatButton')
Default settings
By default, the chat icon appears on the webpage once it has finished loading. If you'd like to hide it instead on the initialization, you can set the
chat.showButton
property tofalse
in options when calling thestart()
method.
hideChatButton
Hides the chat icon from view. Counterpart of the startChatButton()
method.
coview('hideChatButton')
openWidget
Calling this method simulates a user click on the chat icon and leads to one of two possible outcomes:
- If a customer is in the middle of the conversation with an agent, the chat window will open
- If there is no ongoing conversation, the feedback widget will pop up, offering the possibility to send message and use any of the available visual communication tools.
coview('openWidget')
closeWidget
Calling this method is equivalent to a user closing the widget on their own.
If the chat.showButton
property is set to false
, the chat button will be hidden - as long as the user doesn't have an ongoing conversation.
coview('closeWidget')
screenshot
Activates the screenshot tool.
coview('screenshot')
screencast
Activates the screen recording tool.
coview('screencast')
screensharing (co-browse)
Sends an on-screen help request and immediately starts a co-browsing session session.
coview('screenshare')
select
Highlights DOM element based on the provided selector. Selections outside of the current page will cause a redirect.
coview('select', selectionId<string>)
Updated over 4 years ago