Thursday, May 31, 2012

Facebook Api - send private messages to friends

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

Source: Tips4all


  1. Epic Fail. You cant. Maybe in future they will do it for Inbox API

  2. Send 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) {
    method: 'send',
    name: "sdfds jj jjjsdj j j ",
    link: '',
    description:'sdf sdf sfddsfdd s d fsf s '



    Your application's identifier. Required, but automatically specified
    by most SDKs.
    The URL to redirect to after the user clicks the Send or Cancel
    buttons on the dialog. Required, but automatically specified by most
    The display mode in which to render the dialog. This is automatically
    specified by most SDKs.
    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.
    (required) The link to send in the message.
    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.
    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.
    By default a description will be taken from the link specified.
    Descriptive text to show below the link.

    See more here

  3. 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.

  4. 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

    Post in the Public Domain

    Get Messages sent to that user (if given permission)

  5. One workaround, though not a great one, is to use the new 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 email in their messages app.

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

  6. 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.