Twitter action : how to send a tweet containing an image?

Is there any simple and robust way to embed an image (either through a remote url, either from a local file - everything would be fine) allowing to publish a tweet containing an image in addition to a few text ?

(I don’t see anything around that in the twitter action : http://docs.openhab.org/addons/actions/twitter/readme.html)

Ok this wasn’t available in the base code (but the underlying twitter4j dependency already had the feature), so i made a pull request (https://github.com/openhab/openhab1-addons/pull/5345)

1 Like

That is an awesome feature - thank you!

Do you mind replying to this thread when/if it gets incorporated into the daily snapshot?

Dan

Sure !

Usage is just (remote or local file) :

sendTweet("Arrosage nécessaire pour la plante du salon !", "http://www.ikea.com/gb/en/images/products/howea-forsteriana-potted-plant-kentia-palm__67456_pe181297_s4.jpg")

Actual result from OpenHAB is then :

Brilliant - can it send images in private messages too?

As far as i know, this feature is not possible at the moment, twitter is not exposing a way to attach an image to a direct message (@see https://twittercommunity.com/t/send-image-with-direct-message-in-twitter-4j/22080). So the answer is no.

How funny - wonder why they do that?

No matter, I can run openhab through a protected account and then if I post image tweets then only authorised followers will be able to see them

Dan

I’m using the exact same setup, a protected twitter account with only me as a follower !

1 Like