facebook - 使用 POST to Facebook Graph API 在墙上帖子中标记人员

标签 facebook facebook-graph-api cakephp-1.3

我在在墙贴中标记人员时遇到了一些严重的问题。我现在正在使用 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/

相关文章:

iphone - 如何打开 iPhone 的默认浏览器?

javascript - Facebook 分享分享后显示空白页面

php - Cakephp 是容器还是树?

php - CakePHP HABTM 过滤

ios - 解析接收邮件FB SDK

facebook - 支付订阅-测试回调

Facebook API : I want to silently (without dialog box) authenticate my server to access a fan page's info

ios - 如何处理 facebook 对话框请求的取消按钮?

php - 如何在不使用 api 资源管理器的情况下获取具有以前使用的权限的新 'short lived' facebook 访问 token (服务器端)?