js-twitter
v0.0.2
Published
A node.js library for Twitter.
Downloads
5
Readme
twitter.js
A powerful, object-oriented library for easy interaction with the Twitter API.
Discord
Have a question? Got an issue? Join our Discord server here for support and all the latest announcements related to twitter.js and our sister project, jscord.
Links
Usage
First, install twitter.js from the command line:
npm i js-twitter --save
From there, the first step is, of course, to make a Twitter application.
Once you have your application's credentials, require twitter.js and create a client object with the following:
const Twitter = require('js-twitter');
let client = new Twitter({
consumer_key: "Your application's consumer key here",
consumer_secret: "Your application's consumer secret here",
token: "Your application's token here",
token_secret: "Your application's token secret here"
});
Once you have that set up, you can post a tweet.
client.postTweet("Hello world!");
twitter.js is promise-based, so this postTweet method will return a Tweet that you can do all sorts of fun stuff with. For instance:
client.postTweet("Hello there!")
.then(tweet => {
tweet.reply("General Kenobi!");
})
Or whatever floats your boat.
Work-in-progress documentation can be found here.