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

node-smssendutil

v1.0.4

Published

Dead simple zero cost SMS sending tool for node apps.

Downloads

2

Readme

node-smssend

Dead simple zero cost SMS sending tool for node apps inspired by TextBelt.

Utilizes a map of providers to send a single SMS message to a cell phonme number via the given providers SMS via email service.

Setup

Installation via npm

npm i --save node-smssendutil

Usage

You must first include and configure the SMSSend object by passing the configuration to its constructor like so:

SMSSend Configuration Example

let SMSSend = require('node-smssendutil');

let providers = [
    {name: 'Alltel', emailHost: 'message.alltel.com'},
    {name: 'AT&T', emailHost: 'txt.att.net'},
    {name: 'T-Mobile', emailHost: 'tmomail.net'},
    {name: 'Virgin Mobile', emailHost: 'vmobl.com'},
    {name: 'Sprint', emailHost: 'messaging.sprintpcs.com'},
    {name: 'Verizon', emailHost: 'vtext.com'},
    {name: 'Nextel', emailHost: 'messaging.nextel.com'},
    {name: 'US Cellular', emailHost: 'mms.uscc.net'},
    {name: 'Cricket', emailHost: 'mms.cricketwireless.net'},
    {name: 'Boost', emailHost: 'myboostmobile.com'},
    {name: 'Google Fi', emailHost: 'msg.fi.google.com'},
    {name: 'Republic ', emailHost: 'text.republicwireless.com'},
];

let config = {
    providers: providers,
    emailGatewayConfig: {
        host: process.env.CONFIG_EMAILGATEWAY_HOST,
        port: process.env.CONFIG_EMAILGATEWAY_PORT,
        useTls: false,
        username: process.env.CONFIG_EMAILGATEWAY_AUTH_USERNAME,
        password: process.env.CONFIG_EMAILGATEWAY_AUTH_PASSWORD,
        mailFrom: process.env.CONFIG_EMAILGATEWAY_MAILFROM,
    },
};

let smsSend = new SMSSend(config);

SMSSend Configuration

| Property | Description | Required? | | ---------|-------------|-----------| | providers | List of configured SMS providers with the form: {name: 'AT&T', emailHost: 'txt.att.net'}. If not provided the default list will be used. | false | | emailGatewayConfig | Holds the config for the smtp server you will use. | true | | emailGatewayConfig.host | The host name for the smtp server. | true | | emailGatewayConfig.port | The port for the smtp server. | true | | emailGatewayConfig.useTls | Does your smtp server use tls? | true | | emailGatewayConfig.username | The username for smtp server login. | true | | emailGatewayConfig.password | The password for smtp server login. | true | | emailGatewayConfig.mailFrom | The email adress used for outgoing mail. | true |

With the SMSSend configured, you can send an SMS message via the sendSMS method like so:

smsSend.sendSMS(
    'AT&T',
    process.env.TEST_SMS_NUMBER,
    'Testing SMSSend').then((result) => {
        console.log(`SUCCESS: ${result}`);
    }, (err) => {
        console.log(`FAIL: ${err.message}`);
});

SMSSend.sendSMS Parameters

| Parameter | Description | Required? | | ----------|-------------|-----------| | providerName | The key for the provider to use in the providers list. | true | | cellPhone | The cell phone number to send the SMS message to. | true | | msg | The text for the SMS message to send | true |

A full example is as follows:

Full Example

let dotenv = require('dotenv');
let SMSSend = require('node-smssendutil');

dotenv.config();

let providers = [
    {name: 'Alltel', emailHost: 'message.alltel.com'},
    {name: 'AT&T', emailHost: 'txt.att.net'},
    {name: 'T-Mobile', emailHost: 'tmomail.net'},
    {name: 'Virgin Mobile', emailHost: 'vmobl.com'},
    {name: 'Sprint', emailHost: 'messaging.sprintpcs.com'},
    {name: 'Verizon', emailHost: 'vtext.com'},
    {name: 'Nextel', emailHost: 'messaging.nextel.com'},
    {name: 'US Cellular', emailHost: 'mms.uscc.net'},
    {name: 'Cricket', emailHost: 'mms.cricketwireless.net'},
    {name: 'Boost', emailHost: 'myboostmobile.com'},
    {name: 'Google Fi', emailHost: 'msg.fi.google.com'},
    {name: 'Republic ', emailHost: 'text.republicwireless.com'},
];

let config = {
    providers: providers,
    emailGatewayConfig: {
        host: process.env.CONFIG_EMAILGATEWAY_HOST,
        port: process.env.CONFIG_EMAILGATEWAY_PORT,
        useTls: false,
        username: process.env.CONFIG_EMAILGATEWAY_AUTH_USERNAME,
        password: process.env.CONFIG_EMAILGATEWAY_AUTH_PASSWORD,
        mailFrom: process.env.CONFIG_EMAILGATEWAY_MAILFROM,
    },
};

let smsSend = new SMSSend(config);

smsSend.sendSMS(
    'AT&T',
    process.env.TEST_SMS_NUMBER,
    'Testing SMSGateway').then((result) => {
        console.log(`SUCCESS: ${result}`);
    }, (err) => {
        console.log(`FAIL: ${err.message}`);
});

Default Providers List

You can see the default providers list here.