Newbie question on Details Widget

I am attempting to build a simple DetailsWidget that will take the email address of the customer and query our CRM for additional data.
I was able to create a Details Widget, and build the api call but it keeps returning an empty set, though I can clearly log the results of my api, and it IS returning data.

Why can’t I see the data on the DetailsWidget end?
I tried both an .ajax call and a .getScript, both return an empty response.

Are there any samples of a similar simple Widget I could refer to?

thanks,
FrancescaS

Hey, currently we do not have a working example that I could share with you, but if you can share your code with us, we will take a look.

If you do not want to drop it here, you can send me a private message.

This is what I have

Keep in mind that this is my very first attempt and I may very well be going at it all wrong.

For now I am just trying to get the json results of the api to log in the console, I will worry about formatting the output later.

I can log results just before the return on the API, they are in a valid json format, but when I call it from this script on our LiveChat Agent
window I get an error, but with a 200 ok.

![03%20AM|367x500](upload://4odVpvYXn3JTRlFTCdkMdDMUwhK.png) 

Thank you,
FrancescaS

Hey, sorry for the late reply. Could you paste the link again? Something didn’t work.

I uploaded a screen shot of the file.
thank you for taking the time to look at it.
Francesca

Hey Francesca, your code looks OK to me. I can think of one reason ( apart from your endpoint now working :wink: ) that you didn’t get any results. If you have only one chat running or only one chat in the archives we won’t send for this chat “customer_profile” event. Our developers know about it and will fix this eventually, but I can’t offer you ETA yet. So make sure that you have at least two archived chats and go between them to make sure that this event is sent.

I have prepared an example based on SWAPI (The Star Wars API https://swapi.co/). An example is hosted by the Glitch platform. Here is the link to the code https://glitch.com/edit/#!/example-for-francesca.

Its public address is https://example-for-francesca.glitch.me/ - you can paste it in our widget, and you can test it out. It is searching by the “Name” field provided in the pre-chat survey. So for example, if your visitor will introduce himself as “Luke”, you will get all the information available about Luke Skywalker. It will look exactly like this:
https://monosnap.com/file/Dby1KmJvvVacZPSZG2LvW2Vst2fXEd

If something is not clear or you have followup questions do not hesitate to ask :wink:

Regards, Michał

Thank you Michal, I will be doing some more testing after today’s presentation. I appreciate you confirming the code looks correct. And thank you for the examples.

Francesca

1 Like

My app is working, thank you! :slight_smile:

2 Likes