Socket
Socket
Sign inDemoInstall

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.0.0 to 1.0.1

examples/transmissions/get_transmissions_by_campaign.js

26

ajh_test.js
// NODE SDK Test Key
// e2e1b620ff9cf2db919d3c40160c4851d445d454
var toApiFormat = require('./lib/toApiFormat');
var testObj = ["oneTag", "twoTag", "threeTag"];
var validationObj = ["one_tag", "two_tag", "three_tag"];
var out = toApiFormat(testObj);
console.log(out);
/*

@@ -9,5 +19,15 @@ var key = 'e2e1b620ff9cf2db919d3c40160c4851d445d454'//'YOURAPIKEY'

var SparkPost = require('./lib/sparkpost');
/*var SparkPost = require('./lib/sparkpost'),
client = new SparkPost('e2e1b620ff9cf2db919d3c40160c4851d445d454');
client.webhooks.getDocumentation(function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res.body);
console.log('Congrats you can use our SDK!');
}
});*/
/**

@@ -28,3 +48,3 @@ * Test Sending Domains

*/
/*
var trans = {

@@ -61,3 +81,3 @@ campaign: 'test-campaign',

}
});
});*/
/*

@@ -64,0 +84,0 @@ var sinon = require('sinon');

## Change Log
### v1.0.1 (2015/08/06)
- [#88](https://github.com/SparkPost/node-sparkpost/pull/88) Modified toApiFormat spec test file to fit standard naming convention. Added tests for code coverage. (@aydrian)
- [#87](https://github.com/SparkPost/node-sparkpost/pull/87) Removed dependency for snake-case (@aydrian)
- [#83](https://github.com/SparkPost/node-sparkpost/pull/83) Make sure to support sending with a stored recipient list or template, while also leaving headers and substitution data alone. (@bdeanindy)
- [#80](https://github.com/SparkPost/node-sparkpost/pull/80) Updated transmission docs and examples. (@aydrian)
- [#78](https://github.com/SparkPost/node-sparkpost/pull/78) Update Sending Domains docs and examples. (@aydrian)
- [#70](https://github.com/SparkPost/node-sparkpost/pull/70) Update examples for newly added toApiFormat (@bdeanindy)
### v1.0.0 (2015/06/06) - *breaking*

@@ -4,0 +12,0 @@ - [#68](https://github.com/SparkPost/node-sparkpost/pull/68) Added keywords for searching in npm (@nornholdj)

3

docs/resources/recipientLists.md

@@ -11,4 +11,3 @@ # Recipient Lists

* `err` - any error that occurred
* `data.res` - full response from request client
* `data.body` - payload from response
* `data` - full response from request client
* **find(options, callback)**

@@ -15,0 +14,0 @@ Retrieve details about a specified recipient list by its id

@@ -11,34 +11,21 @@ # Sending Domains

* `err` - any error that occurred
* `data.res` - full response from request client
* `data.body` - payload from response
* **find(domainName, callback)**
* `data` - full response from request client
* **find(domain, callback)**
Retrieve a sending domain by its domain name
* `domainName` - the name of the domain you want to look up **required**
* `domain` - the name of the domain you want to look up **required**
* `callback` - see all function
* **create(domainBody, callback)**
Create a new sending domain
* `domainBody` - see object description below **required**
* `domainBody` - a sending domain object **required**
* `callback` - see all function
* **update(domainBody, callback)**
Update an existing sending domain
* `domainBody` - see object description below **required**
* `domainBody` - a sending domain object **required**
* `callback` - see all function
* **verify(options, callback)**
Validate the specified verification field types for a sending domain
* `options.domainName` - the name of the domain you want to verify **required**
* `options.domain` - the name of the domain you want to verify **required**
* `options.verifyDKIM` - initiates a check against the DKIM record default: `true`
* `options.verifySPF` - initiates a check against the SPF record default: `true`
### domainBody
| Field Name | Required? | Description | Data Type |
| ---------- | --------- | --------------------------------------------------------------- | --------- |
| domainName | yes | Name of the sending domain | String |
| privateKey | yes** | Private key used to create the DKIM Signature. | String |
| publicKey | yes** | Public key to be retrieved from the DNS of the sending domain. | String |
| selector | yes** | DomainKey selector that indicates the DKIM public key location. | String |
| headers | no | Header fields to be included in the DKIM signature | String |
** - If specifying a privateKey, publicKey, or selector, all three fields are required.
## Examples

@@ -45,0 +32,0 @@

@@ -12,4 +12,3 @@ # Suppression List

* `err` - any error that occurred
* `data.res` - full response from request client
* `data.body` - payload from response
* `data` - full response from request client
* **checkStatus(email, callback)**

@@ -16,0 +15,0 @@ * `email` - `String` email address to check **required**

@@ -11,4 +11,3 @@ # Templates

* `err` - any error that occurred
* `data.res` - full response from request client
* `data.body` - payload from response
* `data` - full response from request client
* **find(options, callback)**

@@ -15,0 +14,0 @@ Retrieve details about a specified template by its id

@@ -6,14 +6,19 @@ # Transmissions

## Methods
* **all(callback)**
List an overview of all transmissions in the account.
* **all(options, callback)**
List an overview of all transmissions in the account
* `options.campaign_id` - id of the campaign used by the transmission
* `options.template_id` - id of the template used by the transmission
* `callback` - executed after task is completed. **required**
* standard `callback(err, data)`
* `err` - any error that occurred
* `data.res` - full response from request client
* `data.body` - payload from response
* `data` - full response from request client
* **find(transmissionID, callback)**
Retrieve the details about a transmission by its ID
* `transmissionID` - the id of the transmission you want to look up **required**
* `transmissionID` - id of the transmission you want to look up **required**
* `callback` - see all function
* **send(transmissionBody, callback)**
* **send(options, callback)**
Sends a message by creating a new transmission
* `options.transmissionBody` - a transmission object **required**
* `options.num_rcpt_errors` - maximum number of recipient errors returned
* `callback` - see all function

@@ -27,19 +32,17 @@

var trans = {};
var reqObj = {
transmissionBody: {
campaignId: 'first-mailing',
content: {
from: 'you@your-company.com',
subject: 'First SDK Mailing',
html: '<html><body><h1>Congratulations, {{name}}!</h1><p>You just sent your very first mailing!</p></body></html>',
text: 'Congratulations, {{name}}!! You just sent your very first mailing!'
},
substitutionData: {name: 'YOUR FIRST NAME'},
recipients: [{ address: { name: 'YOUR FULL NAME', email: 'YOUR EMAIL ADDRESS' } }]
}
};
// Set some metadata for your email
trans.campaign = 'first-mailing';
trans.from = 'you@your-company.com';
trans.subject = 'First SDK Mailing';
// Add some content to your email
trans.html = '<html><body><h1>Congratulations, {{name}}!</h1><p>You just sent your very first mailing!</p></body></html>';
trans.text = 'Congratulations, {{name}}!! You just sent your very first mailing!';
trans.substitutionData = {name: 'YOUR FIRST NAME'};
// Pick someone to receive your email
trans.recipients = [{ address: { name: 'YOUR FULL NAME', email: 'YOUR EMAIL ADDRESS' } }];
// Send it off into the world!
client.transmissions.send(trans, function(err, res) {
client.transmissions.send(reqObj, function(err, res) {
if (err) {

@@ -53,28 +56,4 @@ console.log('Whoops! Something went wrong');

```
Check out all the examples provided [here](/examples/transmissions).
## Field Descriptions
### Transmissions
| Field Name | Required? | Description | Data Type |
| ------------ | ----------- | ------------- | ----------- |
| description | no | Field for describing what this transmission is for the user | String |
| campaign | no | Field for assigning a given transmission to a specific campaign, which is a logical container for similar transmissions | String |
| metadata | no | Field for adding arbitrary key/value pairs which will be included in open/click tracking | Object (Simple) |
| substitutionData | no | Field for adding transmission level substitution data, which can be used in a variety of fields and in content | Object (Complex) |
| trackOpens | no | Field for enabling/disabling transmission level open tracking, if not set will use settings from Template | Boolean |
| trackClicks | no | Field for enabling/disabling transmission level click tracking, if not set will use settings from Template | Boolean |
| useSandbox | no | Field for enabling/disabling using sandbox domain to send transmission(You are limited to 50 messages ever with sandbox) | Boolean |
| useDraftTemplate | no | Field for allowing the sending of a transmission using a draft of a stored template (default: false) | Boolean |
| replyTo | no | Field for specifying the email address that should be used when a recipient hits the reply button | String |
| subject | yes | Field for setting the subject line of a given transmission | String |
| from | yes | Field for setting the from line of a given transmission | String or Object |
| html | yes** | Field for setting the HTML content of a given transmission | String |
| text | yes** | Field for setting the Plain Text content of a given transmission | String |
| rfc822 | no** | Field for setting the RFC-822 encoded content of a given transmission | String |
| template | no** | Field for specifying the Template ID of a stored template to be used when sending a given transmission | String |
| customHeaders | no | Field for specifying additional headers to be applied to a given transmission (other than Subject, From, To, and Reply-To) | Object (Simple) |
| recipients | yes** | Field for specifying who a given transmission should be sent to | Array of Objects |
| recipientList | no** | Field for specifying a stored recipient list ID to be used for a given transmission | String |
** - If using inline content then html or text are required. If using RFC-822 Inline Content, then rfc822 is required. If using a stored recipient list, then recipientList is required. If using a stored template, then template is required.
## Tips and Tricks

@@ -81,0 +60,0 @@ * If you specify a stored recipient list and inline recipients in a Transmission, you will receive an error.

@@ -12,4 +12,3 @@ # Webhooks

* `err` - any error that occurred
* `data.res` - full response from request client
* `data.body` - payload from response
* `data` - full response from request client
* **describe(options, callback)**

@@ -16,0 +15,0 @@ Retrieve details about a specified webhook by its id

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

var domain = {
domainName: 'example1.com',
privateKey: 'MIICXgIBAAKBgQC+W6scd3XWwvC/hPRksfDYFi3ztgyS9OSqnnjtNQeDdTSD1DRx/xFar2wjmzxp2+SnJ5pspaF77VZveN3P/HVmXZVghr3asoV9WBx/uW1nDIUxU35L4juXiTwsMAbgMyh3NqIKTNKyMDy4P8vpEhtH1iv/BrwMdBjHDVCycB8WnwIDAQABAoGBAITb3BCRPBi5lGhHdn+1RgC7cjUQEbSb4eFHm+ULRwQ0UIPWHwiVWtptZ09usHq989fKp1g/PfcNzm8c78uTS6gCxfECweFCRK6EdO6cCCr1cfWvmBdSjzYhODUdQeyWZi2ozqd0FhGWoV4VHseh4iLj36DzleTLtOZj3FhAo1WJAkEA68T+KkGeDyWwvttYtuSiQCCTrXYAWTQnkIUxduCp7Ap6tVeIDn3TaXTj74UbEgaNgLhjG4bX//fdeDW6PaK9YwJBAM6xJmwHLPMgwNVjiz3u/6fhY3kaZTWcxtMkXCjh1QE82KzDwqyrCg7EFjTtFysSHCAZxXZMcivGl4TZLHnydJUCQQCx16+M+mAatuiCnvxlQUMuMiSTNK6Amzm45u9v53nlZeY3weYMYFdHdfe1pebMiwrT7MI9clKebz6svYJVmdtXAkApDAc8VuR3WB7TgdRKNWdyGJGfoD1PO1ZE4iinOcoKV+IT1UCY99Kkgg6C7j62n/8T5OpRBvd5eBPpHxP1F9BNAkEA5Nf2VO9lcTetksHdIeKK+F7sio6UZn0Rv7iUo3ALrN1D1cGfWIh2dj3ko1iSreyNVSwGW0ePP27qDmU+u6/Y1g==',
publicKey: 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC+W6scd3XWwvC/hPRksfDYFi3ztgyS9OSqnnjtNQeDdTSD1DRx/xFar2wjmzxp2+SnJ5pspaF77VZveN3P/HVmXZVghr3asoV9WBx/uW1nDIUxU35L4juXiTwsMAbgMyh3NqIKTNKyMDy4P8vpEhtH1iv/BrwMdBjHDVCycB8WnwIDAQAB',
selector: 'brisbane',
headers: 'from:to:subject:date'
domain: 'example1.com',
dkim: {
'private': 'MIICXgIBAAKBgQC+W6scd3XWwvC/hPRksfDYFi3ztgyS9OSqnnjtNQeDdTSD1DRx/xFar2wjmzxp2+SnJ5pspaF77VZveN3P/HVmXZVghr3asoV9WBx/uW1nDIUxU35L4juXiTwsMAbgMyh3NqIKTNKyMDy4P8vpEhtH1iv/BrwMdBjHDVCycB8WnwIDAQABAoGBAITb3BCRPBi5lGhHdn+1RgC7cjUQEbSb4eFHm+ULRwQ0UIPWHwiVWtptZ09usHq989fKp1g/PfcNzm8c78uTS6gCxfECweFCRK6EdO6cCCr1cfWvmBdSjzYhODUdQeyWZi2ozqd0FhGWoV4VHseh4iLj36DzleTLtOZj3FhAo1WJAkEA68T+KkGeDyWwvttYtuSiQCCTrXYAWTQnkIUxduCp7Ap6tVeIDn3TaXTj74UbEgaNgLhjG4bX//fdeDW6PaK9YwJBAM6xJmwHLPMgwNVjiz3u/6fhY3kaZTWcxtMkXCjh1QE82KzDwqyrCg7EFjTtFysSHCAZxXZMcivGl4TZLHnydJUCQQCx16+M+mAatuiCnvxlQUMuMiSTNK6Amzm45u9v53nlZeY3weYMYFdHdfe1pebMiwrT7MI9clKebz6svYJVmdtXAkApDAc8VuR3WB7TgdRKNWdyGJGfoD1PO1ZE4iinOcoKV+IT1UCY99Kkgg6C7j62n/8T5OpRBvd5eBPpHxP1F9BNAkEA5Nf2VO9lcTetksHdIeKK+F7sio6UZn0Rv7iUo3ALrN1D1cGfWIh2dj3ko1iSreyNVSwGW0ePP27qDmU+u6/Y1g==',
'public': 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC+W6scd3XWwvC/hPRksfDYFi3ztgyS9OSqnnjtNQeDdTSD1DRx/xFar2wjmzxp2+SnJ5pspaF77VZveN3P/HVmXZVghr3asoV9WBx/uW1nDIUxU35L4juXiTwsMAbgMyh3NqIKTNKyMDy4P8vpEhtH1iv/BrwMdBjHDVCycB8WnwIDAQAB',
selector: 'brisbane',
headers: 'from:to:subject:date'
}
};

@@ -15,0 +17,0 @@

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

var domain = {
domainName: 'example1.com',
privateKey: 'MIICXgIBAAKBgQC+W6scd3XWwvC/hPRksfDYFi3ztgyS9OSqnnjtNQeDdTSD1DRx/xFar2wjmzxp2+SnJ5pspaF77VZveN3P/HVmXZVghr3asoV9WBx/uW1nDIUxU35L4juXiTwsMAbgMyh3NqIKTNKyMDy4P8vpEhtH1iv/BrwMdBjHDVCycB8WnwIDAQABAoGBAITb3BCRPBi5lGhHdn+1RgC7cjUQEbSb4eFHm+ULRwQ0UIPWHwiVWtptZ09usHq989fKp1g/PfcNzm8c78uTS6gCxfECweFCRK6EdO6cCCr1cfWvmBdSjzYhODUdQeyWZi2ozqd0FhGWoV4VHseh4iLj36DzleTLtOZj3FhAo1WJAkEA68T+KkGeDyWwvttYtuSiQCCTrXYAWTQnkIUxduCp7Ap6tVeIDn3TaXTj74UbEgaNgLhjG4bX//fdeDW6PaK9YwJBAM6xJmwHLPMgwNVjiz3u/6fhY3kaZTWcxtMkXCjh1QE82KzDwqyrCg7EFjTtFysSHCAZxXZMcivGl4TZLHnydJUCQQCx16+M+mAatuiCnvxlQUMuMiSTNK6Amzm45u9v53nlZeY3weYMYFdHdfe1pebMiwrT7MI9clKebz6svYJVmdtXAkApDAc8VuR3WB7TgdRKNWdyGJGfoD1PO1ZE4iinOcoKV+IT1UCY99Kkgg6C7j62n/8T5OpRBvd5eBPpHxP1F9BNAkEA5Nf2VO9lcTetksHdIeKK+F7sio6UZn0Rv7iUo3ALrN1D1cGfWIh2dj3ko1iSreyNVSwGW0ePP27qDmU+u6/Y1g==',
publicKey: 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC+W6scd3XWwvC/hPRksfDYFi3ztgyS9OSqnnjtNQeDdTSD1DRx/xFar2wjmzxp2+SnJ5pspaF77VZveN3P/HVmXZVghr3asoV9WBx/uW1nDIUxU35L4juXiTwsMAbgMyh3NqIKTNKyMDy4P8vpEhtH1iv/BrwMdBjHDVCycB8WnwIDAQAB',
selector: 'hello_selector',
headers: 'from:to:subject:date'
domain: 'example1.com',
dkim: {
'private': 'MIICXgIBAAKBgQC+W6scd3XWwvC/hPRksfDYFi3ztgyS9OSqnnjtNQeDdTSD1DRx/xFar2wjmzxp2+SnJ5pspaF77VZveN3P/HVmXZVghr3asoV9WBx/uW1nDIUxU35L4juXiTwsMAbgMyh3NqIKTNKyMDy4P8vpEhtH1iv/BrwMdBjHDVCycB8WnwIDAQABAoGBAITb3BCRPBi5lGhHdn+1RgC7cjUQEbSb4eFHm+ULRwQ0UIPWHwiVWtptZ09usHq989fKp1g/PfcNzm8c78uTS6gCxfECweFCRK6EdO6cCCr1cfWvmBdSjzYhODUdQeyWZi2ozqd0FhGWoV4VHseh4iLj36DzleTLtOZj3FhAo1WJAkEA68T+KkGeDyWwvttYtuSiQCCTrXYAWTQnkIUxduCp7Ap6tVeIDn3TaXTj74UbEgaNgLhjG4bX//fdeDW6PaK9YwJBAM6xJmwHLPMgwNVjiz3u/6fhY3kaZTWcxtMkXCjh1QE82KzDwqyrCg7EFjTtFysSHCAZxXZMcivGl4TZLHnydJUCQQCx16+M+mAatuiCnvxlQUMuMiSTNK6Amzm45u9v53nlZeY3weYMYFdHdfe1pebMiwrT7MI9clKebz6svYJVmdtXAkApDAc8VuR3WB7TgdRKNWdyGJGfoD1PO1ZE4iinOcoKV+IT1UCY99Kkgg6C7j62n/8T5OpRBvd5eBPpHxP1F9BNAkEA5Nf2VO9lcTetksHdIeKK+F7sio6UZn0Rv7iUo3ALrN1D1cGfWIh2dj3ko1iSreyNVSwGW0ePP27qDmU+u6/Y1g==',
'public': 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC+W6scd3XWwvC/hPRksfDYFi3ztgyS9OSqnnjtNQeDdTSD1DRx/xFar2wjmzxp2+SnJ5pspaF77VZveN3P/HVmXZVghr3asoV9WBx/uW1nDIUxU35L4juXiTwsMAbgMyh3NqIKTNKyMDy4P8vpEhtH1iv/BrwMdBjHDVCycB8WnwIDAQAB',
selector: 'hello_selector',
headers: 'from:to:subject:date'
}
};

@@ -15,0 +17,0 @@

@@ -7,3 +7,3 @@ 'use strict';

, options = {
domainName: 'example1.com'
domain: 'example1.com'
};

@@ -10,0 +10,0 @@

@@ -7,3 +7,3 @@ 'use strict';

, options = {
domainName: 'example1.com'
domain: 'example1.com'
, verifySPF: false

@@ -10,0 +10,0 @@ };

@@ -7,3 +7,3 @@ 'use strict';

, options = {
domainName: 'example1.com'
domain: 'example1.com'
, verifyDKIM: false

@@ -10,0 +10,0 @@ };

@@ -7,13 +7,19 @@ 'use strict';

var trans = {
from: 'From Envelope <from@example.com>',
recipients: [{ address: { email: 'john.doe@example.com' } }],
subject: 'Example Email for MIME Parts',
html: '<html><body><p>Hello World!</p></body></html>',
text: 'Hello World!',
trackOpens: true,
trackClicks: true
var reqObj = {
transmissionBody: {
recipients: [{ address: { email: 'john.doe@example.com' } }],
content: {
from: 'From Envelope <from@example.com>',
subject: 'Example Email for MIME Parts',
html: '<html><body><p>Hello World!</p></body></html>',
text: 'Hello World!'
},
options: {
open_tracking: true,
click_tracking: true
}
}
};
client.transmissions.send({transmissionBody: trans}, function(err, res) {
client.transmissions.send(reqObj, function(err, res) {
if (err) {

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

@@ -7,10 +7,12 @@ 'use strict';

var trans = {
recipients: [{ address: { email: 'john.doe@example.com' } }],
rfc822: 'Content-Type: text/plain\nFrom: From Envelope <from@example.com>\nSubject: Example Email\n\nHello World',
from: 'From Envelope <from@example.com>',
subject: 'Example Email for RFC-822 Content'
var reqObj = {
transmissionBody: {
recipients: [{address: {email: 'john.doe@example.com'}}],
content: {
email_rfc822: 'Content-Type: text/plain\nFrom: From Envelope <from@example.com>\nSubject: Example Email\n\nHello World'
}
}
};
client.transmissions.send({transmissionBody: trans}, function(err, res) {
client.transmissions.send(reqObj, function(err, res) {
if (err) {

@@ -17,0 +19,0 @@ console.log(err);

@@ -1,39 +0,59 @@

'use strict';
"use strict";
var key = 'YOURAPIKEY'
, SparkPost = require('sparkpost')
var key = "YOURAPIKEY"
, SparkPost = require("sparkpost")
, client = new SparkPost(key);
var trans = {
campaign: 'my-campaign',
metadata: {
sample_campaign: true,
type: 'these are custom fields'
},
substitutionData: {
name: 'Test Name'
},
description: 'my description',
replyTo: 'reply@test.com',
customHeaders: {
'X-Custom-Header': 'Sample Custom Header'
},
trackOpens: true,
trackClicks: true,
useSandbox: true,
useDraftTemplate: true,
from: 'From Envelope <from@example.com>',
html: '<p>Hello World! Your name is: {{name}}</p>',
text: 'Hello World!',
subject: 'Example Email for All Fields',
recipients: [
{
address: {
email: 'john.doe@example.com'
var reqOpts = {
transmissionBody: {
options: {
open_tracking: true,
click_tracking: true
},
campaign_id: "christmas_campaign",
return_path: "bounces-christmas-campaign@flintstone.com",
metadata: {
user_type: "students"
},
substitution_data: {
sender: "Big Store Team"
},
recipients: [
{
return_path: "123@bounces.flintstone.com",
address: {
email: "wilma@flintstone.com",
name: "Wilma Flintstone"
},
tags: [
"greeting",
"prehistoric",
"fred",
"flintstone"
],
metadata: {
place: "Bedrock"
},
substitution_data: {
customer_type: "Platinum"
}
}
],
content: {
from: {
name: "Fred Flintstone",
email: "fred@flintstone.com"
},
subject: "Big Christmas savings!",
reply_to: "Christmas Sales <sales@flintstone.com>",
headers: {
"X-Customer-Campaign-ID": "christmas_campaign"
},
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>"
}
]
}
};
client.transmissions.send({transmissionBody: trans}, function(err, res) {
client.transmissions.send(reqOpts, function(err, res) {
if (err) {

@@ -43,4 +63,4 @@ console.log(err);

console.log(res.body);
console.log('Congrats you can use our SDK!');
console.log("Congrats you can use our SDK!");
}
});

@@ -7,11 +7,17 @@ 'use strict';

var trans = {
from: 'From Envelope <from@example.com>',
recipientList: 'example-list',
subject: 'Example Email for Stored List and Inline Content',
html: '<html><body><p>Hello World</p></body></html>',
text: 'Hello World!'
var reqObj = {
transmissionBody: {
recipients: {
list_id: 'example-list'
},
content: {
from: 'From Envelope <from@example.com>',
subject: 'Example Email for Stored List and Inline Content',
html: '<html><body><p>Hello World</p></body></html>',
text: 'Hello World!'
}
}
};
client.transmissions.send({transmissionBody: trans}, function(err, res) {
client.transmissions.send(reqObj, function(err, res) {
if (err) {

@@ -18,0 +24,0 @@ console.log(err);

@@ -7,11 +7,16 @@ 'use strict';

var trans = {
from: 'From Envelope <from@example.com>',
subject: 'Example Email for Stored List and Template',
recipientList: 'example-list',
template: 'my-template',
recipients: [{ address: { email: 'john.doe@example.com' } }]
var reqOpts = {
transmissionBody: {
recipients: {
list_id: 'example-list'
},
content: {
from: 'From Envelope <from@example.com>',
subject: 'Example Email for Stored List and Template',
template_id: 'my-template'
}
}
};
client.transmissions.send({transmissionBody: trans}, function(err, res) {
client.transmissions.send(reqOpts, function(err, res) {
if (err) {

@@ -18,0 +23,0 @@ console.log(err);

@@ -7,10 +7,14 @@ 'use strict';

var trans = {
template: 'my-template',
from: 'From Envelope <example@sparkpostbox.com>',
subject: 'Example Email for Stored Template',
recipients: [{ address: { email: 'john.doe@example.com' } }]
var reqOpts = {
transmissionBody: {
recipients: [{ address: { email: 'john.doe@example.com' } }],
content: {
template_id: 'my-template',
from: 'From Envelope <example@sparkpostbox.com>',
subject: 'Example Email for Stored Template'
}
}
};
client.transmissions.send({transmissionBody: trans}, function(err, res) {
client.transmissions.send(reqOpts, function(err, res) {
if (err) {

@@ -17,0 +21,0 @@ console.log(err);

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

var obj = toApiFormat(domainBody);
console.log( obj );
var options = {

@@ -81,0 +80,0 @@ uri: api + '/' + obj.domain

@@ -8,15 +8,10 @@ 'use strict';

// List of property names which we do not want to modify the sub-property names
var excludeList = ['recipients', 'substitution_data', 'tags', 'metadata', 'content', 'attributes', 'headers'];
var excludeList = ['substitution_data', 'tags', 'metadata', 'attributes', 'headers'];
try{
// Handle arrays
if(Array.isArray(source) && _.isObject(source[0])) {
// Handle arrays (Only need to handle arrays of objects for our use case.)
if(Array.isArray(source) && _.isPlainObject(source[0])) {
dest = [];
for(var i = 0; i < source.length; i++) {
// Exclude appropriately
if( -1 === excludeList.indexOf(source[i])) {
dest.push(toApiFormat(source[i]));
} else {
dest.push(source[i]);
}
dest.push(toApiFormat(source[i]));
}

@@ -23,0 +18,0 @@ return dest;

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

@@ -42,5 +42,4 @@ "main": "./lib/sparkpost.js",

"lodash": "3.9.3",
"request": "2.42.0",
"snake-case": "^1.1.1"
"request": "2.42.0"
}
}

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