-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathupsert_bulk.js
47 lines (44 loc) · 1.07 KB
/
upsert_bulk.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
'use strict';
var key = 'YOURAPIKEY'
, SparkPost = require('sparkpost')
, client = new SparkPost(key)
, listEntries = [
{
recipient: '[email protected]',
transactional: false,
non_transactional: true,
description: 'Test description 1'
},
{
recipient: '[email protected]',
transactional: true,
non_transactional: true,
description: 'Test description 2'
},
{
recipient: '[email protected]',
transactional: true,
non_transactional: false,
description: 'Test description 3'
}
];
// Promise
client.suppressionList.upsert(listEntries)
.then(data => {
console.log('Congrats you can use our client library!');
console.log(data);
})
.catch(err => {
console.log('Whoops! Something went wrong');
console.log(err);
});
// Callback
client.suppressionList.upsert(listEntries, function(err, data) {
if (err) {
console.log('Whoops! Something went wrong');
console.log(err);
} else {
console.log('Congrats you can use our client library!');
console.log(data);
}
});