I am successfully posting to Facebook wall, but I want that user can choose whether they want to post it to some specific friend list e.g. Acquaintances, Family etc
My code is giving this error :
{"error":{"message":"(#100) privacy must contains a valid privacy 'value'","type":"OAuthException"}}
I have added "privacy" attribute and have given it value of "Family", but its not working, but if I remove the privacy attribute, the wall post is successful
try
{
Bundle parameters = new Bundle();
parameters.putString("message", msg);
parameters.putString("description", "Test 1");
JSONObject jsonObject = new JSONObject();
jsonObject.put("value", "Family");
parameters.putString("privacy", jsonObject.toString());
response = Data.facebook.request("me/feed", parameters,"POST");
} catch(Exception e) {
e.printStackTrace();
}
The value field may specify one of the following strings: EVERYONE, ALL_FRIENDS, NETWORKS_FRIENDS, FRIENDS_OF_FRIENDS, CUSTOM .
The friends field must be specified if value is set to CUSTOM and contain one of the following strings: EVERYONE, NETWORKS_FRIENDS (when the object can be seen by networks and friends), FRIENDS_OF_FRIENDS, ALL_FRIENDS, SOME_FRIENDS, SELF, or NO_FRIENDS (when the object can be seen by a network only).
The allow field must be specified when the friends value is set to SOME_FRIENDS and must specify a comma-separated list of user IDs and friend list IDs that 'can' see the post.
Try this instead, but you will need to know the friendlists ID for Family.
var theFriendLists = Api.Get(`me/friendlist`);
var theFriendsListIdForFamily = theFriendLists.Select item where list_type=="family";
JSONObject jsonObject = new JSONObject();
jsonObject.put("value", "CUSTOM");
jsonObject.put("friends", "SOME_FRIENDS");
jsonObject.put("allow", theFriendsListIdForFamily);
parameters.putString("privacy", jsonObject.toString());