Node-Wufoo
Node-Wufoo is a Wufoo API wrapper for node.js. It simplifies working with the Wufoo API and provides an abstraction layer.
Installation
$ npm install wufoo
Usage
Each API returns it's own set of objects which is all documented on Wufoo.com for reference.
The required node version is 8.0.0 and above for all releases above v1.1.0.
Example
var Wufoo = ; var wufoo = "fishbowl" "AOI6-LFKL-VM1Q-IEX9"; wufoo; // get a specific form given the id. wufoo; wufoo; // pass in optional query parameters var optionalQuery = pretty: true wufoo; // get a specific form given the id and pass in optional query parameters wufoo; wufoo;
Forms
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; // get a specific form given the id. wufoo; // pass in optional query parameters var optionalQuery = pretty: true wufoo; // get a specific form given the id and pass in optional query parameters wufoo;
Convenience methods are provided to get entries, fields and entry count for a Form
:
form; form; form; // pass in optional query parameters var optionalQuery = pretty: true form; form; form;
Entries
Get all the entries for a form or report. getFormEntries
and getReportEntries
returns an array of Entry
objects.
wufoo; wufoo; // pass in optional query parameters var optionalQuery = pretty: true wufoo; wufoo;
Reports
Get all the reports for an account. getReports
returns an array of Report
objects.
wufoo; // get a specific form given the id. wufoo; // pass in optional query parameters var optionalQuery = pretty: true wufoo; // get a specific form given the id. wufoo;
Convenience methods are provided to get entries, fields and entry count for a Report:
report; report; report; // pass in optional query parameters var optionalQuery = pretty: true report; report; report;
Fields
Get all the reports for a form. getFields
returns an array of Field
objects.
wufoo; // pass in optional query parameters var optionalQuery = pretty: true wufoo;
Widgets
Get all the widgets for a report. getWidgets
returns an array of Widget
objects.
wufoo; // pass in optional query parameters var optionalQuery = pretty: true wufoo;
Comments
Get all the comments for a form. getComments
returns an array of Comment
objects.
wufoo; // pass in optional query parameters var optionalQuery = pretty: true wufoo;
Alternatively if all you need is the amount of comments for a form you can call getCommentCount
:
wufoo; // pass in optional query parameters var optionalQuery = pretty: true wufoo;
WebHooks
Add a WebHook for a form:
wufoo // pass in optional options var options = url: "http://abc.com/webhook" handshakeKey: "hand-shaking" metadata: true wufoo
Delete the WebHook. More info:
wufoo
Helper methods are also provided on the Form
object:
form form
Promises
Every single API documented above have an alternate version that supports promises. For the preferred method of using promises or await/async instead of callbacks append Async
to the end of the function name. For example, the following are all valid:
from.addWebhookAsync
wufoo.getCommentCountAsync
wufoo.getWidgetsAsync
And so on. Calling wufoo.getCommentCountAsync
will be as follows:
wufoo ;
Contributions
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.
Testing
Be sure to have mocha installed. Run the entire test suite from the root directory of the project by running the command:
$ mocha
or
$ npm test
Future Versions
Node-Wufoo implements all of the Wufoo RESTful API except the following:
Implementation and support of the above will be included in future versions. Contributions welcome!