Last active
May 12, 2019 17:02
-
-
Save jsartisan/0b9a928997d13cf2c97d2b693811e891 to your computer and use it in GitHub Desktop.
Owney NodeJs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require("https"); | |
var options = { | |
"method": "POST", | |
"hostname": "https://owneymail.com", | |
"port": null, | |
"path": "/api/v1/owney/go", | |
"headers": { | |
"authorization": "Bearer <<YOUR_API_KEY>>", | |
"content-type": "application/json" | |
} | |
}; | |
var req = http.request(options, function (res) { | |
var chunks = []; | |
res.on("data", function (chunk) { | |
chunks.push(chunk); | |
}); | |
res.on("end", function () { | |
var body = Buffer.concat(chunks); | |
console.log(body.toString()); | |
}); | |
}); | |
req.write(JSON.stringify({ | |
"templateCode":"WELCOME", | |
"content":{ | |
"title" : "John Doe", | |
"hero" : "https://colorlib.com/etc/email-template/1/images/bg_1.jpg" | |
}, | |
"from":"hi@owneymail.com", | |
"to":["noreply@johnDoe.com"], | |
"cc":["noreply@johnDoe.com"], | |
"bcc":["noreply@johnDoe.com"] | |
})); | |
req.end(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment