Announcement Announcement Module
No announcement yet.
Posting a message/link on to specific users in Facebook by using spring social Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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?

  • #2
    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.


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


      • #4
        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", "");
        //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.");

        //Live collection image link
        map.set("picture", ""); // the image on the left
        //map.set("actions", "{'name':'view', 'link':''}"); // 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


        • #5
          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?

          Jigar Modi


          • #6
            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!

            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 ( where "email" is the scope to get a user's email, but there is "N/A" for friends email.


            • #7
              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?


              • #8
                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.


                • #9
                  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.


                  • #10
                    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.