Configure start a conversation button in CHAT WINDOW

Kri
Tera Guru

I want to configure 'Start a conversation' button in CHAT WINDOW, if we click on that button it should connect to LIVE AGENT, I also want to remove the Virtual Agent message while clicking on the button

Krishna124_0-1686909128697.png

 

1 ACCEPTED SOLUTION

I can close this thread. I think I'm replying your message in the other thread

 

View solution in original post

3 REPLIES 3

Riya Verma
Kilo Sage
Kilo Sage

Hi @Kri ,

 

Hope you are doing great.

 

To achieve this, we need to make some configurations in the ServiceNow instance.

  1. modify the Chat Queue record to ensure that it is associated with a live agent group
  2. we need to customize the chat widget to remove the Virtual Agent message and update the behavior of the 'Start a conversation' button. You can achieve this by modifying the widget codeJavaScript code to remove the Virtual Agent message:

 

// Remove Virtual Agent message
function removeVirtualAgentMessage() {
   var chatContainer = document.getElementsByClassName('chat-container')[0];
   var virtualAgentMsg = chatContainer.getElementsByClassName('chat-agent-msg')[0];
   
   if (virtualAgentMsg) {
      chatContainer.removeChild(virtualAgentMsg);
   }
}

addLoadEvent(removeVirtualAgentMessage);

 

  • To update the behavior of the 'Start a conversation' button, you can use the ServiceNow Client Script. Here's an example of the JavaScript code:

 

// Update 'Start a conversation' button behavior
function updateStartConversationButton() {
   var startButton = document.getElementById('chat-start-button');
   
   if (startButton) {
      startButton.onclick = function() {
         // Connect to live agent
         // Add your code here to connect with the live agent
      };
   }
}

// Call the function to update the 'Start a conversation' button when the widget is loaded
addLoadEvent(updateStartConversationButton);

 

Please mark the appropriate response as correct answer and helpful, This may help other community users to follow correct solution.
Regards,
Riya Verma

Mark Roethof
Tera Patron
Tera Patron

Hi there,

 

I don't think that is an option with limited development work. So maybe don't go this road.

 

Question: what is the why behind this?

 

Kind regards,
Mark

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

I can close this thread. I think I'm replying your message in the other thread