node package manager



A better Twitter client.

What is this?

It's a Twitter client, like node-twitter or twit, but with some key differences:

  • Endpoints are exposed as methods. No more spelunking through Twitter's documentation — just use Intellisense. It's much easier!
  • Sensible defaults — e.g. stringify_ids and dnt (privacy setting) default to true, and count defaults to the maximum value
  • undefined and null values are omitted from queries, so you don't have to conditionally add parameters like max_id. Just do max_id: null (this is a really dumb gotcha with the Twitter API that has wasted a lot of my time)
  • Helper functions like decrement, for subtracting 1 from ID strings


  • It is unfinished. Only GET requests for now, and a few endpoints are missing


import { SwampThing, decrement } from 'swamp-thing';
const client = new SwampThing({
    "consumer_key": "A_CONSUMER_KEY",
    "consumer_secret": "A_CONSUMER_SECRET",
    "access_token_key": "AN_ACCESS_TOKEN_KEY",
    "access_token_secret": "AN_ACCESS_TOKEN_SECRET"
async function get_all_tweets(screen_name) {
    const tweets = [];
    let max_id = null;
    while (true) {
        const chunk = await client.get.statuses.user_timeline({
        if (chunk.length === 0) return tweets;
        const { id_str } = chunk.pop();
        max_id = decrement(id_str);
get_all_tweets('rich_harris').then(tweets => {
    console.log('these are bad tweets:', tweets);

Why the name?

Because Twitter is a fetid swamp.