我尝试使用以下代码发送消息:
//...
FacebookClient fbClient = new FacebookClient(appId, appSecret);
fbClient.AccessToken = "...";
string to = "user id";
dynamic result = fbClient.Post(String.Format("{0}/feed", to), parameters);
但我怎么知道这封文章是否已成功发送给用户?案例成功/错误的回报是什么?我没有在facebook-sdk-api的C#文档中找到一些细节。
.NET版本:v4.0.30319
Facebook大会版:5.2.1.0
提前致谢。
答案 0 :(得分:3)
通过引用https://developers.facebook.com/docs/reference/rest/stream.publish/,您将获得成功调用的result
参数的post_id,如果失败则应该是一些包含错误消息的json,例如:
{
"error_code": 200,
"error_msg": "The user hasn't authorized the application to perform this action",
"request_args": [
{
"key": "method",
"value": "stream.publish"
},
{
"key": "access_token",
"value": "AAAC9okD6ZA7ABABhvJOZBQvUE2OsuHLKEkqlvKKkPDNB9kHfF55DqgKF2raHmSaUSgkpvLtgWniM5CFnu5mxaGODLqvwVz9zBNd1Jd6AZDZD"
},
{
"key": "format",
"value": "json"
}
]
}