Search code examples
ioscocoa-touchfacebook-graph-apifacebook-sdk-3.0

Sending a Facebook private message within app


I already have an active Facebook session in my app, and want to be able to send a private message to a friend using the access token I already have. The closest I've gotten is to open a UIWebview to the touch interface, but the user will need to log into Facebook again before being able to send a message. Is there a way to send a private message using the session that is already active, and ideally, using my own interface? If I could send an email to the [email protected] programmatically, that would be perfect, but that isn't possible in iOS that I know of.

As I understand it, here are the options to send messages to friends in iOS:

  1. Send an email using the mail composer to the [email protected] (unable to send email programmatically, otherwise this will be perfect)
  2. Send an app request/post on the wall using the Facebook SDK
  3. Open a webview (and log into Facebook again) show the touch dialog for messaging

Is there anything I'm missing?


Solution

  • I found that you can send private Facebook messages using the Facebook Chat API using XMPP.

    https://github.com/robbiehanson/XMPPFramework

    Quickblox has some sample code that demonstrates how to send FB messages.