wufoo

Wrapper for the Wufoo API (http://www.wufoo.com/docs/api/v3/)

Node-Wufoo

Node-Wufoo is a [Wufoo API] (http://www.wufoo.com/docs/api/v3/) wrapper for [node.js] (http://nodejs.org/). It simplifies working with the Wufoo API and provides an abstraction layer.

$ npm install wufoo

Each API returns it's own set of objects which is all documented on [Wufoo.com] (http://www.wufoo.com/docs/api/v3/) for reference.

   var Wufoo = require("wufoo");
   var wufoo = new Wufoo("fishbowl", "AOI6-LFKL-VM1Q-IEX9");
   
   wufoo.getForms(function(errforms) {
      // do something with your forms here. 
   });
   
   // get a specific form given the id. 
   wufoo.getForm("idofForm", function(errform){
      // do something with your form here. 
   });
   
   wufoo.getFormEntries("idofForm", function(errentries) {
      // do something with your entries here. 
   });

Get all the forms for an account. getForms returns an array of Form objects. You can also call getForm to get a specific Form.

 
   wufoo.getForms(function(errforms) {
      console.log(form.hash);
      console.log(form.name);
      console.log(form.description);
      // do something here. 
   });
   
   // get a specific form given the id. 
   wufoo.getForm("idofForm", function(errform){
      // do something here. 
   });
   

Convenience methods are provided to get entries, fields and entry count for a Form:

 
   form.getEntries(function(errentries) {
     // do something here. 
   });
   
   form.getEntriesCount(function(errcount) {
      // do something here. 
      console.log("There are " + count + " number of entries");
    });
   
    form.getFields(function(errfields) {
        // do something here. 
    });

Get all the entries for a form or report. getFormEntries and getReportEntries returns an array of Entry objects.

 
   wufoo.getFormEntries(formid, function(errentries) {
      // do something here. 
   });
 
   wufoo.getReportEntries(reportid, function(errentries) {
      // do something here. 
   });
   

Get all the reports for an account. getReports returns an array of Report objects.

 
   wufoo.getReports(function(errreports) {
      // do something here 
   });
   
   // get a specific form given the id. 
   wufoo.getReport("idofReport", function(errreport){
      // do something here. 
   });
   

Convenience methods are provided to get entries, fields and entry count for a Report:

 
   report.getEntries(function(errentries) {
     // do something here. 
   });
   
   report.getEntriesCount(function(errcount) {
      // do something here. 
      console.log("There are " + count + " number of entries");
    });
   
    report.getFields(function(errfields) {
      // do something here. 
    });

Get all the reports for a form. getFields returns an array of Field objects.

 
   wufoo.getFields(formid, function(errfields) {
      // do something here. 
   });
   

Get all the widgets for a report. getWidgets returns an array of Widget objects.

 
   wufoo.getWidgets(reportid, function(errwidgets) {
      // do something here. 
   });
   

Get all the comments for a form. getComments returns an array of Comment objects.

 
   wufoo.getComments(formid, function(errcomments) {
      // do something here. 
   });
   

Alternatively if all you need is the amount of comments for a form you can call getCommentCount:

 
   wufoo.getCommentCount(formid, function(errcount) {
      // do something here. 
   });
   

Add a [WebHook] (http://www.wufoo.com/docs/api/v3/webhooks/put/) for a form:

  
   wufoo.webhook().add("formid", "http://localhost:3000", function(errhashid) {
     // store the webhook hashid somewhere in case we want to delete them later. 
   })
   
   // pass in optional options 
   var options = {url: "http://abc.com/webhook", handshakeKey: "hand-shaking", metadata: true}
   wufoo.webhook().add("formid", options, function(errhashid) {
     // store the webhook hashid somewhere in case we want to delete them later. 
     db.put("WebHooks", {formid:form.hash, key:hashid});
   })

Delete the WebHook. [More info] (http://www.wufoo.com/docs/api/v3/webhooks/delete/):

   wufoo.webhook().delete("formid", "webhookHashId", function(errsuccess) {
     if (!success) {
       // do something. 
     }
      
   })
   

Helper methods are also provided on the Form object:

   form.addWebhook("http://localhost:3000", function(errhashid) {
      // store the webhook hashid somewhere in case we want to delete them later. 
    })
   
 
   form.deleteWebhook("webhookHashId", function(errsuccess) {
     if (!success) {
       // do something. 
     }
 
   })
 

Please fork it. Add new features or fix bugs and do a pull request. Tests should be included:

  • Fork it
  • Create your feature branch (git checkout -b feature-new-stuff).
  • Commit your changes (git commit -am 'Added some feature').
  • Push to the branch (git push origin feature-new-stuff).
  • Create new Pull Request.

Be sure to have mocha installed. Run the entire test suite from the root directory of the project:

$ mocha

Node-Wufoo implements almost all of the Wufoo RESTful API except the following:

  • Updating Entries ([POST API] (http://www.wufoo.com/docs/api/v3/entries/post/)).
  • [Login] (http://www.wufoo.com/docs/api/v3/login/).

Implementation and support of the above will be included in future versions.