无法使用C#Facebook SDK发送通知

时间:2013-06-01 18:17:04

标签: c# notifications facebook-c#-sdk

我正在尝试使用C#Facebook SDK向服务器端的注册用户发送通知(不是应用请求)。我实际上得到了一条成功消息,但没有发送通知。我们的应用程序不在沙箱中并启用了画布。下面的代码显示了发送通知和应用请求的尝试 - 通知什么都不做,但应用请求有效:

        var fb = new FacebookClient();
        dynamic result = fb.Get("oauth/access_token", new
        {
            client_id = "MY_APP_KEY",
            client_secret = "MY_SECRET",
            grant_type = "client_credentials"
        });
        fb.AccessToken = result.access_token;

        dynamic nparams = new ExpandoObject();
        nparams.template = "Hello from my app!";
        nparams.href = "Home";

        dynamic requestParams = new ExpandoObject();
        requestParams.message = "Hi there";
        requestParams.title = "Please use this awesome app";

        foreach (string facebookID in facebookIDs)
        {
            // This returns success:true, but doesn't actually do anything
            var postResult = fb.Post(facebookID + "/notifications", nparams);

            // This works and shows a request in the app center
            var postResult2 = fb.Post(facebookID + "/apprequests", requestParams);
        }

var fb = new FacebookClient(); dynamic result = fb.Get("oauth/access_token", new { client_id = "MY_APP_KEY", client_secret = "MY_SECRET", grant_type = "client_credentials" }); fb.AccessToken = result.access_token; dynamic nparams = new ExpandoObject(); nparams.template = "Hello from my app!"; nparams.href = "Home"; dynamic requestParams = new ExpandoObject(); requestParams.message = "Hi there"; requestParams.title = "Please use this awesome app"; foreach (string facebookID in facebookIDs) { // This returns success:true, but doesn't actually do anything var postResult = fb.Post(facebookID + "/notifications", nparams); // This works and shows a request in the app center var postResult2 = fb.Post(facebookID + "/apprequests", requestParams); }

apprequests发送到这里的事实告诉我访问令牌是好的,那么为什么通知不起作用?我们真的需要做这个服务器端 - 有没有人能够做到这一点?

2 个答案:

答案 0 :(得分:0)

得到了facebook的回复。 。 。基本上,这个功能处于测试阶段,尽管给出了成功回复,但它可能无法正常工作

答案 1 :(得分:0)

好片段安东尼。似乎现在一直在努力。为您的尝试+1。

PS:如果有人偶然发现此代码,“facebookID”是一个数字ID,可以使用以下链接http://findmyfacebookid.com/

导出