简体   繁体   中英

How to send an image in direct message?

I'm trying to send an image in direct message using python + tweepy but no luck. It showed as a link in incoming messages.

imgurl = 'https://t.co/***'
api.send_direct_message(screen_name='username',text=' '+imgurl)

Could you please advise? Official Twitter API doesn't shed a light for me as well.

At the moment, you are sending a link. Literally a status message where the text is a URL.

Sadly, Twitter don't provide API access for uploading images via DM .

If you are able to use Twitter's private API, you should be able to attach a media_id to your DM. But other than that, you're out of luck.

Sorry.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM