AI Zone Admin Forum Add your forum

NEWS: survey on 3000 US and UK consumers shows it is time for chatbot integration in customer service!read more..

From ChatScript to React to PWA

Hello! I just got started with ChatScript and am seriously crushing on it! grin
I built a simple micro-bot successfully in CS and now I want to develop a UI for it.  My strategy would be to create an API that taps into the CS Json functionalities by way of back end, and a front-end with React. I could then already deploy it as a web application. If I get that far, I would then add a manifest and service workers to turn it into a Progressive Web App.

Does anyone know a step by step tutorial or guide for going from CS engine to web UI?

My problem is I can’t find any clear tutorials for integrating a CS chatbot into a UI. I did find Mattheus Vervloet’s interactive case tutor a promising starting point, but

a) not sure where in the directory structure I would place the directories to access the bot in RawData


b) he uses python to manage the web sockets, with a dependency named Flask, and I am not fluent in python.

I also found Yurii Vlasiuk’s fantastic article very helpful, but while dwelling on the CS side he rather skirts over the JS side.

Any guidance gratefully received.


  [ # 1 ]

Hi, Ismael, and welcome to smile

I’ve written a web to CS interface in the past, but it requires PHP for the backend. If this is not a problem for you and your situation, perhaps I can help? Please let me know.


  [ # 2 ]

Actually I find php a bit easier than javascript, so yes that would be great. At this point I am just learning the ropes with CS, so that would be a brilliant starting point. Any help gratefully received.


  [ # 3 ]

Let me scare up the code. One moment…

[time passes]

[more time passes]

[taking a nap to rest my eyes from all that searching]

[more time passes]

[play some solitaire]

Ok, maybe that last one was a bit too much. Sorry. Try the following link:

If you have any questions, comments or problems, please let me know. smile


  [ # 4 ]

Perfection! Haven’t tried it yet, but I understand it clearly. I see exactly what’s happening front and back, and can build from there. This is the perfect foundation. My title should have been from cs to php/jquery to node to react to pwa. You have given me the crucial bridge. Now to see if my conceptual understanding translates practically!


  [ # 5 ]

Well… while I tried it (hope you enjoyed 3 games of solitaire and some minesweeper) I found myself struggling to specify the CS port. I am using xampp as a virtual machine. The php is running on local host, on a given port. My guess is I need to specify a different port in the of my bot, run the bot in the CS engine, and then try your index.php page?

My guess appears to be wrong…

Once I crack the sockets (sounds like an aging condition), the rest should flow. Thanks again for the support


  [ # 6 ]

Ok, how are you starting your instance of ChatScript? I generally use the file localServer.bat in ChatScript’s SERVER BATCH FILES folder. You can edit that file to change the port CS will listen on from the default of 1024 to whatever else you wish (so long as the port specified isn’t reserved for something else, that is). In the zip file I linked, if you go into ui.php you should be able to find where to alter the port used there, as well. That file is well documented, so you shouldn’t have trouble there.

With all that said, I’m guessing that this isn’t the problem. If you’re using this on a Windows machine (which is a fairly safe bet), you’re probably running into a firewall issue. If I had to guess (and I think I must, since you’re not describing exactly what’s going on), I’d say you’re getting an error message that mentions the host actively refusing the message. Or am I wrong, and you’re getting another message, or worse yet, no message at all?


  [ # 7 ]

You guess correctly, that was the original error, although I did give permission to chatscript.exe in the firewall. I was running my bot through the chatscript.exe binary, not the localServer.bat. Having changed as per your guidance I can see the server side working now.
Took a bit of digging though. For some reason it was not finding my bot Luke. Not even with a blank “” for the default. But when I called it Harry, it did actually load Luke. I send a build luke command and it’s all back. So thanks! I have my start! My missing piece was the server.bat.  From here I can take off. You are a major star.


  [ # 8 ]

It’s what I do, and I’m more than happy to help. Please let us know if you need anything else, and very much please keep us up to date with your progress. smile


  [ # 9 ]

Will do. Just managed to crack speech processing. My bot can now hear and speak. Working on an animated avatar next, to speak as the bot speaks. Will definitely share my finished demo, and write if I get stuck. What an awesome community.


  [ # 10 ]

If you use google chrome on Windows, you may enjoy one if the commercial chatbots that I administer at - Her name is Maggie, and she’s a mixologist. smile


  [ # 11 ]

Checked the mixology bot, and enjoyed it. Did you use the talkr github repo to animate the gif? I finished my demo successfully and made a GUI tapping into the Web Speech API, not just for synthesis but also recognition, so you can just talk to Luke Skywalker. Thanks for all the help and feel free to take it for a spin! Thanks for all the help. It was the LocalServer.bat which would have kept me lost for ages. Once that was solved I could take off. Them simple things.


  login or register to react