Facebook Graph获取用户生活事件

Facebook Graph Get User Life events

本文关键字:生活 事件 用户 获取 Graph Facebook      更新时间:2023-09-26

我对如何使用facebook graph API获取用户生活事件有疑问。

例如,获取提要时间轴,我做这个HTTP调用。

var urlToTimeline = "https://graph.facebook.com/" + user.services.facebook.id + "/posts?access_token=" + user.services.facebook.accessToken
    HTTP.get(urlToTimeline, function (error, result) {
      if (error) {
        console.log(error);
      } else {
        console.log(result);
      }
    })

这个工作,但现在我试图弄清楚url请求应该如何获得生命事件顺便说一句,我正在使用流星框架。

既然你正在使用Meteor,你应该考虑安装一个facebook sdk包,比如biasport:facebook-sdk,这样你就可以直接使用fb sdk了。然后根据fb文档,你只需通过id:

访问生活事件
FB.api(
    "/{life-event-id}",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);