XMPP intregration with Facebook Chat, using Python - python

I'm starting a project using the XMPP protocol and haven't done anything with it thus far. I would like some advice/direction in regards to my questions below.
At the present moment, I know Facebook's Chat API says to use PyXMPP and pyFacebook, which is what I will be using initially. However can someone give me an idea as to how to connect Facebook chat with Gtalk; using their example script, located here:: http://developers.facebook.com/docs/chat/
I see that they mention API keys, where exactly do I retrieve the API keys from? Thanks.

You need to register your application at http://developers.facebook.com/apps and get the API keys. Both Gtalk and Facebook chat are built on XMPP protocol. So you can set up an XMPP chat client which will connect to both.
Refer to the book written by Jack Mofitt: http://professionalxmpp.com/
It talks about setting up the chat client. Also the documentation in the Developers forum is bad. Check out this thread from the old forum http://forum.developers.facebook.net/viewtopic.php?id=51892

Yes you can connect using digest MD5, where you need to pass the username and password. Go through the XMPP protocol to get a better understanding on digest MD5.

Related

Slack RTM API uses POST or GET method?

This might seem a lame question, but would be great if someone can help. I wrote a small python script which returns some output based on a command sent to it via slack's custom bot. Python script uses RTM API. Whenever someone in slack mentions the bot and passes a command (ex: #slackcustombot foobar), it returns a custom message(ex: Hi foobar) from the script. Now the issue is at the security side. My script resides at a server which is not open to internet. And as Slack uses dynamic IP, there's no possibility of white-listing the slack ip's.
So basically, all I wanted to know is, when someone in slack channel mentions the bots, and when the bot at slack server sends the command to my python script residing at my server, does it send as GET method or as POST method? cuz if it's a GET method, I might not have to worry about the security issue. but if it sends as POST method, what alternative I could use in this scenario? Any help is appreciated. Please correct me if I am wrong somewhere, still learning. :)
Regards,
Junaid.
Neither. It uses the WebSocket protocoll. If you rather want to use a HTTP-based protocol I would recommend looking into the Slack's Event API. It uses HTTPS POST to transfer messages to your bot.
The Events API is not providing all event types that are available with the RTM API, but its much easier to handle and should be sufficient for a chat bot. Check here for a documentation of which event types are available to the both RTM API and Events API.
You will however need to find a way to expose the url of your bot to the Internet, so that Slack can use it. If you need to access internal company applications through your Slack bot, the best approach in my opinion is to have the Slack bot on a webserver in the DMZ of your company.
A more small scale approach is to use a forwarding provider that is connecting to your local webserver through a VPN tunnel and exposing your internal webserver through a special public URL. That would work if you want Slack to talk to your webserver on a local network behind a router / firewall. One example is ngrok, but they are other providers too.

Implementing Backend IP Messaging Twilio

So I'm kind of stuck. I'm trying to implement Twilio ip messaging for our app and I'm not sure I'm finding what I need in the docs.
From what I see as examples - the only things that the backend is responsible for is the credential generation - something I have done.
Should the backend also not somehow facilitate the message sending and conversation generation?
Any useful information/documentation links/tutorial links would be much appreciated.
Twilio developer evangelist here.
The message sending and conversation generation can all be done through the client libraries, either the JavaScript or iOS (or, coming soon, Android) SDKs. That way, other than the credential generation as you pointed out, your servers don't need to be responsible for the rest of the chat application.
You can, if you choose, send messages from your own server too. Check out the documentation on the IP Messaging REST API.
If you want your server to interact with messages sent by the client libraries you can also subscribe to webhooks for IP Messaging too.
Let me know if this helps at all.

send google hangout notification using python

Is there an API which allows me to send a notification to Google Hangout? Or is there even a python module which encapsulates the Hangout API?
I would like to send system notification (e.g. hard disk failure reports) to a certain hangout account. Any ideas, suggestions?
Hangouts does not currently have a public API.
That said, messages delivered to the Google Talk XMPP server (talk.google.com:5222) are still being delivered to users via Hangouts. This support is only extended to one-on-one conversations, so the notification can't be delivered to a group of users. The messages will need to be supplied through an authenticated Google account in order to be delivered.
There is pre-alpha library for sending hangouts messages on python:
https://pypi.python.org/pypi/hangups/0.1
The API have been reverse engineered and is not published (as someone posted in comments). Thus it might change a Google's will.
Also, messages sent using XMPP ceased to be delivered to Hangouts users. I guess this is another cut (of the thousand scheduled).
I send alarms and other notifications with a python script (failures on database server, partitions without free space, etc), using hangouts. It's easy. Look at http://www.administracion-linux.com/2014/07/enviar-mensajes-por-hangout-desde.html to send hangouts.

Constructing micro blogging site in python? Any suggestions

I want to write a micro blogging site with html frontend but xmpp backend (Instant messenger type). By this, I mean server should push all the updates to client browser and hence constant http polling is not required. I need your view and help in that.
I found 3 xmpp libraries
1. xmppy
2. sleekxmpp
3. pyxmpp
Should i use any of these or should try from scratch. If from these which one will you suggest.
What should i do?
This slideshow may help. The author uses django and some xmpp items that can tag along with django's authentication. This sounds pretty perfect for you.
The link is to google's cache because the original link wouldn't work for me anymore. Let me know if this is a problem.
try this - https://github.com/hj91/Using-XMPP-to-post-content-on-blog-sms-facebook
xmpp to wp blog poster bot code.
it takes incoming xmpp message and posts them on worpdress blogs. written in python and xmpppy library

how do I know if a remote user is connected in django?

how do I know if a remote user is connected in django?, like gmail chat, or facebook chat... I need that in the templates system. Sorry for my english
If you need just a general idea of who is currently visiting your website, which includes anonymous visitors, use django-tracking app.
If you need a chat application, or need to know exactly who is logged in at any time, this is much more complicated and will require you to know a lot about chat protocols like XMPP and how to use persistent connections with ajax or comet methods. Some starting projects to look at: xmpp-psn and django-xmpp
Also see this web page for a list of non-Django XMPP browser clients: http://xmpp.org/software/clients.shtml
Comet is probably what you want. Look at Orbited, Hurricane or Tornado.

Categories

Resources