Giter VIP home page Giter VIP logo

node-expert-sender's Introduction

node-expert-sender

Install

npm install expert-sender

Usage

var ExpertSender = require('expert-sender');
var expertSender = new ExpertSender({
	url: 'https://api.esv2.com/',
	key: 'yourKey'
});

expertSender.addUserToList({
	email: '[email protected]',
	listId: 1,
}).then(function (res) {
	console.log('success');
}).catch(function (err){
	console.log(err);
});

Methods

addUserToList(options)

Add subscriber to list

Parameters

options may contain next properties:

  • email - subscriber's email (required)
  • listId - id of list (required)
  • id - user id (if you want to change subscriber's email)
  • firstName - subscriber's first name
  • lastName - subscriber's last name
  • name - subscriber's full name (first name + last name)
  • trackingCode - id of source (form, web-site, etc.)
  • vendor - id/name of traffic type
  • ip - subscriber's IP
  • properties - array of extra properties (see example below)

Example

expertSender.addUserToList({
	email: '[email protected]',
	listId: 1,
	name: 'User',
	ip: '127.0.0.1',
	properties: [
		{ id: 1, value: 'qwerty' },
		{ id: 100, value: 123 }
	]
});

getLists(options)

Parameters

options contains:

  • seedLists - boolean, if true - test subscriber lists will be returned, defaults to false

Example

expertSender.getLists({
	seedLists: true
});

getUser(options)

Receive short, long, fully information about user or event history

Parameters

options contains:

  • email - subscriber's email (required)
  • options - one of Short, Long, Full, EventHistory

Example

expertSender.getUser({
	email: '[email protected]',
	options: 'Full'
});

createNewsletter(options)

Send email to specified recipients

Parameters

options contains:

  • recipients - object with lists for sending mailings. Must contain at least one of seedLists, subscriberLists or subscriberSegments (required, see example below)
  • content - object with next properties
    • fromName - string displaying in from email field (required)
    • fromEmail - email displaying in from email field (required)
    • subject - subject of email (required)
    • html - html body (required html or plain)
    • plain - plain text body (required html or plain)
    • replyToName - string displaying in reply-to email field
    • replyToEmail - email displaying in reply-to email field
    • header - header template id
    • footer - footer template id

Example

expertSender.createNewsletter({
	recipients: {
		seedLists: [39, 25],
		subscriberLists: [2, 3, 5, 8]
	},
	content: {
		fromName: 'Test',
		fromEmail: '[email protected]',
		subject: 'Hello',
		html: '<h1 style="color:#ff0000;">Hello world!</h1>'
	}
});

Note

ExpertSender API documentation is here.

node-expert-sender's People

Contributors

s0ph1e avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.