0.0.2 • Published 6 years ago

js-twitter v0.0.2

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

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.

0.0.2

6 years ago

0.0.1

6 years ago