Socket
Socket
Sign inDemoInstall

notifuse

Package Overview
Dependencies
3
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    notifuse

NodeJS client to interact with the Notifuse.com API.


Version published
Weekly downloads
4
Maintainers
1
Install size
5.61 MB
Created
Weekly downloads
 

Readme

Source

Node library for the Notifuse API

Notifuse connects all your notification channels (SenGrid, Mailgun, Twilio SMS, Slack, push...) to a powerful API/platform that handles templating, contacts segmentation and smart campaigns.

We recommend you to read the API Reference to understand the behavior and results of every methods.

Installation

npm install notifuse --save

Usage

var Notifuse = require('notifuse'),
    client = new Notifuse.Client(API_KEY, options);

Client options

KeyExpected value.
timeoutRequest timeout in ms. Default 5000.
maxAttemptsMax retry attempts. Default 5.
retryDelayDelay between retry attempts in ms. Default 250.
agentHttps agent for the requests.

Upsert contacts


// upsert an array of contacts

var myContact = {
  id: '123',
  profile: {
    $set: {
      firstName: 'John',
      lastName: 'Doe'
    }
  }  
};

client.contacts.upsert([myContact], function(error, result){
  if (error) {
   // handle error
  }

  // result example:
  // { 
  //   statusCode: 200,
  //   success: true,
  //   inserted: [],
  //   updated: ['123'],
  //   failed: []
  // }

});

// same with a promise

client.contacts.upsert([myContact]).then(function(result){

})
.catch(function(error){

});

Send messages


var Notifuse = require('notifuse'),
    client = new Notifuse.Client(API_KEY);

var myMessage = {
  notification: 'welcome',
  channel: 'sendgrid-acme',
  template: 'v1',
  contact: '123',
  contactProfile: {
    $set: {
      firstName: 'John',
      lastName: 'Doe'
    }
  },
  templateData: {
    _verificationToken: 'xxx'
  } 
};

client.messages.send([myMessage], function(error, result){
  if (error) {
   // handle error
  }

  // result example:
  // { 
  //   statusCode: 200,
  //   success: true,
  //   queued: [{ ... }],
  //   failed: []
  // }

});

// same with a promise

client.messages.send([myMessage]).then(function(result){

})
.catch(function(error){

});

Retrieve a message


var Notifuse = require('notifuse'),
    client = new Notifuse.Client(API_KEY);

var myMessageId = 'xxxxxxxxxxxxxxxx';

client.messages.info(myMessageId, function(error, result){
  if (error) {
   // handle error
  }

  // result is a message object defined in the API Reference
});

// same with a promise

client.messages.info([myMessage]).then(function(result){

})
.catch(function(error){

});

Support

Feel free to create a new Github issue if it concerns this library, otherwise use our contact form.

Copyright © Notifuse, Inc. MIT License; see LICENSE for further details.

Keywords

FAQs

Last updated on 03 Jul 2016

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc