English 中文(简体)
Send private messages to friends
原标题:

I need to get via Facebook connect user s info and send a private message to all of his friends. Is it possible?

问题回答

Sending private message through api is now possible.

Fire this event for sending message(initialization of facebook object should be done before).

to:user id of facebook

function facebook_send_message(to) {
    FB.ui({
        app_id: xxxxxxxx ,
        method:  send ,
        name: "sdfds jj jjjsdj j j ",
        link:  https://apps.facebook.com/xxxxxxxaxsa ,
        to:to,
        description: sdf sdf sfddsfdd s d  fsf s  

    });
}

Properties

  • app_id
    Your application s identifier. Required, but automatically specified by most SDKs.

  • redirect_uri
    The URL to redirect to after the user clicks the Send or Cancel buttons on the dialog. Required, but automatically specified by most SDKs.

  • display
    The display mode in which to render the dialog. This is automatically specified by most SDKs.

  • to
    A user ID or username to which to send the message. Once the dialog comes up, the user can specify additional users, Facebook groups, and email addresses to which to send the message. Sending content to a Facebook group will post it to the group s wall.

  • link
    (required) The link to send in the message.

  • picture
    By default a picture will be taken from the link specified. The URL of a picture to include in the message. The picture will be shown next to the link.

  • name By default a title will be taken from the link specified. The name of the link, i.e. the text to display that the user will click on.

  • description
    By default a description will be taken from the link specified. Descriptive text to show below the link.

See more here

@VishwaKumar:

For sending message with custom text, you have to add message parameter to FB.ui, but I think this feature is deprecated. You can t pre-fill the message anymore. Though try once.

FB.ui({
  method:  send ,
  to:  1234 ,
  message:  A request especially for one person. ,
  data:  tracking information for the user 
});

See this link: http://fbdevwiki.com/wiki/FB.ui

No, this isn t possible. In order for you to send messages of any kind to a Facebook user, you need that user s permission to do so.

If someone logs into your site with Facebook Connect, they are explicitly agreeing to share their Facebook data with your site, and you will then be able to send that person a message through the normal channels. You would also be able to fetch their friend list. However, you can not send messages to the friends.

This is not possible now, but there is a work around. You can engage with the user in the public realm and ask them to send you private messages, but you can t send private messages back, only public ones. Of course, this all depends on if the user gives you the correct permissions.

If you have given permission to access a person s friends, you can then theoretically post on that users wall with references to each one of the friends, asking them to publicly interact with you and then potentially privately message you.

Get Friends

#if authenticated
https://graph.facebook.com/me/friends
http://developers.facebook.com/docs/reference/api/user/

Post in the Public Domain

http://developers.facebook.com/docs/reference/api/status/

Get Messages sent to that user (if given permission)

http://developers.facebook.com/docs/reference/api/message/

You can use 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

One workaround, though not a great one, is to use the new @facebook.com email address. There are a few downsides to this:

1) Not everyone (as of this posting) has the new messages application enabled in their account.

2) Not everyone will have setup their @facebook.com email in their messages app.

3) Not everyone will choose their username (if they even have a facebook username) as their email address.

You cannot. Facebook API has read_mailbox but no write_mailbox extended permission. I m guessing this is done to prevent spammy apps from flooding friend s inboxes.

For mobile application i did a solution by injecting javascript in the dialog view. There is a hidden web view in my ios app. That load the fb message send dialog api .. then i inject some javascript to set the "to" and "message" field and submit the form.. So that end user need not to do anything. Message sent to facebook inbox silently...

This thread says you can t do send private messages to a group of friends on facebook but I found this https://developers.facebook.com/docs/sharing/reference/send-dialog

There isn t any graph api for this, you need to use facebook xmpp chat api to send the message, good news is: I have made a php class which is too easy to use,call a function and message will be sent, its open source, check it out: facebook message api php the description says its a closed source but the it was made open source later, see the first comment, you can clone from github. It s a open source now.





相关问题
Facebook Connect login dialog not working

I am using Facebook Connect for iPhone and following the official instructions. I use the following code to display the login dialog: FBLoginDialog* dialog = [[[FBLoginDialog alloc] initWithSession:...

Facebook App Profile Tab is Empty ... No Content Displayed?

I can view my application via the http://apps.facebook.com/myapplication/ link and the content shows up correctly. I also added the application as a tab to a facebook page. However, when viewing the ...

Facebook Platform error: "Object cannot be liked"

I m working on a Facebook Application that generates wall posts. In testing these posts, I ve discovered that the Facebook Platform action of "liking" a post is failing. The specific error message ...

how to call showPermissionsDialog() in php (facebook api)?

I was reading over the documentation yet I could not figure out how to call Facebook.showPermissionsDialog() in php include_once ./facebook-platform/php/facebook.php ; $facebook = new Facebook(my ...

Facebook connect

If I plug in the facebook connect into my website, How can I prevent double signups? Lets say I have a user that s already signed up to my site but he clicked the connect with facebook, is there a ...

热门标签