Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

twit-wrapper

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

twit-wrapper

Twitter API client for Node.js

  • 1.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
increased by50%
Maintainers
1
Weekly downloads
 
Created
Source

twit-wrapper

npm Travis (.org) npm bundle size

Highly opinionated Twitter API client for Node.js

This is a small heavily opinionated utility wrapper library around twit.
It is implemented with facade pattern which translates twit library's existing interface into simplified one.

Prerequisite

To interact with Twitter API, head over to Twitter Developer Platform and create new application.
Once you are done filling out information, you need to generate four access tokens:

  • Consumer API Key
  • Consumer API Secret Key
  • Access Token
  • Access Token Secret

Install

npm i twit-wrapper

Usage:

Only most commonly used function for interacting with Twitter API are implemented:

  • postTweet(msg)
  • getTweets(keyword, fromDate, lang = 'en', maxResults = 100)
const TwitterClient = require('twit-wrapper');
const twitterClient = new TwitterClient(
  consumerAPIKey,
  consumerAPISecretKey,
  accessToken,
  accessTokenSecret,
);

// post new tweet
try {
  const msgToPost = 'Post a test message';
  const postedMsg = await twitterClient.postTweet(msgToPost);
  console.log(postedMsg);
} catch (e) {
  console.error(e);
}

// search twitter for all tweets containing the word 'javascript' since January 1, 2017
try {
  const searchedTweets = await twitterClient.getTweets('javascript', '2017-01-01');
  console.log(searchedTweets);
} catch (e) {
  console.error(e);
}

Keywords

FAQs

Package last updated on 16 Jun 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc