-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathupsert.js
More file actions
33 lines (30 loc) · 774 Bytes
/
upsert.js
File metadata and controls
33 lines (30 loc) · 774 Bytes
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
'use strict';
var key = 'YOURAPIKEY'
, SparkPost = require('sparkpost')
, client = new SparkPost(key)
, listEntry = {
recipient: 'test1@test.com',
transactional: false,
non_transactional: true,
description: 'Test description 1'
};
// Promise
client.suppressionList.upsert(listEntry)
.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(listEntry, 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);
}
});