Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

drip-nodejs

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

drip-nodejs

A complete NodeJS wrapper for connecting to the Drip v2 REST API

  • 0.0.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.9K
decreased by-35.42%
Maintainers
1
Weekly downloads
 
Created
Source

Build Status

Drip Rest API Wrapper for Node.js

A complete Nodejs wrapper for the Drip REST API.

How to install

npm install drip-nodejs --save

Authentication

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 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.

Accounts

ActionMethod
List all accountsclient.listAccounts(callback)
Fetch an accountclient.fetchAccount(account_id, callback)

Broadcats

ActionMethod
List broadcastsclient.listBroadcasts(accountId, callback, status)
Fetch a broadcastclient.fetchBroadcast(accountId, broadcastId, callback)

Campaigns

ActionMethod
List all campaignsclient.listCampaigns(accountId, callback, status)
Fetch a campaignclient.fetchCampaign(accountId, campaignId, callback)
Activate a campaignclient.activateCampaign(accountId, campaignId, callback)
Pause a campaignclient.pauseCampaign(accountId, campaignId, callback)
List specific campaign's subscribersclient.listAllSubscribesToCampaign(accountId, campaignId, callback)
Subscribe to a campaignclient.subscribeToCampaign(accountId, campaignId, payload, callback)

Campaign subscriptions

ActionMethod
List campaign subscriptionsclient.subscriberCampaignSubscriptions(accountId, subscriberId, callback)

Conversions

ActionMethod
List all conversionsclient.listConversions(accountId, callback, status)
Fetch a conversionclient.fetchConversion(accountId, conversionId, callback)

Custom fields

ActionMethod
List all custom fieldsclient.listAllCustomFields(accountId, callback)

Events

ActionMethod
Record an eventclient.recordEvent(accountId, payload, callback)
Record a batch of eventsclient.recordBatchEvents(accountId, payload, callback)
List all events in accountclient.listEventActions(accountId, callback, options)

Forms

ActionMethod
List all formsclient.listForms(accountId, callback)
Fetch a formclient.fetchForm(accountId, formId, callback)

Purchases

ActionMethod
List all purchasesclient.listPurchases(accountId, emailOrId, callback)
Create a purchaseclient.createPurchase(accountId, emailOrId, payload, callback)
Fetch a purchaseclient.fetchPurchase(accountId, emailOrId, purchaseId, callback)

Subscribers

ActionMethod
List all subscribersclient.listSubscribers(accountId, callback)
Update a subscriberclient.updateSubscriber(accountId, payload, callback)
Fetch a subscriberclient.fetchSubscriber(accountId, emailOrId, callback)
Unsubscribe from a campaignclient.unsubscribeFromCampaign(accountId, emailOrId, campaignId, callback)
Unsubscribe from all mailingsclient.unsubscribeFromAllMailings(accountId, emailOrId, callback)
Delete s subscriberclient.deleteSubscriber(accountId, emailOrId, callback)

Tags

ActionMethod
List all tagsclient.listAllTags(accountId, callback)
Tag a subscriberclient.tagSubscriber(accountId, tags, email, callback)
Remove tag from subscriberclient.removeSubscriberTag(accountId, email, tag, callback)

User

ActionMethod
Fetch authenticated userclient.fetchUser(callback)

Webhooks

ActionMethod
List all webhooksclient.listWebhooks(accountId)
Fetch a webhookclient.fetchWebhook(accountId, webhookId, callback)
Create a webhookclient.createWebhook(accountId, payload, callback)
Destroy a webhookclient.destroyWebhook(accountId, webhookId, callback)

Workflows

ActionMethod
List all workflowsclient.listAllWorkflows(accountId, callback, status)
Fetch a workflowclient.fetchWorkflow(accountId, workflowId, callback)
Activate a workflowclient.activateWorkflow(accountId, workflowId, callback)
Pause a workflowclient.pauseWorkflow(accountId, workflowId, callback)
Start a subscriber on a workflowclient.startOnWorkflow(accountId, workflowId, payload, callback)
Remove a subscriber from a workflowclient.removeFromWorkflow(accountId, workflowId, emailOrId, callback)

Workflow triggers

ActionMethod
List all workflow triggersclient.listTriggers(accountId, workflowId, callback)
Create a workflow triggerclient.createTrigger(accountId, workflowId, payload, callback)
Update a triggerclient.updateTrigger(accountId, workflowId, triggerId, payload, callback)

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 campaigns
client.listCampaigns(9999999, function (error, response, body) {
  console.log(body)
}, "active")

// This fetches all campaigns by default
client.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.

var batch = {
  "batches": [{
    "events": [
      {
        "email": "john@acme.com",
        "action": "Opened a door"
      },
      {
        "email": "joe@acme.com",
        "action": "Closed a door"
      }
      // Lots more events...
    ]
  }]
}

client.recordBatchEvents(2271521, batch, function (error, response, body) {
  // Do stuff
  }
)

Contributing

  1. Fork it ( https://github.com/samudary/drip-nodejs/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Note: Jasmine is used for testing

Keywords

FAQs

Package last updated on 20 Mar 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc