You need to sign in to do that
Don't have an account?
Pradeep Kumar (www.pradyblog.com)
Customize Live agent chat to send HTML, CSS and JS formatted content
I am building an Intelligent Assistance with Live Agent Chat. It automatically suggest possible answers to agent and Agent can just select any one (when agent select any response, it is sent to chat box) to send response to customer. There is a case of decision tree when Intelligent Assistance need to ask question in form of Yes or No from customer. I want to do this by rendering button or link for Yes / No to customer and when customer clicks on that a JavaScript function should be called to call a Web Service endpoint.
In Summary what i need (at agent chat box end) is to be able to send a HTML + CSS + JS formated text from Agent side of chat to Customer and Customer should be able to click on Yes / No link or button.
When i try pushing a HTML, CSS, JS formatted text automatically in chat at agent side, it is rendered to Agent as well as Customer chat window as text and not properly formatted. Any idea how to customize / custom code Live Agent chat to achieve this?
Please help!!
In Summary what i need (at agent chat box end) is to be able to send a HTML + CSS + JS formated text from Agent side of chat to Customer and Customer should be able to click on Yes / No link or button.
When i try pushing a HTML, CSS, JS formatted text automatically in chat at agent side, it is rendered to Agent as well as Customer chat window as text and not properly formatted. Any idea how to customize / custom code Live Agent chat to achieve this?
Please help!!
You can follow below code.
In above code,
"client" & "message" CSS classes can be used to handle the stylings of the chat and javascript function "mutationHandler" will be used to listen for the changes in the chat window so that new messages can be listened and then you can handle the new messages as you want.
In case you want to handle the html tags which will be coming from agen't side you need to add the code for that in the mutationHandler function.
Let me know in case if you need more help on this & please mark this as a solution if it fulfills the requirement.
Regards,
Ashish Kr.
All Answers
Hi Pradeep,
There are challenges in implementing the live agent as you want but it is very much possible if you try to implement the chat window using visualforce page.
The client side chat window will be implemented using the existing visualforce template and can customise that as per your need taking help of javascript and CSS.
When agent sends the text containing the html format salesforce automatically encodes the code due to security purpose and hence it converts it to plain text. However you can use custom CSS and javascript at client's chat window by adding a event listner for the new incoming or outgoing chat messages.
Let me know if you need some help with the code.
Regards,
Ashish Kr.
You can follow below code.
In above code,
"client" & "message" CSS classes can be used to handle the stylings of the chat and javascript function "mutationHandler" will be used to listen for the changes in the chat window so that new messages can be listened and then you can handle the new messages as you want.
In case you want to handle the html tags which will be coming from agen't side you need to add the code for that in the mutationHandler function.
Let me know in case if you need more help on this & please mark this as a solution if it fulfills the requirement.
Regards,
Ashish Kr.
Thanks for sharing all this knowledge!