TypeError: client.on is not a function
Posted Mar 05, 2023
Hi Team,
I have loaded Zendesk SDK using https://static.zdassets.com/zendesk_app_framework_sdk/2.0/zaf_sdk.min.js and after load ZAFClient object is returned. However init method does not return client object instead returns false.
Code Snippet as follows:
const client = window.ZAFClient.init();
client.on('voice.dialout', function appRegistered(e: any) {
console.log("test");
});
Please suggest what should be done to get proper client object.
1
18
18 comments
Eric Nelson
Unfortunately, I'm not available for a call. I'd suggest opening up a support ticket so that we can review your actual application's code and provide feedback on your ZAF implementation.
0
Balaji
Hi Eric,
Will it be possible to setup a call? So that I can explain it in better way.
0
Balaji
The application I am running in my local now is our actual application which has login and logout functionality. Where first time I get app_guid automatically in URL but when I do logout and login the I do not get app_guid.
If I store old app_guid and use it, then also it is not working.
When I reload whole Zendesk application again then it gets started working again.
0
Balaji
Hi Eric,
The screenshot given below if showing localhost URL for the application running on my local. This was the dummy application we created without login and logout functionality.
We did not install this app from marketplace. We are referring to app URL running on my local.
0
Eric Nelson
Hey Balaji,
This screenshot is of the settings of an app being installed in Zendesk. Based on what you've told me this isn't your react app. What is this app called? Did you install it from the marketplace?
0
Balaji
Hi Eric,
By "logout/login" I am referring to logging out/in from our application and not Zendesk.
The screenshot I put up there is a simple react application running in local.
We have not deployed the app anywhere (like aws) yet as development is not complete, so using running it in local and using it there in Zendesk.
We are not using manifest.json file. Is it mandatory?
I will go through the document you shared.
0
Eric Nelson
A couple of things:
When you're saying "logout/login" are referring to logging out/in of Zendesk or your application?
What is the app that you're putting the "localhost" url into in your screenshot? Can you provide me a link to it in the marketplace? Is there a reason you aren't just installing it as your own server side application (related docs)? We can't really debug if you're not using ZAF directly.
0
Balaji
Hi Eric,
If we pass app_guid while redirecting it is working fine now for the first time both before and after login. But when I logout and try to login again I am not getting app_guid again.
Suppose there is a home component. so, when I login first time I get app_guid from search there but when I logout and login again I do not get app_guid from search in the same component.
0
Eric Nelson
Yes - if the application isn't being zipped and installed locally to Zendesk and is instead hosted at an external address (whether it be your local or an actual host), we'd consider it server side.
0
Balaji
Hi Eric,
We do not have any manifest file mentioning location. What we are doing currently is we are build a react application locally. So, let's say the application is running on http://localhost:3000/.
Then we update that URL in Zendesk marketplace for an application.

In this case will ZAF consider it as server-side application?
0
Sign in to leave a comment.