Chatbot with XMPP and ProgramAB

Hi guys, meanwhile thanks Grog to update XMPP service with a new server on @myrobotlab.org 

Now is it possible communicate with your robot in a chat similar to WhatsApp and other like.

To use this ther are many client: http://xmpp.org/software/clients.html

This is the script to use ProgramAB and XMPP to create a chatbot. To register on server contact Grog or reply on this post http://myrobotlab.org/content/xmpp-now-xmpp-server-myrobotlaborg


#file : home/Papaouitai/XmppAB.py edit raw
xmppRobotName= "yourRobotName" #insert robot username on server XMPP @myrobotlab.org
xmppReceiver="yourReceiver@myrobotlab.org" #insert your username of receiver and sender on server XMPP @myrobotlab.org
xmppPwd = "passwordRobot" #inser password of robot account

xmpp = Runtime.createAndStart("xmpp","Xmpp") #start service XMPP
xmpp.connect("myrobotlab.org", 5222, xmppRobotName, xmppPwd) #connect to server @myrobotlab.org
xmpp.setStatus(True, "online all the time") #Online when is execute this script
xmpp.addAuditor(xmppReceiver) #add receiver and sender account

htmlfilter = Runtime.createAndStart("htmlfilter", "HtmlFilter") #start service HtmlFilter

alice2 = Runtime.createAndStart("alice2", "ProgramAB") #start ProgramAB serivce
alice2.startSession("default", "alice2") #start with name and robot intelligence 
alice2.addTextListener(htmlfilter) #add listerner of text 

python.subscribe("xmpp","publishXMPPMsg") #public on Python service function when robot receive message
python.subscribe('htmlfilter', 'publishText') #public on Python service function when ProgramAB answers  

def onXMPPMsg(xmppmsg): 
   print xmppmsg.msg.getBody() #print text of message receive
   alice2.getResponse(xmppmsg.msg.getBody()) #send message to ProgramAB
   
def onText(text):
   xmpp.sendMessage(text, xmppReceiver) #send message to receiver account