Media items can now be posted in tweets, by an optional second parameter while calling the Rettiwt.tweet.tweet method. The following example demonstrates this:
import { Rettiwt } from 'rettiwt-api';
// Creating a new Rettiwt instance using the given 'API_KEY'
const rettiwt = new Rettiwt({ apiKey: API_KEY });
// Posting a tweet, containing an image, to twitter
rettiwt.tweet.tweet('What a nice image!', [{ path: '<path_to_media>' }])
.then(res => {
console.log(res);
})
.catch(err => {
console.log(err);
});
Where,
<path_to_media> is the path to the media file to be posted
The optional second parameter takes in a list of media items, therefore multiple media items can be posted in a single tweet.
Media items can now be posted in tweets, by an optional second parameter while calling the Rettiwt.tweet.tweet method. The following example demonstrates this:
Where,
<path_to_media>
is the path to the media file to be postedThe optional second parameter takes in a list of media items, therefore multiple media items can be posted in a single tweet.