quantum rookie
quantum rookie

Reputation: 697

Tagging friends in a fb.api status update?

Is it possible to tag friends somehow using the Facebook fb.api (JavaScript SDK) call?

By tagging I mean what happens when you use "@" in the regular facebook.com UI.

Upvotes: 5

Views: 3055

Answers (4)

Lukasz Dynowski
Lukasz Dynowski

Reputation: 13640

Yes, you can use FB.api to tag a friends.

E.g. If you would like to a tag a friend(s) withing a message that you will share on a Fb's wall you have to do following.

1) Get extended permissions ('publish_stream') e.g. you can request it while login to the app FBUser.login({scope: 'publish_stream'});

2) You have to pass a string with the facebook_user_id to a 'tag' key of the api object. e.g.

FB.api('me/feed', 'post', { message: "my message here", place: '123456789', // mandatory!!! tags: "123456, 654321, 147258, 852963", // facebook users ids of your friends name : "Some text here", description : "Some text here", picture: "http://wwww.link.to/the_image"})

Upvotes: 0

Eliasdx
Eliasdx

Reputation: 2180

Check the Facebook documentation for more information about this: photos.addTag.

Quote:

Each tag in the list must specify: "x", "y", and either the user id "tag_uid" or free-form "tag_text" identifying the person being tagged. An example of this is the string {"x":"70.0","y":"70.0","tag_text":"some person"}

And read in FB.api on how to use the REST API calls using JavaScript.

Upvotes: 0

Cat Lee
Cat Lee

Reputation: 534

It is currently not possible to tag a friend in a status update or post via the API.

Upvotes: 5

Gajus
Gajus

Reputation: 73888

Not sure if that's what you are asking, but the syntax to tag a friend using Facebook API is @[uid:friend name]. However, it seems like there is a bug at the moment and FB does not support it.

Upvotes: 1

Related Questions