使用 PHP 使用 Media(photo) Twitter API 发送直接消息


Send Direct Message With Media(photo) Twitter API using PHP

我正在使用"themattharris"OAUTH库来阅读和发送推文以及私信,我可以发送

  1. 新推文
  2. 回复推文
  3. 回复媒体推文

我使用了下面给出的推特状态更新 API 调用

https://api.twitter.com/1.1/statuses/update.json (for Tweets without media)
https://api.twitter.com/1.1/statuses/update_with_media.json (for Tweets with media)

作为响应,我能够获得Tweet Object(json_encoded),通过它可以保存在我的数据库中

当我对Direct Message(在 Twitter 用户名之前的"D"之前)尝试相同的操作时,回复成功转到Twitter网站,我能够看到直接消息,但RESPONSETwitter它返回最后一个Tweet Object而不是Message Object

我也看了看twitter direct message API

https://api.twitter.com/1.1/direct_messages/new.json

但它没有用于媒体上传的参数。

谁能帮我解决这个问题?

基本上,我想用媒体发送直接消息,作为响应,我应该得到直接消息对象而不是最后一个推文对象。

提前致谢

这太晚了,但答案是您无法通过媒体发送直接消息:

https://twittercommunity.com/t/uploading-images-in-dms/12317