faisyou | 2023-02-01 08:28:50 UTC | #1
Hi, I am using the following Code Snippets
(function (g, e, n, es, ys) { g['_genesysJs'] = e;
g[e] = g[e] | | function () { |
(g[e].q = g[e].q | | []).push(arguments) |
}; g[e].t = 1 * new Date(); g[e].c = es; ys = document.createElement('script'); ys.async = 1; ys.src = n; ys.charset = 'utf-8'; document.head.appendChild(ys); })(window, 'Genesys', 'https://apps.mypurecloud.ie/genesys-bootstrap/genesys.min.js', { environment: 'euw1', deploymentId: 'XXXX-XXX-XXXX-XXXX' });
function onMessagingServiceReady() { console.log('MessagingServiceReady'); console.log('Setting up Subscriptions');
Genesys("subscribe", "MessagingService.started", function({data}){ console.log("MessagingService.start:"+JSON.stringify(data)); console.log("Sending a Message"); Genesys("command", "MessagingService.sendMessage", { message: "hi there!" }); });
Genesys("subscribe", "MessagingService.messagesReceived", function({ data }) { console.log("MessagingService.messagesReceived"+JSON.stringify(data)); });
console.log('Extracting Configuration');
Genesys("registerPlugin", "Plugin", function(Plugin) { Plugin.command("GenesysJS.configuration").then( (data) => { console.log("Deployment configuration:"+ JSON.stringify(data)); console.log("Now Conversation Can Start...."); console.log('Invoking Start Conversation'); Genesys("command", "MessagingService.startConversation",data,()=> {console.log("conversation Started Success")},()=> {console.log("conversation Start Error")});
} ); });
}
Genesys("subscribe", "MessagingService.ready",onMessagingServiceReady());
Can you guide me with my mistake
RanjithManikanteSa | 2023-02-03 18:25:03 UTC | #2
Hi @faisyou,
This is a bug on our side that we are correcting it. The MessagingService.ready event is being published too early while it's still registering the commands. Since this command is being called immediately, it's unable to find it. We will resolve this asap, no changes will be required on your side.
Workaround:
If needed, in the meantime the workaround would be to delay calling MessagingService.startConversation command inside your onMessagingServiceReady() callback. One example is you can wrap it with setTimeout().
setTimeout(function() { Genesys("command", "MessagingService.startConversation",data,()=> {console.log("conversation Started Success")},()=> {console.log("conversation Start Error")}); }, 500); // workaround, delay calling
Let me know if any, thanks.
system | 2023-03-05 18:25:46 UTC | #3
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 18214