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?
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.
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.
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.
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.
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/
Yes it is possible in this format: @[{user_id}:1:{name}]
Try this tutorial: http://digitizor.com/2011/01/24/tag-user-facebook-graph/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With