Receiving Information from Customerly Live Chat

If you'd like to send Customerly events to an outside platform or customize Customerly using specific events, you can use our Live Chat API.

Luca Micheli
Written by Luca MicheliLast update 2 years ago

If you'd like to send Customerly events to an outside platform or customize Customerly using specific events, you can use our Live Chat API.

First Inizialize your Customerly Live Chat script.

These are the callbacks you can use as you need.

onLeadGenerated

If you want to be notified from the live chat when someone instances a new conversation with you, you can use the onLeadGenerated callback.

The function returns:

  • email: the lead's email inserted into the live chatbox. (if present, otherwise will be nil)

customerly.onLeadGenerated = function(email) { … }

onChatOpened

The onChatOpened callback will be triggered when the client opens the chat window. Ideal if you want to control the live chat icon after they open the chat window. (To control the chat window please refer to the tutorial here)

customerly.onChatOpened = function() { … }

onChatClosed

The onChatClosed callback will be triggered when the client closes the chat window. Ideal if you want to hide the live chat icon after they close the chat window. (To close the chat window please refer to the tutorial here)

customerly.onChatClosed = function() { … }

onNewConversation

The onNewConversation callback will be triggered when a user or a lead start a new conversation. Ideal if you want to track in Google Analytics or other analytics service you use the pages with more conversation opened.

The function returns:

  • message: The string with the message just sent.

  • attachments: is a list of dictionaries with the content of the attachments added to the message.

customerly.onNewConversation = function() { … }

onProfilingQuestionAnswered

The onProfilingQuestionAnswered callback will be triggered when the lead answer to any of the profiling questions. 

The function returns:

  • attribute: The attribute for the related question asked

  • value: the answer the lead left.

customerly.onProfilingQuestionAnswered = function(attribute, value) { … }

onProfilingQuestionAsked

The onProfilingQuestionAsked callback will be triggered when any of the profiling questions have been shown to the visitor.

The function returns:

  • attribute: The attribute for the related question asked

customerly.onProfilingQuestionAsked = function(attribute) { … }

onRealtimeVideoAnswered

The onRealtimeVideoAnswered callback will be triggered when the client answers a Realtime Video Call.

customerly.onRealtimeVideoAnswered = function() { … }

onRealtimeVideoRejected

The onRealtimeVideoRejected callback will be triggered when the client rejects a Realtime Video Call.

customerly.onRealtimeVideoRejected = function() { … }

onHelpCenterArticleOpened

The onHelpCenterArticleOpened callback will be triggered when the client opens a Help Center Article within the live chat widget.

The function returns:

  • article: The article the client opened.

The article payload consists in:

  • account: Account

  • body: string

  • collection: Collection

  • created_at: number

  • description: string

  • knowledge_base_article_id: number

  • slug: string

  • title: string

  • updated_at: number

customerly.onHelpCenterArticleOpened = = function(article) { … }

Did this answer your question?