Drip Node client library (unofficial)
![Build Status](https://travis-ci.org/crowdcst/drip-node.svg?branch=master)
A Node toolkit for the Drip API. Based on the official Ruby client library:
Installation
Requirements:
yarn
yarn add drip-api
npm
npm i drip-api --save
Authentication
For private integrations, you may use your personal API key (found
here) via the apiKey
option:
client = require('drip-api')({
apiKey: "YOUR_API_KEY",
accountId: "YOUR_ACCOUNT_ID"
})
For public integrations, pass in the user's OAuth token via the accessToken
option:
client = require('drip-api')({
accessToken: "YOUR_ACCESS_TOKEN",
accountId: "YOUR_ACCOUNT_ID"
})
Your account ID can be found here.
Most API actions require an account ID, with the exception of methods like
the "list accounts" endpoint.
Usage
Since the Drip client is a flat API client, most API actions are available
as methods on the client object. The following methods are currently available:
Action | Method |
---|
List accounts | client.accounts(callback) |
Track an event | client.trackEvent(email, action, properties, options, callback) |
Track a batch of events | client.trackEvents([<events array>]) |
- All methods return promises and also support an asynchronous callback. For example:
client.accounts().then(function (response) {
}).catch(function (error) {
})
client.accounts(function (error, response) {
})
Note: We do not have complete API coverage yet. If we are missing an API method
that you need to use in your application, please file an issue and/or open a
pull request. See the official REST API docs
for a complete API reference.
Debugging
This library follows the debug logger standard for optional logger output. To see logger output from this library set DEBUG env variable to 'drip'. For example to see log output in tests:
DEBUG=drip npm test
Contributing
- Fork it ( https://github.com/crowdcst/drip/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Notes about contributing
- Be sure to include jasmine specs for new functionality
- Follow the StandardJS formatting guidelines. Our test command enforces these guidelines and builds will fail if your code is not compliant.
- Use yarn (
yarn add
) for adding new packages so that yarn.lock gets updated