Hi,
I am using Web messsenger chat I am trying to send message from Client Javascript when a CoBrowse session is initiated. I am making use of the "MessagingService.messagesReceived" event and checking if that is of typeEvent and want to send a privacy message to the user before they accept/decline the coBrowse session.
Can you guys please let me what is the issue. Below is the code.
Genesys("subscribe", "MessagingService.messagesReceived", function (o) {
if (o.data.messages[0].direction == "Outbound" && o.data.messages[0].events[0].eventType == "CoBrowse") {
//Send Message code here
}}
But I am unable to figure out the way to send the message in this event. Is there a command (like Genesys("command", "SendMessage")) which can be used to inject the message in chat.
Hi @maheshp93 what are you trying to solve by sending a message? Do feel current native in-app notification is not sufficient and want to add more informative wording?
The business requirement is to send a privacy notice before/after the native in-app notification. Something like "You are about to share your screen. Please read our privacy message before accept/decline". Something of that sort. This will include a hyperlink to the corporate privacy policy.
Thanks for this @Angelo_Cicchitto. Can you guys suggest a way to use the agent less API ( /api/v2/conversations/messages/agentless) from browse UI? It seems like this API requires OAuth token generated using client credentials which can't be generated from Browser UI. So, is it best to generate the token from backend and then return to UI for the browser to make use of this API?
@maheshp93 resources that require client credentials can never be used in a browser. Not only is it a very bad idea because you'd have to give out your client secret to the world, but the requests won't work in a browser because responses for requests made using a client credentials auth token won't have CORS headers.
To address this question directly, you must not do this. Transmitting an auth token in this manner is a violation of OAuth principles and constitutes mishandling of an auth token.
To use this API endpoint, you must run a headless locally (or on a remote server you control) that authorizes using the client credentials and then makes the request from the same application that generated the token. You could do this from a backend web server, but that server absolutely must not leak the auth token or client credentials to the web user or else your org may become compromised.