facebook - GRAPH API 后操作始终显示 'shared a link via app name'

标签 facebook facebook-graph-api facebook-php-sdk

我正在尝试通过我的应用程序发布一个故事。但是当我这样做时它显示说“一些人共享了一个链接应用程序名称”Sample Image

我不希望它作为链接共享,而是像下图所示的那样 Desired Result

通读 facebook 文档 ( https://developers.facebook.com/docs/reference/api/post/ ) 我认为可以通过将 status_type 定义为 app_created_story 来实现,但不幸的是,这也无济于事。其次,我还想在第二张图片中的故事下方添加“立即尝试”按钮。我假设它是通过“ Action ”(包含名称和链接的对象数组)完成的,但我无法达到预期的结果。在这方面的任何帮助将不胜感激。

我的代码如下

$attachment = array(
        'access_token'=> "User Access Token",
        'message' => "Message",
        'name' => 'Title',
        'caption' => "Some text",
        'link' => 'https://apps.facebook.com/canvas/',
        'description' => 'Some Text Here',
        'picture' => "http://www.example.com/image.jpg",
        'from' => "application id",
        'status_type' => "app_created_story",


        );
try {
// Proceed knowing you have a user who is logged in and authenticated
    $result = $facebook->api("/userid/feed/",'post',$attachment);
} catch (FacebookApiException $e) {
error_log($e);
//$user = null;
}

只需添加访问 token ,我就有以下三个扩展权限:&scope=email,publish_stream,publish_actions

最佳答案

I am trying to publish a story through my application. But when I do so it display saying that "Some has shared a link app name"

那是因为这正是您正在做的——您正在发布一个链接。

您显示的第二张图片不是链接帖子,而是Open Graph 操作 – 从这里开始熟悉概念:https://developers.facebook.com/docs/opengraph/

关于facebook - GRAPH API 后操作始终显示 'shared a link via app name',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17228121/

相关文章:

android - 在 Facebook SDK 4 (Android) 中创建请求

ruby-on-rails - rails : Cookie overflow with omniauth twitter sign up

javascript - 我如何向玩家 friend 的时间线发送消息

php - 使用 PHP 访问 Facebook session

ios - facebook 广告设置的问题

iphone - iPad 键盘不会从具有 Model View Controller 样式 UIModalPresentationFormSheet 的 View Controller 调用的 Facebook 对话框中关闭

javascript - facebook apprequests 对话框错误 "An error occurred. Please try again later."

Android Opengraph Like 按钮实现

facebook - 生成永不过期的访问 token - FACEBOOK

php - 我如何从 facebook fql 获取待处理的组帖子