npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

textnow.js

v0.1.6

Published

A Node texting module that utilizes TextNow.

Downloads

11

Readme

TextNow API

textnow.js is a node.js module that uses TextNow to enable free programmable texting

Credit

  • Developer: Leonardo Wu-Gomez
  • Reddit: leogomezz4t
  • Please tell me if you have any ideas for the API or reporting a bug

Installation

Method One: Using git clone

git clone https://github.com/leogomezz4t/textnow.js.git

Method Two: Using npm

npm install textnow.js --save

Usage

Ways to authenticate

const tn = require("textnow.js")

// Way 1. Just instantiate and a prompt will appear on the command line
const client = new tn.Client("email")
// Way 3. If you inputed the wrong cookie and are getting failed requests. This is how to reset it
client.auth_reset()
// will redo the prompt

How to send an sms message

(async () => {
await client.sendSMS("number", "Hello World!")
})

How to get new messages

const newMessages = await client.getUnreadMessages() -> Array
for (const message of newMessages):
    await message.markAsRead()
    console.log(message)
    // Message object
    // content: "body of sms"
    // number: "number of sender"
    // date: datetime object of when the message was received
    // read: bool
    // id: int
    // direction: SENT_MESSAGE_TYPE or RECEIVED_MESSAGE_TYPE
    // first_contact: bool if its the first time that number texted you
    // type: MESSAGE_TYPE if type is Message and MULTIMEDIAMESSAGE_TYPE if type is MultiMediaMessage

    // Functions
    // async markAsRead() will post the server as read
    // async sendSMS() will send an sms to the number who sent the message
    
    // MultiMediaMessage object
    // All the attributes of Message
    // content: url of media
    // rawData: bytes of the media
    // contentType: str the MIME type ie. "image/jpeg" or "video/mp4"
    // extension: str of the file extension is. "jpeg" or "mp4"
    // Functions
    // mv(file_path): downloads the file to file_path

    console.log(message.number)
    console.log(message.content)

    // MultiMediaMessage

    console.log(message.content_type)
    message.mv("./image." + message.extension)

How to get all messages

const messages = await client.getMessages() -> Array
// Same as above

How to get all sent messages

const sentMessages = await client.getSentMessages() -> Array
// same as above

Simple bot snippet

const tn = require("textnow.js")

(async () => {
    const client = new tn.Client("email")
    client.on("message", msg => {
        if (msg.content === "ping") {
            await client.sendSMS(msg.number, "pong")
        }
    })
})()

Patch Notes

0.1.4

  • Bug fix

0.1.3

  • Bug fix

0.1.2

  • Bug fix

0.1.1

  • Bug Fix

0.1.0

  • Initial Commit
  • Can send messages
  • Can recieve messages
  • can mark message as read

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT