Skip to content

Instantly share code, notes, and snippets.

@jhartman86
Last active October 31, 2016 18:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jhartman86/99b316aad79e77ae923250d5b0372c84 to your computer and use it in GitHub Desktop.
Save jhartman86/99b316aad79e77ae923250d5b0372c84 to your computer and use it in GitHub Desktop.
spamcheck.js
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