Having fun with jabber bots


Published on

Victor's presentation about xmpp and Jabber bots at Pycon Ireland 2010

Imagine the possibility of creating a real time channel, capable of notifying and interact, using a simple instant messaging application. Integrating such tool on your application could bring real value to you and customers. The main focus of this presentation is to show an easy way to create and use computer bots through the Python language, suggesting useful applications, and bring together some advanced considerations about security and natural language processing.

Learn how to create a bot using jabberBot (5 minute tutorial):
live example
How to make it useful?
Real time notification system
Integration with Yahoo, Exchange APIs
System administration
Getting serious

Alternative libraries
Language Processing

Published in: Technology
No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Having fun with jabber bots

  1. Having Fun with Jabber Bots Victor Hugo Germano
  2. Why Jabber Bots? What kinda a crazy am I?
  3. It’s Fun! http://www.flickr.com/photos/sleepallday/3311794264/
  4. Maybe a glimpse of the future? http://www.flickr.com/photos/dancoulter/21042744/
  5. Dynamic web Is not enough!
  6. Tired of Ctrl+R and F5 http://www.flickr.com/photos/disaster_area/3454110496/
  7. We want websites like this!
  8. But during the game... Real time streamming... for sure!
  9. FLASH
  10. Would FLASH be the answer?
  11. No! At least is what most companies are saying
  12. “Big” Problem How to create a chat room? Or a chess game?
  13. Because Latency Matters Specially when developing and application
  14. client server Traditional Polling Often Problematic
  15. ? Any other options?
  16. Extensive Messaging and Presence Protocol Event-Driven XML oriented
  17. Stanzas Presence <presence from="victorhg@im.net/home">   <status>at #pyconIreland o/</status> </presence>
  18. Stanzas Message <message to="mary@im.net/work"      from="victorhg@im.net/home"      type="chat" >     <body>How u doing? ;) </body> </message>
  19. Stanzas IQ (Info Query) <iq type="get" id="an_id"      from="victorhg@im.net/casa"      to="im.net">     <query xmlns="jabber:iq:roster"/> </iq>
  20. client server Long Polling
  21. Jabber.org
  22. But XML sucks! xmppPy is your friend!
  23. xmppPy conn = xmpp.Client(‘gmail.com’) conn.connect([server, port]) conn.auth(user, pwd) conn.send(Message( "email@gmail.com","hello!")) conn.disconnect()
  24. First Example Using GTalkBot http://github.com/victorhg/botnet/blob/master/botnet/gtalkbot.py
  25. mybot.py from gtalkbot import GTalkBot, botcommand class MyBot(GTalkBot): def __init__(self): super(MyBot,self).__init__('USER_ID','PWD') @botcommand def hello(self, mess, args): return “Hello World!” MyBot().run_client() http://github.com/victorhg/botnet/blob/master/botnet/gtalkbot.py
  26. $> python mybot.py
  27. How about a real bot? Enough with the hello_world
  28. Demo Add a contact on your GTalk account pycon.bot@gmail.com
  29. Having fun! Show me the code!
  30. How can you use it? http://www.flickr.com/photos/flysi/183272970/
  31. Real Time Web? Powered by XMPP
  32. BOSH Bidirectional-streams Over Synchronous HTTP
  33. Strophe.js When XMPP hits the web http://code.stanziq.com/strophe/
  34. Strophe.js // Connecting var conn = new Strophe.Connection(URL) conn.connect( jid, password, callback ); // Creating stanzas var stanza = new Strophe.Builder( “message”, { “to”: “john@jabber.org”, type:”chat” } );
  35. Who uses XMPP on the web?
  36. References http://xmpp.org/ http://xmpppy.sourceforge.net/ http://thpinfo.com/2007/python-jabberbot/ http://xmpppy-guide.berlios.de/ http://code.stanziq.com/strophe/ Real Time Web with XMPP @ InfoQ
  37. Thank you! twitter.com/victorhg google.com/profiles/victorhg Use it! Share it! Remix it!
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.