Last active
May 12, 2019 17:02
-
-
Save jsartisan/0b9a928997d13cf2c97d2b693811e891 to your computer and use it in GitHub Desktop.
Owney NodeJs
This file contains hidden or 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":"[email protected]", | |
"to":["[email protected]"], | |
"cc":["[email protected]"], | |
"bcc":["[email protected]"] | |
})); | |
req.end(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment