0.2.0 • Published 2 years ago

smsdev-js v0.2.0

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

SmsDev-js

Typed promise based adapter for SMS Dev service. Wraps SMS Dev API in a lightweight easy to use lib.

import smsDev from 'smsdev-js'

const sms = sms({ key: XXXXXXXX })

Motivation

SMS Dev doesn't provide an official API and can be it's usage can be very primitive. The main goal here is to abstract the api to a more reasonable usage. You'll notice that some properties has been altered to be easier to use and understand.

Any updated property is mapped back to what the official API requires.

Getting Started

Official Api Doc

This lib uses official SMS Dev api. You can find the docs on smsdev.com.br.

Installation

npm

npm i smsdev-js

yarn

yarn add smsdev-js

pnpm

pnpm i smsdev-js

Usage

Methods usually reflects the names of the official api.

Create instance

You need an API key generated in the smsdev dashboard to create an instance.

import smsdev from 'smsdev-js'

const sms = smsdev({ key: XXXXXXX })

Send SMS

You need the full phone number with country code to send successfully.

const messageConfig = { msg: 'Short text message', phone: '+5521999000123' }
const response = await sms.send(messageConfig)

Send Multiple SMS

const messagesConfig = [
  { 
    msg: 'Short text message',
    phone: '+5521999000123' 
  },
  { 
    msg: 'Short text message 2',
    phone: '+5521999000321' 
  },
]
const response = await sms.send(messagesConfig)
0.2.0

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago