Facebook Chat API - Python App Engine -


i'm trying use facebook chat api in web service(appengine python). found code on line, of them me make work.

this code i'm using, don't work. doing wrong?

class testhandler(webapp2.requesthandler):      def get(self):              self.response.headers['content-type'] = 'application/json'             response = dict()              msg = "hello world"             jid = "myid@chat.facebook.com"             pwd = "passwd"             server = "chat.facebook.com"             recipient="targetid@chat.facebook.com"       try:             jid = xmpp.protocol.jid(jid)             cl = xmpp.client(jid.getdomain(), debug=["always"])              if not cl.connect((server, 5222)):                 response['error connection'] = 'not connected.'              elif cl.auth(jid.getnode(), pwd) == none:                 response['error auth'] = 'authentication failure.'             else:                 cl.send(xmpp.protocol.message(recipient, msg, "chat"))                 cl.disconnect()                 response['status'] = 'success'         except:             response['status'] = 'failed'          self.response.out.write(json.dumps(response)) 

i don´t know facebook api, have put facebook id on recipient targetid. have put user id want send message.

recipient="facebookuserid@chat.facebook.com"


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -