Last active
October 31, 2016 18:51
-
-
Save jhartman86/99b316aad79e77ae923250d5b0372c84 to your computer and use it in GitHub Desktop.
spamcheck.js
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 request = require("superagent"); | |
module.exports = function spamCheck(data, callback) { | |
request | |
.post("http://spamcheck.postmarkapp.com/filter") | |
.type("json") | |
.send(data) | |
.end(function (res) { | |
if (res.error) { | |
return callback(new Error("SpamCheck service failed with: " + res.text)); | |
} | |
if (!res.body.success) { | |
return callback(new Error("SpamCheck service failed with: " + res.body.message)); | |
} | |
callback(null, res.body); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment