For private use and integrations, use your API Token found here. Create a new instance of the client library with:
var client = require('drip-nodejs')({ token: YOUR_API_KEY });
For public integrations with an OAuth2 application registered with Drip, you'll need to specify the type of token you're passing (e.g. "Bearer"):
var client = require('drip-nodejs')({ token: YOUR_ACCESS_TOKEN, tokenType: TOKEN_TYPE });
For most API methods, you'll need your Drip Account ID found here. Most client methods accept an account ID argument which allows interaction with any account maintained in your Drip account.
Usage
The following methods are currently available on the client instance. You can find a detailed explanation of all methods and their effect on resources in your Drip account here.
See the official REST API docs for a complete API reference.
Examples
Listing campaigns
The listCampaigns method accepts an optional status argument to filter the response be campaign's status in your account:
// Fetching only active campaignsclient.listCampaigns(9999999,function(error,response,body){console.log(body)},"active")// This fetches all campaigns by defaultclient.listCampaigns(9999999,function(error,response,body){console.log(body)})
Sending a batch of events
The recordBatchEvents methods takes a batch object for the payload and is most suitable for sending thousands of events.
varbatch={"batches": [{"events": [{"email": "[email protected]","action": "Opened a door"},{"email": "[email protected]","action": "Closed a door"}// Lots more events...]}]}client.recordBatchEvents(2271521,batch,function(error,response,body){// Do stuff})