Facebook实时更新:订阅一个页面 [英] Facebook realtime updates: Subscribing to a page

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

问题描述

任何人尝试订阅一个页面进行实时更新?例如,当网页的资讯提供下方显示新的墙贴时,我想收到通知。



Facebook文档说这是可能的,但从来没有见过任何人这样做。



https://开发人员.facebook.com / docs / reference / api / realtime /

解决方案

你需要获取page_accesstoken,然后添加应用程序作为选项卡。您可以通过
获取用户访问令牌的admin,范围= manage_pages
一旦您获得用户访问令牌,您可以查询我/帐户。它将显示类似于

  {
category:Community,
name page name,
access_token:xxxxx,
id:1111111134678999,
perms:[
ADMINISTER,
EDIT_PROFILE,
CREATE_CONTENT,
MODERATE_CONTENT,
CREATE_ADS,
BASIC_ADMIN
]
}

该xxx将是页面访问令牌,页面访问令牌必须将您的应用程序添加为选项卡。你可以通过



https://graph.facebook.com/PAGEID/tabs?app_id=APPID&method=POST&access_token=xxx



现在,只要页面发生变化,您将收到一个请求到您的回调URL。请求看起来像。

  {
object:page,
entry :[
{
id:408518775908252,
时间:1360643280,
更改:[
{
:feed,
value:{
item:like,
verb:add,
user_id:5900878
}
}
]
}
]
}

希望这有帮助。


Anyone tried subscribing to a page for real-time updates? I would like to get notified when a new wall post appears under a page's feed for example.

The Facebook documentation says this is possible but have never seen anyone accomplished this before.

https://developers.facebook.com/docs/reference/api/realtime/

解决方案

You need to get the page_accesstoken and then add the app as a tab. You can do this by getting the user access token of the admin with scope=manage_pages once you get the user access token you can query me/accounts. It will display something like

  {
      "category": "Community", 
      "name": "page name", 
      "access_token": "xxxxx", 
      "id": "1111111134678999", 
      "perms": [
        "ADMINISTER", 
        "EDIT_PROFILE", 
        "CREATE_CONTENT", 
        "MODERATE_CONTENT", 
        "CREATE_ADS", 
        "BASIC_ADMIN"
      ]
    }

That xxx would be the page access token, with the page access token you have to add your app as a tab. You can do that by

https://graph.facebook.com/PAGEID/tabs?app_id=APPID&method=POST&access_token=xxx

And now you will get a request to your callback url whenever there is a change in the page. The request looks something like.

{
    "object": "page",
    "entry": [
        {
            "id": "408518775908252",
            "time": 1360643280,
            "changes": [
                {
                    "field": "feed",
                    "value": {
                        "item": "like",
                        "verb": "add",
                        "user_id": 5900878
                    }
                }
            ]
        }
    ]
}

Hope this helps.

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

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