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

sms-service

v1.1.7

Published

Send SMS text messages thru AWS SNS

Downloads

33

Readme

sms-service

npm version Build Status Coverage Status License

A simple way to send SMS text messages.

Prerequisites

  1. AWS IAM User Credentials for programmatic access

    This module utilizes Amazon SNS for sending SMS messages. As such, this will require an AWS account and an IAM User with programmatic access keys. The aws-sdk has a number of options for setting AWS credentials. Refer to the official AWS documentation for further instruction.

  2. IAM Policy for SNS

    The AWS IAM user will require proper IAM policy permissions to publish SMS messages. The SMS publish feature in SNS does not (for now) have a unique AWS resource, and thus there are no ideal ways to lock down access control. However, here is a sample policy allowing access to only publish SMS messages while denying access to publish on topics, applications, and push notifications:

     {
         "Version": "2012-10-17",
         "Statement": [
             {
                 "Effect": "Deny",
                 "Action": [
                     "sns:Publish"
                 ],
                 "Resource": "arn:aws:sns:*:*:*"
             },
             {
                 "Effect": "Allow",
                 "Action": [
                     "sns:Publish"
                 ],
                 "Resource": "*"
             }
         ]
     }

    If you know the set of recipients before hand, you can further tighten access control permissions by listing specific phone numbers in the last Resource node.

Installation

  1. Install via npm:

    npm install sms-service

Usage

Within your javascript application, you can use the SMSService to send SMS text messages:

//initialize
const sms = require('sms-service');
const smsService = new sms.SMSService();


async smsService.sendSMS('15555555555','hello from sms-service!');

The phoneNumber format must be in E.164 format. For example, a USA based number of 555-555-5555, the service would require 15555555555. Refer to this guide for additional information.

Debug Logging

Debug logging is provided by debug, and can be turned on setting the environment variable DEBUG.

PowerShell Example:


$env:DEBUG = "*"

Bash:

export DEBUG=*

Contributing

Automated Publish

  1. Utilizing GitHub Actions, after committing / merging changes into master, simply use npm version command to force a release on GitHub and trigger the workflow:

    npm version 1.1.4 -m "Upgrade to %s for reasons"

Manual Publish

  1. After merging feature branch changes back into master, follow semver and bump git version tag:

    git tag -a 1.X.X -m "adding version XXX"
  2. bump npm module version:

    npm version from-git

    Note: npm version also will push all git commits and tags to origin. This was configured in the package.json scripts:

        "version": "npm run format && git add -A src",
        "postversion": "git push && git push --tags"
  3. publish new release to npm:

    npm publish