Results 1 to 10 of 10

Thread: Posting a message/link on to specific users in Facebook by using spring social

  1. #1
    Join Date
    Apr 2009
    Location
    Ahmedabad, Gujarat, India
    Posts
    15

    Default Posting a message/link on to specific users in Facebook by using spring social

    Hi Good Morning,

    I am able to post the link/message using publish or post method. However my requirement is to posted link should be posted to specific user's wall and visible to them only.

    We have that feature in Facebook manually where we can provide set of users (Custom) with whom we want to share it. Can we achieve this with Spring social?
    Regards,
    Jigar Modi
    (Sun Certified Java Programmer)
    (Sun Certified Web-Component Developer)

  2. #2
    Join Date
    Aug 2004
    Posts
    1,075

    Default

    I see this happening in a few different ways:

    1. You post to the authenticated user's wall and set the privacy so tight on it that only they can see it.
    2. You post to another user's wall (a friend of the authenticated user) and set the privacy so tight on it that only they can see it.
    3. You send a private message to the user; not on their wall, but via the user-to-user messaging mechanism (sorta like email).

    Which one did you have in mind?

    First, none of these are directly supported via Spring Social, but are certainly possibly with a bit more work via the GraphApi methods. In other words, FacebookTemplate implements the GraphApi interface and you could use the post() or publish() methods to make it happen. If you need help with the details of that, let me know and I'll see what I can do.

    Also, at least options #1 and #2 are on my radar to implement soon. The truth is that there are several options for posting to a wall and the existing methods only cover the more common use cases. I am planning to add a "post builder" or some such thing that lets you build a post using a fluent-API approach and then post it via a single postToWall() method.

    If I recall correctly, option #3 is not do-able via the Graph API (which is what the Facebook API binding binds to), I believe it has something to do with preventing abuse and spam.
    Craig Walls
    Spring Social Project Lead

  3. #3
    Join Date
    Apr 2009
    Location
    Ahmedabad, Gujarat, India
    Posts
    15

    Default

    Hey Thanks for quick reply.

    I would like to go with First way where I will post to the authenticated user's wall. And then I would set Custom property where I can give permission to multiple users(say 1 , 2 , 3). Now this post should be visible to authenticated user and user 1, 2 & 3.

    I think you have complete end-to-end thought. If you can post sample then that would be really great help.
    Regards,
    Jigar Modi
    (Sun Certified Java Programmer)
    (Sun Certified Web-Component Developer)

  4. #4
    Join Date
    Apr 2009
    Location
    Ahmedabad, Gujarat, India
    Posts
    15

    Default

    Hey friend!!!

    Cheers !!!!

    I achieved what I was looking for..... It's great night for R&D

    Please find below snippet where I have posted on authenticated user and allow only 1 friend to view it.

    MultiValueMap<String, Object> map = new LinkedMultiValueMap<String, Object>();
    //Live collection link
    map.set("link", "http://live.com");
    //Collection name
    map.set("name", "name");
    //map.set("caption", "Link Caption");
    //Description of post.
    map.set("description", "description.");
    map.set("privacy", "{\"value\":\"CUSTOM\",\"friends\":\"SOME_FRIENDS\ ", \"allow\":\"<user id with whom I wana share>\"}");
    //Message you want to show above your posted link
    //map.set("message", "Hey! friends look at the amazing shared content.");

    // THE BELOW LINES ARE THE CRITICAL PART I WAS LOOKING AT!
    //Live collection image link
    map.set("picture", "http://upload.wikimedia.org/wikipedia/en/d/df/Live_Earth_Logo08.png"); // the image on the left
    //map.set("actions", "{'name':'view', 'link':'http://www.bla.com/action'}"); // custom actions as JSON string

    facebook.publish("<user id>", "feed", map);

    I think this will also helpful to create Post builder. Anyway thanks to give me the direction you provide me.

    Cheers !!!!!!!!
    Jigar Modi
    Regards,
    Jigar Modi
    (Sun Certified Java Programmer)
    (Sun Certified Web-Component Developer)

  5. #5
    Join Date
    Apr 2009
    Location
    Ahmedabad, Gujarat, India
    Posts
    15

    Default

    Hey friend,

    I found that we are not able to fetch authenticated user's friend's email address using graph api.

    Is that right understanding? Is there anyway to fetch friend's email?

    Regards,
    Jigar Modi
    Regards,
    Jigar Modi
    (Sun Certified Java Programmer)
    (Sun Certified Web-Component Developer)

  6. #6
    Join Date
    Aug 2004
    Posts
    1,075

    Default

    Glad you figured it out! I was going to follow up with you this morning (and where I'm at it is still mid-morning), but you figured it out before I got a chance. Good work!

    Quote Originally Posted by Jigar86 View Post
    I found that we are not able to fetch authenticated user's friend's email address using graph api.
    You're right, you can't get at a user's friends' email addresses. The best clue to this is at the Permissions Reference (https://developers.facebook.com/docs...n/permissions/) where "email" is the scope to get a user's email, but there is "N/A" for friends email.
    Craig Walls
    Spring Social Project Lead

  7. #7
    Join Date
    Apr 2009
    Location
    Ahmedabad, Gujarat, India
    Posts
    15

    Default

    I found that we are able to fetch friend's email in yahoo and hotmail by importing contacts. Could you please explain how they do? Does they have special permission?
    Regards,
    Jigar Modi
    (Sun Certified Java Programmer)
    (Sun Certified Web-Component Developer)

  8. #8
    Join Date
    Aug 2004
    Posts
    1,075

    Default

    I honestly don't know. I've reviewed the Facebook Graph API again and ran some experimental requests against it (with *ALL* permissions turned on) and could find no way to get my friends' emails. If you figure it out, I'd love to know how it works.
    Craig Walls
    Spring Social Project Lead

  9. #9
    Join Date
    Apr 2009
    Location
    Ahmedabad, Gujarat, India
    Posts
    15

    Default

    Hi habuma,

    I read somewhere they are not using official api but have some private access to facebook by which they are able to fetch friend's email. but yes again publicly facebook doen't allow this.
    Regards,
    Jigar Modi
    (Sun Certified Java Programmer)
    (Sun Certified Web-Component Developer)

  10. #10
    Join Date
    Apr 2009
    Location
    Ahmedabad, Gujarat, India
    Posts
    15

    Default

    Hi everybody,

    I found that I am not able to fetch photos or friends or anything not more than 100. If I have more than 100 photos how can I fetched.

    Can anybody please help me here.
    Regards,
    Jigar Modi
    (Sun Certified Java Programmer)
    (Sun Certified Web-Component Developer)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •