Issues implementing Genesys Cloud Messenger

Hello,

I'm trying to implement Messenger deployment in our demo environment in order to make a PoC for cusotmers, but I'm havin issuen when I try to implement it.

Here is the Code of the POC:

Nexia PoC
<script type="text/javascript" charset="utf-8">
  (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: 'prod-euw1',
	deploymentId: 'deploymentId',
	debug: true
  });
</script>

<script type="text/javascript">
  function toggleMessenger(){
	Genesys("command", "messenger.open", {},
	  function(o){},  // if resolved
	  function(o){    // if rejected
		Genesys("command", "messenger.close");
	  }
	);
  }
</script>
Messenger

When I try to open a chat, this is the error I get:

Can you please, help me?

Thank you.

Regards.

Hi @Hector_Martin,

Before calling a Messenger command, please subscribe to its ready event and then call Messenger.open inside it. Calling it early can result in this way because the plugin is not yet registered and still loading.

In our developer docs, please see the "Note" at the very top and example code. Let us know if this is helping.

Hello,

I've done it, but the code never subscribe to the event. I guess something is missing. Do you have a basic HTML code that works so that I can adapt it to our organization and test it?

Regards.

Hi @Hector_Martin,

Here is a sample running code that I put in jsfiddle - Edit fiddle - JSFiddle - Code Playground. Take a look at this. I added a custom button "Open Messenger" simulating your code that opens Messenger when you click on it.

One item to mention: From your snippet above, I see deploymentId: 'deploymentId', - I assume you hidden the actual value here so it is not visible here in public, but just to mention it must be the actual value of your deployment. About how to create deployment, you can refer to this article - Deploy Messenger - Genesys Cloud Resource Center.

If you are still not able to get this running, please provide us access to your code or any sample running code I can take a quick look.

1 Like

Hello @Ranjith_Manikante_Sa ,

Thank you for your help, If I change the deploymentID and the environment in your jsfiddle code, it works perfectly. However, when I implement it in my files, the trace "Messenger wait why Messenger is initializing and try again." is always appearing.

I've two files, EjemploMessenger_DescargadoDeveloper.html with code:

EjemploMessenger_DescargadoDeveloper.html

And the Javascript file, EjemploMessenger_DescargadoDeveloper.js, with code:

EjemploMessenger_DescargadoDeveloper.js

I'm not sure if I'm doing anything wrong or what's happening in here.

Thank you.

Regards.

Hi @Hector_Martin,

I couldn't see EjemploMessenger_DescargadoDeveloper.js file being fetched at all when I opened EjemploMessenger_DescargadoDeveloper.html in the browser. When I inspected the network logs, it doesn't show your .js file being fetched at all. Is this a live example that you are trying to show? If so, you need to make sure that this js file is loaded and executed on page load. This will initialize the Messenger and have it ready for you to accept running the command. Now, when you click on "Open Messenger" button that calls the Messenger.open command which opens Messenger.

If you are still running into issues, I would recommend to work the care team who can work with you and help you in setting it up.

Hello, we have published the html under one of our domains and it works. It only fails when I run the code locally. Is there any limitation in this way?

Thank you for all your help.

Regards

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.