Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

app-notify

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

app-notify

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

  • 2.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

app-notify

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

install

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

usage (promises)

Send an email message:

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({
    subject: 'This is a test',
    message: 'Hello world!'
})
.then(function(data){
    console.log(data);
})
.catch(function(err){
    console.error(err);
});

Send an SMS message

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({
    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):

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

gulp test

Keywords

FAQs

Package last updated on 08 Oct 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc