AI Zone Admin Forum Add your forum

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

Using a chatbot to collect data for web application
 
 

I’m interested in developing a chatbot to ask questions of web application users to:
1- obtain information to be stored in a database (e.g. what is your zip code?)
2- modify the the user interface of the application in real time (e.g. zoom in to map location of that zip code)

I’m now familiar with AIML, but haven’t figured out how to go from AIML to scripting language like javascript, python, php etc.

Are there any good examples or tutorials on this concept? I’ve been looking but can’t seem to find anything good. 

Much appreciation!

 

 
  [ # 1 ]

So what you might want to do is perform OOB ( out of band ) communication by embedding information in your chatbot response and then using javascript you can strip out the message in your web client and perform the action, which in your case would be to show the map for a zip code.

I use Chatscript and it ships with a web client that tests for oob commands enclosed in square brackets.
I modified it and I send commands to change the avatar image on the web page.
You can check out this thread: https://www.chatbots.org/ai_zone/viewthread/2173/

In Chatscript you can create output macros such as: 
outputmacro: ^avatarimage(^image)
$oob_command = ^join( \[ avatar = ^image \] )
    $oob_command

For a mapzipcode command I might create:
outputmacro: ^mapzipcode(^zipcode)
$oob_command = ^join( \[ mapzipcode = ^zipcode \] )
    $oob_command

In chatscript a topic and pattern would be defined as follows:

topic: ~mapzipcodes ( show map zipcode zip code )

u: ( show map ) Ok. What is your zip code?
    a: ( _~number ) ^mapzipcode(_0) OK. Now look at the map.

That would be all the code needed on the Chatbot side to have the user say:
User: Show map
Chatbot: Ok. What is your zip code?
User: 93111
Chatbot: Ok. Now look at the map I am showing you.

Behind the scenes, the response sent is “[mapzipcode=93111] Ok. Now look at the map.”
JavaScript takes off the command and stores the “mapzipcode” and the “93111” in variables that you can then use to show an embedded map in your custom web page that you will have to create or it could launch a link passing the zip code to Google Maps, etc.

Chatscript also has commands for storing “facts” and writing to a database so you could store the user name and zip code if you wanted.

Pandorabots allows you to create your own html webpage so you can perform OOB messaging there as well, creating your own system for embedding commands and removing them using javascript.  There is a learn command that could “Store” user name and zipcode but I am not sure about writing to an external database.

Both Chatscript ( and I believe Program O if you want to stick with AIML) provide methods that allow you to call command line batch files or programs and pass them parameters so there might be other options.

Best of luck.

 

 

 

 

 
  [ # 2 ]

Much thanks

 

 
  login or register to react