Skip to content

Instantly share code, notes, and snippets.

@jsartisan
Last active May 12, 2019 17:02
Show Gist options
  • Save jsartisan/0b9a928997d13cf2c97d2b693811e891 to your computer and use it in GitHub Desktop.
Save jsartisan/0b9a928997d13cf2c97d2b693811e891 to your computer and use it in GitHub Desktop.
Owney NodeJs
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