Facebook Graph Batch,仅需顶层access_token [英] Facebook Graph Batch, only takes top-level access_token
问题描述
我正在使用Facebook Graph Batch API向注册人员的FB墙发送一条消息/不同消息. 我正在为每个用户定义一个access_token,并根据文档).对于后者,我只使用批处理中列出的用户的access_token.
I'm using the Facebook Graph Batch API to send one message / different messages to registered people's FB walls. I'm defining an access_token for each user, and the obliged top-level access_token (used as fallback, according to the doc). For the latter I just use an access_token from the users listed in the batch.
问题是,接收消息的唯一用户是我用作顶层/后备access_token的access_token. 其他用户收到(#210)用户不可见"错误消息. 我在我的应用程序角色中使用了3个测试用户设置.
The thing is that the only user recieving the message, is the one who's access_token I used as the top-level/fallback access_token. The other users get the "(#210) User not visible" error message. I'm using 3 test users setup at my app-roles.
你知道这里出了什么问题吗?
Any idea what goes wrong here?
这是我的代码(python),用于向所有注册人生成一条消息:
Here's my code (python) for generating one message to all registrants:
for soc_reg in self.registrants:
batch_item = {
"method" : "POST",
"relative_url" : FACEBOOK_URL_FEED % (soc_reg['uid']),
"body" : Helper.toURL(publishParams),
"access_token" : soc_reg['access_token'],
}
batch.append(batch_item)
params = {
"access_token" : self.registrants[0]['access_token'], # used as fallback
"batch" : Helper.toJSON(batch),
}
得出"params"的以下值:
results in following value for "params":
{"access_token": "XYZ", "batch": "[{\"body\": \"caption=&message=is+not+a+test.%0D%0AWe%27re+just+rappin%27+to+the+beat%21&place=146270405429726&link=&description=\", \"access_token\": \"XYZ\", \"method\": \"POST\", \"relative_url\": \"/100003720771245/feed\"}, {\"body\": \"caption=&message=is+not+a+test.%0D%0AWe%27re+just+rappin%27+to+the+beat%21&place=146270405429726&link=&description=\", \"access_token\": \"ZYX\", \"method\": \"POST\", \"relative_url\": \"/100003671211957/feed\"}, {\"body\": \"caption=&message=is+not+a+test.%0D%0AWe%27re+just+rappin%27+to+the+beat%21&place=146270405429726&link=&description=\", \"access_token\": \"YZX\", \"method\": \"POST\", \"relative_url\": \"/100003683601909/feed\"}]"}
因此,接收消息的唯一用户是此处定义的用户:"access_token":self.registrants [0] ['access_token'] 当我调整索引时,我可以确定接收该消息的那个;)
So the only user recieving the message is the one defined here: "access_token" : self.registrants[0]['access_token'] When I adjust the index, I can determine the one recieving the message ;)
推荐答案
好的,似乎文档和API本身不对应: https://developers.facebook.com/bugs/212455918831996
OK, seems like the documentation and the API itself are not corresponding: https://developers.facebook.com/bugs/212455918831996
文档说: relative_url =>'alias','body'=>'{"access_token" =>"..."}'
Documentation says: relative_url => 'alias', 'body' => '{"access_token" => "..."}'
但只有这种方式似乎有效: 'relative_url'=>'别名?access_token = ...'
But only this ways seems to work: 'relative_url' => 'alias?access_token=...'
FB似乎已经确认了该错误并将其放入愿望清单"中,到目前为止,要走的路要走,至少对我有用:)
FB seemed to have confirmed the bug and put it on the 'wishlist', so far the latter is the way to go, works for me at least :)
这篇关于Facebook Graph Batch,仅需顶层access_token的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!