# msa-node

> A library that allows writing Node.js code to make HTTP requests to the MyServiceAgent API. Written in Typescript.

Latest version **1.0.1** (published 2022-06-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install msa-node
pnpm add msa-node
yarn add msa-node
bun add msa-node
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2022-06-02 |
| First published | 2022-02-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 35.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Joshua Olatunde |
| Maintainers | olatundejoshua |
| Keywords | myserviceagent.net, javascript, node.js, api, client, library |

## Links

- npm: https://www.npmjs.com/package/msa-node
- Repository: https://github.com/myserviceagent/msa-node
- Homepage: https://github.com/myserviceagent/msa-node#readme
- Issues: https://github.com/myserviceagent/msa-node/issues
- npm.io page: https://npm.io/package/msa-node

## Dependencies (1)

- [isomorphic-unfetch](https://npm.io/package/isomorphic-unfetch.md) ^3.1.0

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2022-06-02
- 1.0.0 — 2022-02-22

## README

# msa-node 
The msa-node library allows you write Node.js code to make HTTP requests to the MyServiceAgent API. This library is open-source, so feel free to file an issue or contribute back to the project if you find a bug of a feature missing.


## features
- Tiny <1KB size, gzip
- Works in Node.js
- Typescript support

## installation

```bash
npm i msa-node
```

## usage

Import `msa-node` module in your project and initialize it with your [apiKey]. Get if from (https://myserviceagent.net). 

```js
import MyServiceAgent from 'msa-node'

const MyServiceAgentClient = new MyServiceAgent({ apiKey: '%apiKey%' })
// send an SMS
const smsPayload = {name: 'Test Tele', msisdns: '2348000000000', message_text: 'Hello world!'}
MyServiceAgentClient.createSMS(smsPayload).then((data) => {
    console.log(data)
})

// send a voice OTP
const voicePayload = {msisdn: '2348000000000', otp: '24566'}
MyServiceAgentClient.sendVoiceOTP(payload).then((data) => {
    console.log(data)
})

// send an sms OTP
const payload = {msisdn: '2348000000000'}
MyServiceAgentClient.sendSMSOTP(payload).then((data) => {
    console.log(data)
})

// verify a voice or SMS OTP
const verifyPayload = {msisdn: '2348000000000', otp: '24566'}
MyServiceAgentClient.verifyOTP(payload).then((data) => {
    console.log(data)
})

```

## contributing

---
_Source: https://npm.io/package/msa-node · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
