我在在墙贴中标记人员时遇到了一些严重的问题。我现在正在使用 CakePHP 并使用 FB API 来 POST 到 Graph API。代码如下:
$theMsg1 = $this->Connect->user('name').' tagged ';
$theMsg2 = $friendName.' on the IF Tag website.';
$msg1Len = strlen($theMsg1);
$fbNameLen = strlen($friendName);`
$fbcall = FB::api($fbID.'/feed', 'POST', array(
'name' => $theTag['Tag']['name'],
'caption' => 'IF Tag is an application that allows you to interact with people on Facebook.',
'message' => $theMsg1.$theMsg2,
'message_tags' => array(
$msg1Len => array(
'id' => $friendID,
'name' => $friendName,
'offset' => $msg1Len,
'length' => $fbNameLen
),
'picture' => 'http://patronsocialclub.com/img/global/head/drinkmaker.gif',
'link' => 'iftag.local'
)
));
根据我的理解和阅读,我应该使用 message_tags 对象来标记帖子中的人员,但它根本不起作用。它不会给出任何错误,只是不标记。
我还尝试使用我见过的其他帖子中的 @[{userid}:1:{username}]
但这似乎不适用于 API 的当前迭代.
最佳答案
在这里查看我的答案Facebook Graph API Post with_tags option
其要点是
我认为你想要使用的只是“标签”,它应该只包含此处指定的 id https://developers.facebook.com/docs/reference/api/user/#posts
**注意,如果没有指定地点,您就无法执行此操作
Facebook 现已发布提及标签,这可能是您需要的解决方案 https://developers.facebook.com/docs/opengraph/mention_tagging/但它需要自定义开放图操作。
关于facebook - 使用 POST to Facebook Graph API 在墙上帖子中标记人员,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8072711/