Using the FbGraph API for Private Messages

Hiii I am a new user of fbgraph api. I want to send a private message to my friends using this api. I saw some sites that send messages using apache facebook messaging. can i use the same? Or is there an alternative to sending private messages? Are there any restrictions? please tell me about it. thank you

+4
source share
4 answers

You cannot use the Graph API to send private messages, but you can use the send dialog:

http://developers.facebook.com/docs/reference/dialogs/send/

+2
source

You can use the Facebook Chat API to send private messages, here is an example in Ruby using xmpp4r_facebook gem :

sender_chat_id = "-#{sender_uid}@chat.facebook.com" receiver_chat_id = "-#{receiver_uid}@chat.facebook.com" message_body = "message body" message_subject = "message subject" jabber_message = Jabber::Message.new(receiver_chat_id, message_body) jabber_message.subject = message_subject client = Jabber::Client.new(Jabber::JID.new(sender_chat_id)) client.connect client.auth_sasl(Jabber::SASL::XFacebookPlatform.new(client, ENV.fetch('FACEBOOK_APP_ID'), facebook_auth.token, ENV.fetch('FACEBOOK_APP_SECRET')), nil) client.send(jabber_message) client.close 
+2
source

I tried the xmpp4r_facebook gem / Jabber approach and it works fine.

The problem is that if you send a link to your site and contains information about Open Graph meta tags, they don’t load, so you have a beautiful logo and a joint message with a message, for example:

 <meta property="fb:app_id" content="1234567890"/> <meta property="og:title" content="GreatApp"/> <meta property="og:type" content="website"/> <meta property="og:url" content="http://greatapp.com"/> <meta property="og:image" content="http://greatapp.com/logo.jpg"/> <meta property="og:site_name" content="GreatApp"/> <meta property="og:description" content="The Greatest App Ever"/> 

and this will load when you use the Facebook personal user interface to send private messages manually, using them manually in Facebook chat or using the approach above, this information is not taken into account, which destroys the entire user interface for sending invitations.

I will try other approaches.

0
source

I think THIS NOW is supported by the Graph API. https://developers.facebook.com/docs/reference/api/message/

0
source

All Articles