Socket
Book a DemoInstallSign in
Socket

elastic-email-promise

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

elastic-email-promise

LITE & EASY Elastic Email API Wrapper with ES 2015 Promises.

1.0.1
latest
Source
npmnpm
Version published
Weekly downloads
7
250%
Maintainers
1
Weekly downloads
 
Created
Source

This LITE Wrapper, allows you to quickly and easily use the Elastic Email API v2 via Node.js and with ES 2015 Promises.

Latest Stable Version License NPM Downloads

Quick Examples:

Install:

npm i elastic-email-promise

Set up your client:

const ee = require( 'elastic-email-promise' );
const eeClient = ee.Client( { apikey: 'Your Apikey' } );

request method with only api key required:

eeClient.request( '/account/load' )
    .then( function( data ) { console.log( data ) } )
    .catch( function( error ) { console.log( error ) } );

request method with more parameters:

eeClient.request( '/contact/findcontact', { email: 'example@example.com' } )
    .then( function( data ) { console.log( data ) } )
    .catch( function( error ) { console.log( error.message ) } )

request method with file upload:

const fs = require('fs');

eeClient.request( '/contact/upload', {
    contactFile: fs.createReadStream('CSV_Sample1.csv')
    })
	.then( function( data ) { console.log( data ) } )
	.catch( function( error ) { console.log( error.message ) } )

Request method:

 eepromise.request( 'path', { params } );

path : string; path for method (f.e. "/channel/list") params: object; parameters for method return => Promise Object with respond

More information about EE Api methods you can find in EE API Documentation

How does elastic-email-promise pass Elastic Email response?

Elastic Email API (version 2) response dosen't have correct HTTP status code. All responses are JSON string:

//On success
{success: true, data: /* response data it could be array or object */}
//On false
{success: false, error: 'error message as string'}
  • Elastic Email Promise will try parse response to JSON.
  • If something goes wrong, the exception be thrown to Promise reject
  • Then JSON success parameter will be check.
  • If true: resolve( data );
  • If false: reject( new Error( error ) );

Keywords

Elastic Email

FAQs

Package last updated on 10 Jul 2017

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.