Uploading images in DMs

34 views
Skip to first unread message

Gian Franco Fioriello

unread,
Jun 23, 2016, 2:38:04 PM6/23/16
to Twitter Ruby Gem
Hi! I want to post a direct message including media, I read here that twitter not provide anything to do this, but I don't know what about you.

This is what I'm trying to do unsuccessfully:


      medias = %w(path/to/image1.jpg path/to/image2.jpg)

media_ids = medias.map do |path|
client.upload File.new
path
end

options[:media_ids] = media_ids.join(',')

tweet = client.create_direct_message(receiver, text, options)

Can anybody tell me how to do this and if it is possible?

Thanks!

David Fisher

unread,
Aug 10, 2016, 1:42:41 PM8/10/16
to twitter-...@googlegroups.com
I too am curious - is it possible to upload video/images in DMs?

Am I correct in that I use the Media API to upload the image, and then attach a media_id to the DM when I create it?

--
You received this message because you are subscribed to the Google Groups "Twitter Ruby Gem" group.
To post to this group, send email to twitter-ruby-gem@googlegroups.com.
Visit this group at https://groups.google.com/group/twitter-ruby-gem.

Reply all
Reply to author
Forward
0 new messages