-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathupdate.js
More file actions
34 lines (31 loc) · 813 Bytes
/
update.js
File metadata and controls
34 lines (31 loc) · 813 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
34
'use strict';
var key = 'YOURAPIKEY'
, SparkPost = require('sparkpost')
, client = new SparkPost(key)
, template = {
content: {
from: 'test@test.com',
subject: 'Updated Test email template!',
html: '<b>This is a test email template! Updated!</b>'
}
};
// Promise
client.templates.update('TEST_ID', template)
.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.templates.update('TEST_ID', template, 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);
}
});