Skip to content

Instantly share code, notes, and snippets.

@ancillaryfactory
Last active August 29, 2015 14:20
Show Gist options
  • Save ancillaryfactory/c868751b8ae1399a7c54 to your computer and use it in GitHub Desktop.
Save ancillaryfactory/c868751b8ae1399a7c54 to your computer and use it in GitHub Desktop.
Post WuFoo entry from NodeJS/Express
var express = require('express');
var router = express.Router();
var request = require("request");
router.post('/send', function(req, res, next) {
var entry = {
email: req.body.email,
comment: req.body.comment
}
var options = {
uri: "https://<subdomain>.wufoo.com/api/v3/forms/<formid>/entries.json",
method: "POST",
headers: {
"Authorization" : "Basic " + new Buffer("<API Key>:footastic").toString("base64")
},
form: {'Field1': entry.email, 'Field2': entry.comment}
};
var reply = function(val){
res.json(val);
}
var check = request(options, function(err, res, body) {
reply(res.body);
});
});
module.exports = router;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment