python - 使用 Facebook Graph API 进行私人回复
问题描述
我制作了一个机器人,它可以监控评论并找出哪个是最新评论并且效果很好。我试图添加一个功能,我可以将 private_replies 发送给发表评论的用户,我检查了所有文档并在互联网上搜索,但我仍然感到困惑,我应该怎么做?
def monitor_comment():
print("Bot is monitoring comments")
#Getting the data from fb
comment_data = graph.get_connections(COMBINED_POST_ID_TO_MONITOR,"comments",order='reverse_chronological')
commends = []
for comment in comment_data['data'][:10]:
commends.append (comment)
#Configure it so that i can take the first line of 'id'
data = commends[0]['id']
#Convert data to string cuz it doesn't work for some reason
data_converted = str(data)
return data_converted
#This is where it private_reply to the commend_id from above
def private_reply(comment_id):
#AM CONFUSE HERE
private_reply = graph.put_object(comment_id,"conversations", message= "Hello This is a test")
return private_reply
解决方案
推荐阅读
- laravel - Laravel Eloquent 数据关系问题
- angular - 在 Angular 5 中替换 HTML 电子邮件模板中的内容的最佳方法是什么?
- javascript - Socket.io 从断开连接中恢复
- laravel - npm install 到一个新的 Laravel 项目中 - 错误消息
- r - 从数字的分区生成排列
- python-3.x - TensorFlow 如何从 s3 字节流中读取文件
- microsoft-graph-api - 如何使用 msgraph-sdk-java 更新用户个人资料照片?
- reactjs - 如何将单个组件用作带有 react-native tabview 的新实例
- java - 我们可以在生产系统上免费使用 zulu jdk 1.8 吗?
- matlab - 如何在 Matlab/Simulink 中获取有关错误“来自非结构数组对象的结构内容引用”的详细信息?