# app-notify

> Send SMS and email notifications from within your node.js app

Latest version **2.3.0** (published 2022-12-21) · ISC license · 0 weekly downloads

## Install

```sh
npm install app-notify
pnpm add app-notify
yarn add app-notify
bun add app-notify
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.3.0 |
| Published | 2022-12-21 |
| First published | 2014-12-14 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 15.9 KB |
| Known vulnerabilities | 0 (+22 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 80 |
| Author | Anthony Ettinger |
| Maintainers | chovy |
| Keywords | notifications, notify, application, email, sms, node |

## Links

- npm: https://www.npmjs.com/package/app-notify
- Repository: https://github.com/chovy/app-notify
- npm.io page: https://npm.io/package/app-notify

## Dependencies (5)

- [q](https://npm.io/package/q.md) ^1.5.1
- [async](https://npm.io/package/async.md) ^3.1.0
- [lodash](https://npm.io/package/lodash.md) ^4.17.15
- [twilio](https://npm.io/package/twilio.md) ^3.35.1
- [nodemailer](https://npm.io/package/nodemailer.md) ^6.3.0

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 2.3.0 (latest) — 2022-12-21
- 2.2.2 — 2019-10-21
- 2.2.1 — 2019-10-21
- 2.2.0 — 2019-10-21
- 2.1.2 — 2019-10-08
- 2.1.1 — 2019-10-08
- 2.1.0 — 2019-10-08
- 2.0.2 — 2015-01-10
- 2.0.1 — 2015-01-10
- 2.0.0 — 2014-12-30
- 1.3.1 — 2014-12-29
- 1.2.0 — 2014-12-23
- 1.1.1 — 2014-12-14
- 1.1.0 — 2014-12-14
- 1.0.0 — 2014-12-14

## README

app-notify
==========

Send Twilio SMS and SMTP email notifications from within your node.js app

# install

```shell
npm install app-notify
```

```javascript
const Notify = require('app-notify');
const cfg = {...};
const notify = new Notify(cfg);
```

# usage (promises)

### Send an email message:

```javascript
const cfg = {};

//setup smtp server
cfg.smtp = {
    host: xxx,
    user: user,
    pass: pass,
    port: port
};

//setup email headers
cfg.email = {
    to: 'user@example.com',
    from: 'sender@example.com'
};

const Notify = require('app-notify');
const notify = new Notify(cfg);

//send an email
notify.email.send({
    subject: 'This is a test',
    message: 'Hello world!'
})
.then(function(data){
    console.log(data);
})
.catch(function(err){
    console.error(err);
});
```

### Send an SMS message    

```javascript
const cfg = {};

//setup sms configuration
cfg.sms = {
    sid: 'twilio-sid-id',
    auth: 'twilio-auth-id',
    to: 'xxx-xxx-xxxx', //recipient
    from: 'yyy-yyy-yyyy' //your twilio assigned phone number
};

const Notify = require('app-notify');
const notify = new Notify(cfg);

notify.sms.send({
    message: 'Hello world'
})
.then(function(data){
    console.log(data);
})
.catch(function(err){
    console.error(err);
});
```

### Send to whichever services we have enabled (both sms and email):

```javascript
const cfg = {};

//setup smtp server
cfg.smtp = {
    host: xxx,
    user: user,
    pass: pass,
    port: port
};

//setup email headers
cfg.email = {
    to: 'user@example.com',
    from: 'sender@example.com'
};

const Notify = require('app-notify');
const notify = new Notify(cfg);

//sends both
notify.send({
    subject: 'This is a test',
    message: 'Hello world'
});

//disable email
notify.cfg.email.disabled = true;

//sends only sms
notify.send({
    message: 'Hello world',
});
```

# usage (callbacks)

app-notify can be used with callbacks too!

# run tests

```shell
gulp test
```

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