Facebook Graph API帖子带有标记选项

Facebook Graph API Post with_tags option

本文关键字:选项 Graph API Facebook      更新时间:2024-01-03

我遇到一个问题http://developers.facebook.com/docs/reference/api/post/.即,名为"with_tags"的选项。

options = {
    "message": "Test123", 
    "with_tags": {
        "data":[
            {"id": 100001686722916, "name": "Aret Aret"}
        ]
    }
};
FB.api('/me/feed', 'post', options, function(response) {
    if (!response || response.error) {
        alert('Error occured');
        console.log(response);
    } else {
        console.log(response);
    }
});

结果,我只收到了一条消息"Test123",但在我的帖子中没有"with"标签。我在"with"部分使用的用户在我的朋友列表中,也是该应用程序的开发者。谢谢

我实际上认为"with_tags"选项在返回提要对象时是只读的。这不是您可以POST的选项https://developers.facebook.com/docs/reference/dialogs/feed/#graphapicall。我认为你想要使用的只是"标签",它应该只包含这里指定的idhttps://developers.facebook.com/docs/reference/api/user/#posts

**注意,如果不指定一个位置,你就不能这样做

编辑****Facebook现在发布了提及标签,这可能是你需要的解决方案https://developers.facebook.com/docs/opengraph/mention_tagging/

下面是一个关于如何在标记一些朋友的同时发布到用户提要的示例:

FB.api(
    "/me/feed",
    "POST",
    {
        "message": "This is a test message",
        "place": "link",
        "tags": "friend_id1,friend_id2"
    },
    function (response) {
      if (response && !response.error) {
        console.log(response); /* post id will be returned */
      }
    }
);

发件人:https://developers.facebook.com/docs/graph-api/reference/v2.5/user/feed