如何订阅Facebook页面墙壁的实时更新 [英] How to subscribe to real-time updates for a Facebook page's wall

查看:140
本文介绍了如何订阅Facebook页面墙壁的实时更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Facebook的实时更新文档现在表示您可以获取页面的Feed:

Facebook's real-time updates docs now say that you can get the feed for a page:


您可以按照订阅
a用户的Feed的方式订阅页面的Feed - 订阅主题应为用户'和
订阅字段应该是'feed'

You can subscribe to the page's feed in the same way you subscribe to a user's feed - the subscription topic should be 'user' and the subscription field should be 'feed'

我对此的理解是我需要发布到图表API订阅:

My understanding of this is that I need to post to the graph API to subscribe as such:

curl -d \
"object=user&fields=feed&callback_url=$CALLBACKURL&verify_token=$SECRET" \
"https://graph.facebook.com/$PAGEID/subscriptions?access_token=$OAUTHTOKEN"

(这是一个bash脚本。)这里 $ CALLBACKURL 示例代码。 (至少我认为这是正确的 - 我可以成功添加订阅。)
$ OAUTHTOKEN 是我的Facebook应用程序的一个。

而$ $ PAGEID 是我想获得实时更新的页面的Facebook对象标识。

(This is a bash script.) Here $CALLBACKURL is set up correctly following their example code. (At least I think it's correct -- I can successfully add subscriptions with it.) The $OAUTHTOKEN is the one for my Facebook App.
And the $PAGEID is the facebook object id of the page I'd like to get realtime updates for.

当我这样做,呼叫似乎工作 - 没有错误信息。我的回调被调用。但是,当网页上的资讯发生什么事情时,我当然不会收到通知。

When I do this, the call appears to work -- no error message. My callback gets called. But I certainly don't get notified when something happens on the page's feed.

那么缺少什么?该页面是否需要安装我使用的oauth令牌的应用程序?或者我以某种方式需要通过登录页面来获取页面的oauth令牌?

So what's missing? Does the page need to install the app whose oauth token I'm using? Or do I somehow need to get an oauth token for the page itself by logging in as the page?

推荐答案

我不知道这是否可以帮助你,但是我会告诉你我在哪里可以进行实时更新页面Feed:

I do not know if this can help you but I'll tell you where I am for real-time update page feed:

(permissions:manage_page,offline_access ,read_stream)

(permissions : manage_page,offline_access,read_stream)


  1. 您的应用程序必须链接到该页面(然后安装应用程序,但不需要有一个选项卡。创建标签 https://graph.facebook.com/PAGE_ID / tabs?app_id = APP_ID& method = POST& access_token = PAGE_ACCESS_TOKEN ,并删除标签
    TAB_ID = PAGE_ID。/ tabs / app _'。APP_ID;
    https://graph.facebook.com/TAB_ID?method=DELETE&access_token=PAGE_ACCESS_TOKEN


function page_access_token($page_id,$access_token){
$page_token_url="https://graph.facebook.com/" . $page_id . "?fields=access_token&" . $access_token; $response = file_get_contents($page_token_url); $resp_obj = json_decode($response,true); $page_access_token = $resp_obj['access_token']; return $page_access_token; }

功能page_tabs_create($ page_id,$ app_id,$ page_access_token){

function page_tabs_create($page_id,$app_id,$page_access_token){

$ page_settings_url = https://graph.facebook.com/
$ page_id。 /tabs?app_id=\".$app_id.\"&method=POST&access_token=。 $ page_access_token;
$ response = file_get_contents($ page_settings_url);
$ resp_obj = json_decode($ response,true);
return $ resp_obj;
}

$page_settings_url = "https://graph.facebook.com/" . $page_id . "/tabs?app_id=".$app_id."&method=POST&access_token=" . $page_access_token; $response = file_get_contents($page_settings_url); $resp_obj = json_decode($response,true); return $resp_obj; }

功能page_tabs_delete($ tab_id,$ page_access_token){

function page_tabs_delete($tab_id,$page_access_token){

$ page_settings_url =< a href =https://graph.facebook.com/ =nofollow> https://graph.facebook.com/ $ tab_id。?method = DELETE& access_token =。 $ page_access_token;
$ response = file_get_contents($ page_settings_url);
$ resp_obj = json_decode($ response,true);

$page_settings_url = "https://graph.facebook.com/".$tab_id."?method=DELETE&access_token=" . $page_access_token; $response = file_get_contents($page_settings_url); $resp_obj = json_decode($response,true);

return $ resp_obj;
}

return $resp_obj; }

订阅:订阅必须像用户,因此object = user fields = feed,但是您必须添加新的字段,否则它会收到评论,并喜欢墙,所以您必须添加状态才能接收发布的文章(我的问题是获取其他内容作为链接,我设法添加链接作为字段,但是当链接发布时我没有收到通知)

Subscription: to subscribe must be like a "user" and therefore object = user fields = feed but you have to add new fields because otherwise it receives the comments and likes the wall so you must add "status" in order to receive the articles posted (my problem is to get other content such as links I have managed to add "link" as fields but I am not receiving notifications when a link is posted)

$ param = array('access_token'=> $ access_token,
'object'=>'user',
'fields'=>'feed,status,link'
'callback_url'=>'http:// ***** *** fbcallback.php'
'verify_token'=>'***********',
'include_values'=>'true');

$param = array ('access_token' => $ access_token, 'object' => 'user', 'fields' => 'feed, status, link' 'callback_url' => 'http:// ******** fbcallback.php' 'verify_token' =>'***********', 'include_values' => 'true');

POST
https://graph.facebook.com/APP_ID /订阅

我的英文不是很好,但我希望它会帮助你,在我的我还在寻找墙壁的所有更新(链接,视频...)

my English is not very good but I hope it will help you, on my side I'm still looking for really all updates to the wall (links, video ...)

这篇关于如何订阅Facebook页面墙壁的实时更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆