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

sparkpost

Package Overview
Dependencies
Maintainers
4
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sparkpost - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

docs/resources/messageEvents.md

35

ajh_test.js

@@ -12,3 +12,3 @@ // NODE SDK Test Key

client.sendingDomains.all(function(err, res) {
/*client.sendingDomains.all(function(err, res) {
if (err) {

@@ -20,3 +20,3 @@ console.log(err);

}
});
});*/

@@ -39,4 +39,4 @@

*/
/*
var trans = {
/*var trans = {
campaign: 'test-campaign',

@@ -61,5 +61,26 @@ substitutionData: {

]
};*/
var txBody = {
"options": {
"open_tracking": true,
"click_tracking": true
},
"substitution_data": {
"signature": "Ayrat"
},
"recipients": [
{
"address": {
"email": "aydrian@gmail.com"
}
}
],
"content": {
"template_id": "test-template",
"from": "aydrian@gmail.com"
}
};
client.transmissions.send({transmissionBody: trans }, function(err, res) {
client.transmissions.send({transmissionBody: txBody }, function(err, res) {
if (err) {

@@ -69,7 +90,7 @@ console.log(err);

} else {
console.log(res.res.statusCode);
console.log(res.statusCode);
console.log(res.body);
console.log('Congrats you can use our SDK!');
}
});*/
});
/*

@@ -76,0 +97,0 @@ var sinon = require('sinon');

## Change Log
### v1.2.0 (2016/03/14)
- [#109](https://github.com/SparkPost/node-sparkpost/pull/109) README updates (@aydrian)
- [#108](https://github.com/SparkPost/node-sparkpost/pull/108) removes from and subject from transmission stored template send example (@colestrode)
- [#106](https://github.com/SparkPost/node-sparkpost/pull/106) correcting send_transmission_all_fields.js example (@lfreneda)
- [#104](https://github.com/SparkPost/node-sparkpost/pull/104) Added a mocha test task to the default grunt task (@ewandennis)
- [#101](https://github.com/SparkPost/node-sparkpost/pull/101) Added gzipped response support (@ewandennis)
- [#100](https://github.com/SparkPost/node-sparkpost/pull/100) Added message events wrapper (@ewandennis)
- [#97](https://github.com/SparkPost/node-sparkpost/pull/97) Add nodejs versions to TravisCI (@richleland)
### v1.1.0 (2015/08/13)

@@ -4,0 +13,0 @@ - [#92](https://github.com/SparkPost/node-sparkpost/pull/92) Added Coveralls.io (@aydrian)

4

examples/transmissions/send_transmission_all_fields.js

@@ -52,4 +52,4 @@ "use strict";

},
text: "Hi {{address.name}} \nSave big this Christmas in your area {{place}}! \nClick http://www.mysite.com and get huge discount\n Hurry, this offer is only to {{user_type}}\n {{sender}}",
html: "<p>Hi {{address.name}} \nSave big this Christmas in your area {{place}}! \nClick http://www.mysite.com and get huge discount\n</p><p>Hurry, this offer is only to {{user_type}}\n</p><p>{{sender}}</p>"
text: "Hi {{address.name}} \nSave big this Christmas in your area {{place}}! \nClick http://www.mysite.com and get huge discount\n Hurry, this offer is only to {{customer_type}}\n {{sender}}",
html: "<p>Hi {{address.name}} \nSave big this Christmas in your area {{place}}! \nClick http://www.mysite.com and get huge discount\n</p><p>Hurry, this offer is only to {{customer_type}}\n</p><p>{{sender}}</p>"
}

@@ -56,0 +56,0 @@ }

@@ -9,8 +9,8 @@ 'use strict';

transmissionBody: {
recipients: [{ address: { email: 'john.doe@example.com' } }],
campaignId: 'ricks-campaign',
content: {
template_id: 'my-template',
from: 'From Envelope <example@sparkpostbox.com>',
subject: 'Example Email for Stored Template'
}
template_id: 'ricks-template'
},
'num_rcpt_errors': 3,
recipients: [{ address: { email: 'rick.sanchez@rickandmorty100years.com', name: 'Rick Sanchez' } }]
}

@@ -24,4 +24,4 @@ };

console.log(res.body);
console.log('Congrats you can use our SDK!');
console.log('What up my glib globs! SparkPost!');
}
});

@@ -48,3 +48,3 @@ var matchdep = require('matchdep')

shell: {
test: {
coverage: {
command : '<%= config.binPath %>/istanbul cover --report lcov --dir test/reports/ <%= config.binPath %>/_mocha test/spec -- --reporter ' + reporter,

@@ -55,2 +55,5 @@ options : {

}
},
test: {
command: '<%= config.binPath %>/_mocha test/spec'
}

@@ -74,3 +77,4 @@ },

'lint',
'shell:test'
'shell:test',
'shell:coverage'
]);

@@ -77,0 +81,0 @@

@@ -64,2 +64,3 @@ 'use strict';

this.webhooks = require('./webhooks')(this);
this.messageEvents = require('./messageEvents')(this);
};

@@ -88,2 +89,7 @@

// default to accepting gzipped responses
if (typeof options.gzip === 'undefined') {
options.gzip = true;
}
request(options, function(err, res, body) {

@@ -90,0 +96,0 @@ var invalidCodeRegex = /(5|4)[0-9]{2}/;

{
"name": "sparkpost",
"version": "1.1.0",
"version": "1.2.0",
"description": "A Node.js wrapper for interfacing with your favorite SparkPost APIs",

@@ -35,3 +35,3 @@ "main": "./lib/sparkpost.js",

"mocha": "1.21.4",
"nock": "^1.6.1",
"nock": "^7.2.2",
"proxyquire": "1.0.1",

@@ -38,0 +38,0 @@ "sinon": "^1.14.1",

@@ -1,8 +0,11 @@

[![Travis CI](https://travis-ci.org/SparkPost/node-sparkpost.svg?branch=master)](https://travis-ci.org/SparkPost/node-sparkpost) [![Coverage Status](https://coveralls.io/repos/SparkPost/node-sparkpost/badge.svg?branch=master&service=github)](https://coveralls.io/github/SparkPost/node-sparkpost?branch=master)
<a href="https://www.sparkpost.com"><img src="https://www.sparkpost.com/sites/default/files/attachments/SparkPost_Logo_2-Color_Gray-Orange_RGB.svg" width="200px"/></a>
![SparkPost Build by MessageSystems](/docs/sparkpost_logo.png)
# Node.js SDK
[Sign up](https://app.sparkpost.com/sign-up?src=Dev-Website&sfdcid=70160000000pqBb) for a SparkPost account and visit our [Developer Hub](https://developers.sparkpost.com) for even more content.
The official Node.js binding for your favorite [SparkPost APIs](https://www.sparkpost.com/api)!
# Node.js Client Library
[![Travis CI](https://travis-ci.org/SparkPost/node-sparkpost.svg?branch=master)](https://travis-ci.org/SparkPost/node-sparkpost) [![Coverage Status](https://coveralls.io/repos/SparkPost/node-sparkpost/badge.svg?branch=master&service=github)](https://coveralls.io/github/SparkPost/node-sparkpost?branch=master) [![NPM version](https://badge.fury.io/js/sparkpost.png)](http://badge.fury.io/js/sparkpost) [![Slack Status](http://slack.sparkpost.com/badge.svg)](http://slack.sparkpost.com)
The official Node.js binding for your favorite [SparkPost APIs](https://developers.sparkpost.com/api)!
## Prerequisites

@@ -79,5 +82,5 @@

## Using the Node SDK Base Object
We may not wrap every resource available in the SparkPost SDK, for example the Node SDK does not wrap the Metrics resource,
but you can use the Node SDK Base Object to form requests to these unwrapped resources. Here is an example request using the
## Using the Node Client Library Base Object
We may not wrap every resource available in the SparkPost Client Library, for example the Node Client Library does not wrap the Metrics resource,
but you can use the Node Client Library Base Object to form requests to these unwrapped resources. Here is an example request using the
base object to make requests to the Metrics resource. Here is an example request using the base object to make requests to

@@ -102,5 +105,6 @@ the Metrics resource.

## SparkPost API Resources Supported in Node SDK
## SparkPost API Resources Supported in Node Client Library
Click on the desired API to see usage and more information
* [Message Events](/docs/resources/messageEvents.md) - `client.messageEvents` ([examples](/examples/messageEvents))
* [Recipient Lists](/docs/resources/recipientLists.md) - `client.recipientLists` ([examples](/examples/recipientLists))

@@ -107,0 +111,0 @@ * [Sending Domains](/docs/resources/sendingDomains.md) - `client.sendingDomains` ([examples](/examples/sendingDomains))

@@ -5,2 +5,3 @@ var chai = require('chai')

, sinonChai = require('sinon-chai')
, zlib = require('zlib')
, nock = require('nock')

@@ -169,2 +170,60 @@ , SparkPost = require('../../lib/sparkpost');

});
it('should accept gzipped responses', function(done) {
var TEST_MESSAGE = 'This is a compressible test and it is full of compressible test stuff.'
, compressedMsg
, gzipNock
, options = {
method: 'GET'
, uri: 'https://test.sparkpost.com/test'
};
zlib.gzip(TEST_MESSAGE+TEST_MESSAGE, function(err, gzipped) {
expect(err).to.be.null;
compressedMsg = gzipped;
gzipNock = nock('https://test.sparkpost.com', {
reqheaders: {
'accept-encoding': 'gzip'
}
})
.get('/test')
.reply(200, compressedMsg, {
'X-Transfer-Length': String(compressedMsg.length)
, 'Content-Length': undefined
, 'Content-Encoding': 'gzip'
});
client.request(options, function(err, data) {
expect(err).to.be.null;
expect(data.statusCode).to.equal(200);
expect(data.body).to.equal(TEST_MESSAGE + TEST_MESSAGE);
// finish async test
done();
});
});
});
it('should support explicitly disabled gzip option', function(done) {
var TEST_MESSAGE = 'This is an uncompressed test message';
nock('https://test.sparkpost.com')
.get('/test')
.reply(200, TEST_MESSAGE);
var options = {
method: 'GET'
, uri: 'https://test.sparkpost.com/test'
, gzip: false
};
client.request(options, function(err, data) {
expect(err).to.be.null;
expect(data.statusCode).to.equal(200);
expect(data.body).to.equal(TEST_MESSAGE);
expect(data.headers).not.to.have.property('content-encoding');
// finish async test
done();
});
});
});

@@ -171,0 +230,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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