Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tagging friends in status updates from Facebook API

Tags:

I recently came across this blog post that said that it's possible to tag someone in a status update from a Facebook app (= from the API):

However, it doesn't seem to work for me.

It tried it in three different ways:

$post = $facebook->api('/me/feed', 'post', array(     'access_token' => $session['access_token'],     'message' => 'Hello @[562372646:Lionel Cordier], how are you?' )); 

or

$access_token = $session['access_token']; $message = 'Hello @[562372646:Lionel Cordier], how are you?'; $curl_post = 'access_token='.$access_token.'&message='.$message; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://graph.facebook.com/me/feed'); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $curl_post); $data = curl_exec($ch); curl_close($ch); 

or

$access_token = $session['access_token']; $message = 'Hello @[562372646:Lionel Cordier], how are you?'; $curl_post = 'access_token='.$access_token.'&status='.$message; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://api.facebook.com/method/users.setStatus'); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $curl_post); $data = curl_exec($ch); curl_close($ch); 

But nothing works. The result I have is "Hello @[562372646:Lionel Cordier], how are you?" on my wall.

But if I type "Hello @[562372646:Lionel Cordier], how are you?" directly in Facebook, it works correctly.

What am I doing wrong?

like image 507
Vinch Avatar asked Dec 01 '10 17:12

Vinch


People also ask

How do you tag all your friends on Facebook?

Type the name of each friend in the "Tags" field. A thumbnail appears after you type the friend's name. Click the thumbnail to tag the person in your note.

When you tag someone on Facebook does it show up on their timeline?

A tag is a special kind of link. When you tag someone, you create a link to their timeline. The post you tag the person in may also be added to that person's timeline. For example, you can tag a photo to show who's in the photo or post a status update and say who you're with.

How do I tag someone on Facebook after posting?

Type "@" and then the Page's or group's name. Select a name from the list that appears. Keep in mind that depending on a Page's settings, you may not be able to mention it. When you mention a person, Page or group in a post or comment, a link is created.

How does an API work with Facebook?

The Facebook API verifies your credentials & generates a unique authentication token & passes it to the third-party app, verifying the login process. Graph API is an HTTP based API via which apps can post on users walls, upload photos, share events & stuff.


2 Answers

I was struggling with this problem last week and found the following bug report, which suggests (given the current ASSIGNED status) that it cannot be done yet:(

http://developers.facebook.com/bugs/395975667115722/

like image 192
Robarondaz Avatar answered Oct 18 '22 14:10

Robarondaz


Yes it is possible in this format: @[{user_id}:1:{name}]

Try this tutorial: http://digitizor.com/2011/01/24/tag-user-facebook-graph/

like image 35
Debjit Avatar answered Oct 18 '22 14:10

Debjit