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

@qrvey/sms

v0.0.3

Published

![install size](https://packagephobia.now.sh/badge?p=%40qrvey%2Fsms) ![coverage](https://img.shields.io/badge/unit_test_coverage-87%25-brightgreen)

Downloads

229

Readme

@qrvey/sms

install size coverage

@qrvey/sms is a lightweight and reliable library to send manage sms messages. It supports different clients such SNS (AWS), ACS (Azure), Twilio, and Vonage.

Installation

You can install the @qrvey/sms package via npm. Run the following command in your terminal:

npm install @qrvey/sms

Peer Dependencies

This package has the following peer dependencies:

  • @aws-sdk/client-sns (v3.x) for interacting with AWS SNS.
  • @azure/communication-sms (v1.x) for interacting with Azure Communication Services.
  • @vonage/server-sdk (v3.x) and @vonage/auth (v1.x) for interacting with Vonage.
  • twilio (v5.x) for interacting with Twilio.

Configuration

To work properly, the package need some env variables. To set the sms provider, you must set the SMS_PROVIDER env variable with one of these values:

  • AWS
  • AZURE
  • TWILIO
  • VONAGE

In case the SMS_PROVIDER env variable is set with an unknown value, you will get a UnknownProvider error. Depending on the provider you must set some variables:

AWS

If you set SMS_PROVIDER = AWS, the following env variables are required:

  • SMS_PROVIDER_USERNAME which is AWS_ACCESS_KEY_ID in aws context.
  • SMS_PROVIDER_PASSWORD which is AWS_SECRET_ACCESS_KEY in aws context.
  • SMS_PROVIDER_REGION which is AWS_REGION in aws context.

AZURE

If you set SMS_PROVIDER = AZURE, the following env variables are required:

  • SMS_PROVIDER_USERNAME which is resource-name in azure connectionString context.
  • SMS_PROVIDER_PASSWORD which is access-key in azure connectionString context.
  • SMS_PROVIDER_FROM_NUMBER which is the ACS-registered number in azure context. This must be in E.164 format, example: "+123456789"

Note: The azure connectionString for Azure Communication Services looks like this: endpoint=https://<resource-name>.communication.azure.com/;accesskey=<access-key>.

TWILIO

If you set SMS_PROVIDER = TWILIO, the following env variables are required:

  • SMS_PROVIDER_USERNAME which is TWILIO_ACCOUNT_SID in twilio context.
  • SMS_PROVIDER_PASSWORD which is TWILIO_AUTH_TOKEN in twilio context.

VONAGE

If you set SMS_PROVIDER = VONAGE, the following env variables are required:

  • SMS_PROVIDER_USERNAME which is VONAGE_API_KEY in vonage context.
  • SMS_PROVIDER_PASSWORD which is VONAGE_API_SECRET in vonage context.
  • SMS_PROVIDER_FROM_NUMBER which can be one of the next:
    • An alphanumeric ID. Example: "MyCompanyBrand"
    • A Vonage-registered number in E.164 format. Example: "+123456789".
    • A local-registered short number. Example: "12345".

API Documentation

Available Methods

send: (phones: string[], message: string) => Promise<SendResult>;

Example Usage

const phones: string[] = [
    "+123456789",
    "+9876543210"
];
const message = "Hello world!";

const smsSenderService = new SMSSenderService();
await smsSenderService.send(phones, message);