我正在尝试使用 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);
}
apprequests 在这里发送的事实告诉我访问令牌没问题,那么为什么通知不起作用?我们真的需要在服务器端做这个——有人能做到吗?