Ganesh Deshvini
Ganesh Deshvini

Reputation: 429

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

I am using "themattharris" OAUTH library for reading & sending Tweets as well as Direct Messages, I am able to send

  1. New Tweets
  2. Reply on Tweets
  3. Reply on Tweets with Media

I used the Twitter status update API call given below

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)

In response I am able to get the Tweet Object(json_encoded), through which I can save in my database

When I try the same for Direct Message(preceding "D" before twitter username), the reply went successfully to Twitter Website & I am able to see the direct message, but in RESPONSE from Twitter it is returning the last Tweet Object instead of the Message Object?

I also looked at twitter direct message API

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

but it is not having parameter for media upload.

Can Anyone Help me with this?

Basically I want to send direct message with media & in RESPONSE I should get the DIRECT MESSAGE OBJECT not the LAST TWEET OBJECT.

Thanks in advance

Upvotes: 1

Views: 1745

Answers (1)

Zeke
Zeke

Reputation: 669

This is way late, but the answer is you can't send a direct message with media:

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

Upvotes: 1

Related Questions