简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM