在Facebook GraphAPI上,使用Python SDK,我试图向用户发送通知。我收到错误:
GraphAPIError: An active access token must be used to query information about the current user
我的Python代码是:
graph = facebook.GraphAPI(access_token=TOKENS["app_token"])
graph.put_object(parent_object='me', connection_name='notifications', template='Tell us how you like the app!', href='https://www.google.com')
答案 0 :(得分:0)
解决方案:
graph = facebook.GraphAPI(access_token=TOKENS["user_token"])
user_info= graph.get_object(id='me', fields='id')
graph = facebook.GraphAPI(access_token=TOKENS["app_token"])
graph.put_object(parent_object= user_info['id'], connection_name='notifications', template='Tell us how you like the app!', href='https://www.google.com')