您不能拥有来自应用程序的提要帖子的共享链接,但您可以拥有链接帖子,如第二个示例中所述。或者,您也可以将操作链接添加到这样的帖子消息中。
FB.ui(
{
method: 'feed',
name: 'Facebook Dialogs',
link: 'http://venu.com/',
picture: 'http://venu.com/f8.jpg',
caption: 'Venu site',
description: 'asdasdasdasd.',
message: 'asdasdasd!',
actions: [
{ name: 'share', link: 'link here' }
]
},
function(response) {
if (response && response.post_id) {
alert('Post was published.');
} else {
alert('Post was not published.');
}
}
);
链接将指向您网站/应用中的自定义页面。由于用户正在尝试共享其他人发布的消息,因此您应该在服务器中拥有该消息。您可以在自定义 URl 中传递消息的 id。
希望对你有帮助:)
[编辑]
或
您可以添加一个带有分享按钮的链接,您必须使用“我/链接”而不是“我/提要”。不幸的是,这不是一个完整的替代方法,因为 Facebook 在使用此方法时会忽略描述、标题和图片参数。这是此处发布的错误。(https://developers.facebook.com/bugs/194522957295380)
$attachment = array(
'access_token'=>TOKEN_HERE,
'message'=>'message_here',
'link' => 'http://www.example.com/',
);
$result = $facebook->api(
'me/links',
'post',
$attachment
);
所以,现在这类似于在您的网站中设置一个“赞”按钮。 Facebook 从给定链接中的开放图元标记中提取信息。
<head>
<meta property="og:locale" content="en_US" />
<meta property="og:site_name" content="name for ENTIRE SITE"/>
<meta property="og:title" content="name of PAGE"/>
<meta property="og:type" content="website"/>
<meta property="og:image" content="<URL HERE>"/>
<meta property="og:description" content="my description" />
<title>Untitled</title>
</head>