tribal
tribal

Reputation: 653

Write to facebook friend's wall from java

using a person's access token, I am able to obtain the person's friend's facebookId. Will someone please provide me an example of posting a message to a friend's wall from java? I am using the api: com.restfb.

More specifically, I need to include an attachment as part of my message; the attachment being extra messages.

Upvotes: 4

Views: 1008

Answers (1)

Richard Barnett
Richard Barnett

Reputation: 1108

See https://developers.facebook.com/docs/reference/api/user/#feed, part of which says:

You can create a link, post or status message by issuing an HTTP POST request to the PROFILE_ID/feed connection

So try creating a post, with something like:

String uid = "...";
DefaultFacebookClient client = ...;
FacebookType postId = client.publish(
    uid + "/feed", FacebookType.class, 
    Parameter.with("message", "Hello, world"), 
    Parameter.with("link", "http://www.google.com"));

According to the docs you can only attach one of the posting user's Facebook photos.

Upvotes: 1

Related Questions