### Drip JS API - Getting Started Source: https://developer.drip.com/index Instructions for integrating and using the Drip JavaScript API. ```APIDOC JS API: Getting Started: Installing Your JavaScript Snippet: Include the Drip JavaScript snippet in your website's HTML. How to Send a JS API Request: Use the `drip.track` or `drip.identify` methods to send data to Drip. ``` -------------------------------- ### List All Accounts - Ruby Example Source: https://developer.drip.com/index Example using the Drip Ruby client to list all accounts. ```ruby require 'drip' client = Drip::Client.new do |c| c.api_key = "YOUR API KEY" c.account_id = "YOUR_ACCOUNT_ID" end response = client.accounts if response.success? puts response.body["accounts"] end ``` -------------------------------- ### Drip API Request Examples Source: https://developer.drip.com/index Demonstrates how Drip sends requests to your endpoint for preview/test modes and regular content rendering. Includes examples with and without preview parameters, and a sample response from a weather service. ```HTTP GET https://api.you.com/api?subscriber[zipcode]&preview=true GET https://api.you.com/api?subscriber[zipcode]=90210&preview=true GET https://api.you.com/api?subscriber[zipcode]=90210 ``` ```JSON { "apparentTemperature": 65.89, "cloudCover": 0.09, "dewPoint": 22.55, "humidity": 0.19, "icon": "clear-night", "nearestStormBearing": 131, "nearestStormDistance": 446, "ozone": 258.97, "precipIntensity": 0, "precipProbability": 0, "pressure": 1018.59, "summary": "Clear", "temperature": 65.89, "time": 1541727521, "uvIndex": 0, "visibility": 8.27, "windBearing": 1, "windGust": 10.09, "windSpeed": 4.39 } ``` -------------------------------- ### List All Accounts - Node.js Example Source: https://developer.drip.com/index Example using the Drip Node.js client to list all accounts. ```javascript // npm install drip-nodejs --save const client = require('drip-nodejs')({ token: YOUR_API_KEY, accountId: YOUR_ACCOUNT_ID }); client.listAccounts() .then((response) => { // Handle `response.body` }) .catch((error) => { // Handle errors }); ``` -------------------------------- ### List Drip Subscribers with Node.js Source: https://developer.drip.com/index Illustrates how to list subscribers using the drip-nodejs library. This example includes installing the package, initializing the client with API credentials, and handling asynchronous responses with Promises. ```JavaScript // npm install drip-nodejs --save const client = require('drip-nodejs')({ token: YOUR_API_KEY, accountId: YOUR_ACCOUNT_ID }); const options = { status: "active", subscribed_before: "2017-01-01T00:00:00Z" }; client.listSubscribers(options) .then((response) => { // Handle `response.body` }) .catch((error) => { // Handle errors }); ``` -------------------------------- ### List Conversions - Ruby Source: https://developer.drip.com/index Example using the Drip Ruby client to list all conversions. ```ruby require 'drip' client = Drip::Client.new do |c| c.api_key = "YOUR API KEY" c.account_id = "YOUR_ACCOUNT_ID" end response = client.conversions if response.success? puts response.body["goals"] end ``` -------------------------------- ### List All Accounts - Curl Example Source: https://developer.drip.com/index Example using curl to list all accounts the authenticated user has access to. ```curl curl "https://api.getdrip.com/v2/accounts" \ -H 'User-Agent: Your App Name (www.yourapp.com)' \ -u YOUR_API_KEY: ``` -------------------------------- ### Install Drip JavaScript Snippet Source: https://developer.drip.com/index This snippet installs the Drip JavaScript library on your website. It initializes the Drip object and loads the necessary script from the Drip servers. Ensure your account ID is correctly inserted. ```html ``` -------------------------------- ### List Conversions - Node.js Source: https://developer.drip.com/index Example using the Drip Node.js client to list all conversions. ```javascript // npm install drip-nodejs --save const client = require('drip-nodejs')({ token: YOUR_API_KEY, accountId: YOUR_ACCOUNT_ID }); const options = { status: "active" }; client.listConversions(options) .then((response) => { // Handle `response.body` }) .catch((error) => { // Handle errors }); ``` -------------------------------- ### Fetch Conversion - Ruby Source: https://developer.drip.com/index Example using the Drip Ruby client to fetch a specific conversion. ```ruby require 'drip' client = Drip::Client.new do |c| c.api_key = "YOUR API KEY" c.account_id = "YOUR_ACCOUNT_ID" end conversion_id = 9999999 response = client.conversion(conversion_id) if response.success? puts response.body["goals"] end ``` -------------------------------- ### List Conversions - cURL Source: https://developer.drip.com/index Example using cURL to list all conversions in a Drip account. ```curl curl "https://api.getdrip.com/v2/YOUR_ACCOUNT_ID/goals" \ -H 'User-Agent: Your App Name (www.yourapp.com)' \ -u YOUR_API_KEY: ``` -------------------------------- ### Record Event - Node.js Source: https://developer.drip.com/index Example using the Drip Node.js client to record an event. ```javascript // npm install drip-nodejs --save const client = require('drip-nodejs')({ token: YOUR_API_KEY, accountId: YOUR_ACCOUNT_ID }); const payload = { email: "john@acme.com", action: "Logged in", properties: { affiliate_code: "XYZ" } }; client.recordEvent(payload) .then((response) => { // Handle `response.body` }) .catch((error) => { // Handle errors }); ``` -------------------------------- ### Record Event - Ruby Source: https://developer.drip.com/index Example using the Drip Ruby client to record an event. ```ruby require 'drip' client = Drip::Client.new do |c| c.api_key = "YOUR API KEY" c.account_id = "YOUR_ACCOUNT_ID" end email = "someone@example.com" action = "Docked with space station" properties = { station: "Mars Endeavor" } response = client.track_event(email, action, properties) if response.success? # ... end ``` -------------------------------- ### List Drip Subscribers with Ruby Source: https://developer.drip.com/index Provides a Ruby example for listing subscribers using the Drip client library. It shows how to initialize the client and handle the response, including checking for success and accessing subscriber data. ```Ruby require 'drip' client = Drip::Client.new do |c| c.api_key = "YOUR API KEY" c.account_id = "YOUR_ACCOUNT_ID" end response = client.subscribers if response.success? puts response.body["subscribers"] end ``` -------------------------------- ### Drip Subscriber Object Example Source: https://developer.drip.com/index An example JSON object representing a Drip subscriber, including their ID, status, email, custom fields, tags, timezone, and other relevant properties. ```JSON { "id": "z1togz2hcjrkpp5treip", "status": "active", "email": "john@acme.com", "custom_fields": { "shirt_size": "Medium" }, "tags": [ "Customer", "SEO" ], "time_zone": "America/Los_Angeles", "utc_offset": -440, "created_at": "2013-06-21T10:31:58Z", "ip_address": "123.123.123.123", "user_agent": "Mozilla/5.0", "lifetime_value": 2000, "original_referrer": "https://google.com/search", "landing_url": "https://www.drip.co/landing", "prospect": true, "base_lead_score": 30, "lead_score": 65, "user_id": "123" } ``` -------------------------------- ### Fetch Conversion - Node.js Source: https://developer.drip.com/index Example using the Drip Node.js client to fetch a specific conversion. ```javascript // npm install drip-nodejs --save const client = require('drip-nodejs')({ token: YOUR_API_KEY, accountId: YOUR_ACCOUNT_ID }); const conversionId = 8889999; client.fetchConversion(conversionId) .then((response) => { // Handle `response.body` }) .catch((error) => { // Handle errors }); ``` -------------------------------- ### Record Event - cURL Source: https://developer.drip.com/index Example using cURL to record an event for a subscriber. ```curl curl -X POST "https://api.getdrip.com/v2/YOUR_ACCOUNT_ID/events" \ -H "Content-Type: application/json" \ -H 'User-Agent: Your App Name (www.yourapp.com)' \ -u YOUR_API_KEY: \ -d @- << EOF { "events": [{ "email": "john@acme.com", "action": "Logged in", "properties": { "affiliate_code": "XYZ" }, "occurred_at": "2014-03-22T03:00:00Z" }] } EOF ``` -------------------------------- ### Create or Update Subscribers in Batch (Ruby) Source: https://developer.drip.com/index Provides a Ruby example using the Drip client library to create or update multiple subscribers in a batch. Shows how to initialize the client and make the API call. ```Ruby require 'drip' client = Drip::Client.new do |c| c.api_key = "YOUR API KEY" c.account_id = "YOUR_ACCOUNT_ID" end # An array of subscribers subscribers = [ { "email": "john@acme.com" }, { "email": "jane@acme.com" } # ... ] response = client.create_or_update_subscribers(subscribers) if response.success? # ... end ``` -------------------------------- ### Example API Call for Creating Orders Batch Source: https://developer.drip.com/index This bash script demonstrates how to make a POST request to the Drip API to create or update a batch of orders. It includes setting necessary headers, authentication, and piping the JSON payload to the request. ```bash curl -X POST "https://api.getdrip.com/v2/YOUR_ACCOUNT_ID/orders/batches" \ -H "Content-Type: application/json" \ -H 'User-Agent: Your App Name (www.yourapp.com)' \ -u YOUR_API_KEY: \ -d @- << EOF { "batches": [{ "orders": [ { "email": "john@acme.com", "provider": "shopify", "upstream_id": "abcdef", "identifier": "Order_123456", "amount": 4900, "tax": 100, "fees": 0, "discount": 0, "permalink": "http://myorders.com/orders/123456", "currency_code": "USD", "properties": { "shirt_size": "Medium", "color": "red" }, "occurred_at": "2013-06-21T10:31:58Z", "closed_at": "2013-06-21T10:35:58Z", "cancelled_at": null, "financial_state": "paid", "fulfillment_state": "fulfilled", "billing_address": { "name": "Bill Billington", "first_name": "Bill", "last_name": "Billington", "company": "Bills R US", "address_1": "123 Bill St.", "address_2": "Apt. B", "city": "Billtown", "state": "CA", "zip": "01234", "country": "United States", "phone": "555-555-5555", "email": "bill@bills.com" }, "shipping_address": { "name": "Ship Shippington", "first_name": "Ship", "last_name": "Shipington", "company": "Shipping 4 Less", "address_1": "123 Ship St.", "address_2": "null", "city": "Shipville", "state": "CA", "zip": "01234", "country": "United States", "phone": "555-555-5555", "email": "ship@shipping.com" }, "items": [{ "id": "8888888", "product_id": "765432", "sku": "4444", "amount": 4900, "name": "Canoe", "quantity": 1, "upstream_id": "hijkl", "upstream_product_id": "opqrs", "upstream_product_variant_id": "zyxwv", "price": 4900, "tax": 100, "fees": 0, "discount": 100, "taxable": true, "properties": { "color": "black" } }] }, { "email": "joe@acme.com", "provider": "shopify", "upstream_id": "fedcba", "identifier": "Order_654321", "amount": 4900, "tax": 100, "fees": 0, "discount": 0, "permalink": "http://myorders.com/orders/654321", "currency_code": "USD", "properties": { "size": "small", "color": "blue" }, "occurred_at": "2013-05-18T10:31:58Z", "closed_at": "2013-05-18T10:35:58Z", "cancelled_at": null, "financial_state": "paid", "fulfillment_state": "fulfilled", "billing_address": { "name": "Bill Billington", "first_name": "Bill", "last_name": "Billington", "company": "Bills R US", "address_1": "123 Bill St.", "address_2": "Apt. B", "city": "Billtown", "state": "CA", "zip": "01234", "country": "United States", "phone": "555-555-5555", "email": "bill@bills.com" }, "shipping_address": { "name": "Ship Shippington", "first_name": "Ship", "last_name": "Shipington", "company": "Shipping 4 Less", "address_1": "123 Ship St.", "address_2": "null", "city": "Shipville", "state": "CA", "zip": "01234", "country": "United States", "phone": "555-555-5555", "email": "ship@shipping.com" }, "items": [{ "id": "8888888", "product_id": "765432", "sku": "4444", "amount": 4900, "name": "Canoe", "quantity": 1, "upstream_id": "hijkl", "upstream_product_id": "opqrs", "upstream_product_variant_id": "zyxwv", "price": 4900, "tax": 100, "fees": 0, "discount": 100, "taxable": true, "properties": { "color": "black" } }] } ] }] } EOF ``` -------------------------------- ### Create or Update Subscribers in Batch (Node.js) Source: https://developer.drip.com/index Offers a Node.js example using the drip-nodejs library to manage subscriber batches. Includes client initialization and the method for updating subscribers. ```Node.js // npm install drip-nodejs --save const client = require('drip-nodejs')({ token: YOUR_API_KEY, accountId: YOUR_ACCOUNT_ID }); const batch = { "batches": [{ "subscribers": [ { "email": "john@acme.com", "tags": "Dog Person" }, { "email": "jane@acme.com", "tags": "Cat Person" } // Lots more subscribers... ] }] }; client.updateBatchSubscribers(batch, (errors, responses, bodies) => { // Do stuff } ); ``` -------------------------------- ### Fetch Conversion - cURL Source: https://developer.drip.com/index Example using cURL to fetch a specific conversion by its ID. ```curl curl "https://api.getdrip.com/v2/YOUR_ACCOUNT_ID/goals/CONVERSION_ID" \ -H 'User-Agent: Your App Name (www.yourapp.com)' \ -u YOUR_API_KEY: ``` -------------------------------- ### Activate a Drip Workflow Source: https://developer.drip.com/index Provides examples for activating a workflow using cURL, Ruby, and Node.js. This operation returns a 204 No Content status on success. ```curl curl -X POST "https://api.getdrip.com/v2/YOUR_ACCOUNT_ID/workflows/WORKFLOW_ID/activate" \ -H 'User-Agent: Your App Name (www.yourapp.com)' \ -u YOUR_API_KEY: ``` ```ruby require 'drip' client = Drip::Client.new do |c| c.api_key = "YOUR API KEY" c.account_id = "YOUR_ACCOUNT_ID" end workflow_id = 9999999 response = client.activate_workflow(workflow_id) if response.success? # ... end ``` ```javascript // npm install drip-nodejs --save const client = require('drip-nodejs')({ token: YOUR_API_KEY, accountId: YOUR_ACCOUNT_ID }); const workflowId = 222333; client.activateWorkflow(workflowId) .then((response) => { // Handle `response.body` }) .catch((error) => { // Handle errors }); ``` -------------------------------- ### Create Product Activity using cURL Source: https://developer.drip.com/index Example of how to send a POST request to the Drip Product Activity API using cURL to record a product creation event. Ensure you replace placeholders with your actual API key, account ID, and product details. ```curl curl -X POST "https://api.getdrip.com/v3/YOUR_ACCOUNT_ID/shopper_activity/product" \ -H "Content-Type: application/json" \ -H 'User-Agent: Your App Name (www.yourapp.com)' \ -u YOUR_API_KEY: \ -d @- << EOF { "provider": "my_custom_platform", "action": "created", "occurred_at": "2019-01-28T12:15:23Z", "product_id": "B01J4SWO1G", "product_variant_id": "B01J4SWO1G-CW-BOTT", "sku": "XHB-1234", "name": "The Coolest Water Bottle", "brand": "Drip", "categories": [ "Accessories" ], "currency": "USD", "price": 11.16, "inventory": 42, "product_url": "https://mysuperstore.com/dp/B01J4SWO1G", "image_url": "https://www.getdrip.com/images/example_products/water_bottle.png" } EOF ``` -------------------------------- ### Create or Update Subscriber via Node.js Source: https://developer.drip.com/index This Node.js example utilizes the 'drip-nodejs' library to create or update a subscriber. It demonstrates how to configure the client with an API token and account ID, and how to handle the response or errors. ```Node.js // npm install drip-nodejs --save const client = require('drip-nodejs')({ token: YOUR_API_KEY, accountId: YOUR_ACCOUNT_ID }); const payload = { email: "john@acme.com", time_zone: "America/Los_Angeles", custom_fields: { shirt_size: "Medium" } }; client.createUpdateSubscriber(payload) .then((response) => { // Handle `response.body` }) .catch((error) => { // Handle errors }); ``` -------------------------------- ### Ruby Conditional Request Example Source: https://developer.drip.com/index A basic Ruby code snippet demonstrating how to check the success of a request and print a message. ```ruby if response.success? puts "Request accepted" else puts "Error occurred" end ``` -------------------------------- ### Create or Update Batch of Orders (Ruby) Source: https://developer.drip.com/index This snippet shows how to use the Drip Ruby client to create or update a batch of orders. It initializes the client with API credentials and then calls the `create_order_activity_events` method with a payload similar to the cURL example. ```ruby require 'drip' client = Drip::Client.new do |c| c.api_key = "YOUR API KEY" c.account_id = "YOUR_ACCOUNT_ID" end response = client.create_order_activity_events( [ { provider: "my_custom_platform", email: "john@acme.com", action: "placed", occurred_at: "2019-03-12T15:31:58Z", order_id: "63754763", order_public_id: "#4", grand_total: 54.00, total_discounts: 1.00, total_taxes: 1.00, total_fees: 0, total_shipping: 5.00, currency: "USD", order_url: "http://myorders.com/orders/4", items: [{ product_id: "B01F9AQ99M", product_variant_id: "B01F9AQ99M-YEL-BT", sku: "JDT-4321", name: "Yellow Boots of Might", brand: "Drip", categories: [ "Of Might", "Outdoors" ], price: 49.00, quantity: 1, discounts: 1.00, taxes: 1.00, fees: 0, shipping: 5.00, total: 54.00, color: "black", product_url: "https://mysuperstore.com/dp/B01F9AQ99M", image_url: "https://www.getdrip.com/images/example_products/boots.png" }], billing_address: { label: "Primary Billing", first_name: "Bill", last_name: "Billington", company: "Bills R US", address_1: "123 Bill St.", address_2: "Apt. B", city: "Billtown", state: "CA", postal_code: "01234", country: "United States", phone: "555-555-5555" }, shipping_address: { label: "Downtown Office", first_name: "Ship", last_name: "Shipington", company: "Shipping 4 Less", address_1: "123 Ship St.", address_2: "null", city: "Shipville", state: "CA", postal_code: "01234", country: "United States", phone: "555-555-5555" } }, { provider: "my_custom_platform", email: "user@gmail.com", action: "updated", occurred_at: "2019-03-12T15:27:16Z", order_id: "456445746", order_public_id: "#5", grand_total: 21.48, total_discounts: 5.34, total_taxes: 1.00, total_fees: 2.00, total_shipping: 5.00, currency: "USD", order_url: "https://mysuperstore.com/order/5", items: [ { product_id: "B01J4SWO1G", product_variant_id: "B01J4SWO1G-CW-BOTT", sku: "XHB-1234", name: "The Coolest Water Bottle", brand: "Drip", categories: [ "Accessories" ], price: 11.16, sale_price: 10.16, quantity: 2, discounts: 5.34, taxes: 1.00, fees: 0.50, shipping: 5.00, total: 21.48, product_url: "https://mysuperstore.com/dp/B01J4SWO1G", image_url: "https://www.getdrip.com/images/example_products/water_bottle.png", product_tag: "Best Seller" } ], billing_address: { label: "Primary Billing", first_name: "Bill", last_name: "Billington", company: "Bills R US", address_1: "123 Bill St.", address_2: "Apt. B", city: "Billtown", state: "CA", postal_code: "01234", country: "United States", phone: "555-555-5555" }, shipping_address: { label: "Downtown Office", first_name: "Ship", last_name: "Shipington", company: "Shipping 4 Less", address_1: "123 Ship St.", city: "Shipville", state: "CA", postal_code: "01234", country: "United States", phone: "555-555-5555" } } ] ) ``` -------------------------------- ### Fetch Single-Email Campaign (Node.js) Source: https://developer.drip.com/index Fetches a single email campaign using the Drip Node.js SDK. Requires installation of the 'drip-nodejs' package. Initializes the client with token and account ID. ```Node.js // npm install drip-nodejs --save const client = require('drip-nodejs')({ token: YOUR_API_KEY, accountId: YOUR_ACCOUNT_ID }); const broadcastId = 9998888; client.fetchBroadcast(broadcastId) .then((response) => { // Handle `response.body` }) .catch((error) => { // Handle errors }); ``` -------------------------------- ### Drip API Authentication with API Token Source: https://developer.drip.com/index Demonstrates how to authenticate with the Drip API using a personal API Token for private integrations. This includes examples for Ruby, Node.js, and cURL. ```ruby require 'drip-ruby' client = Drip::Client.new do |c| c.api_key = "YOUR_API_KEY" c.account_id = "YOUR_ACCOUNT_ID" end ``` ```javascript // npm install drip-nodejs --save const client = require('drip-nodejs')( { token: YOUR_API_KEY, accountId: YOUR_ACCOUNT_ID } ); ``` ```bash curl "api_endpoint_here" \ -H 'User-Agent: Your App Name (www.yourapp.com)' \ -H 'Authorization: Basic $(echo YOUR_API_KEY: | base64)' curl "api_endpoint_here" \ -H 'User-Agent: Your App Name (www.yourapp.com)' \ -u 'YOUR_API_KEY:' ``` -------------------------------- ### Drip Custom Dynamic Content Liquid Example Source: https://developer.drip.com/index Illustrates how to use custom dynamic content within Drip's Liquid templating language, referencing data from an external API response. ```Liquid Good morning {{ subscriber.first_name }}! Looks like it's {{ my.weather.summary | downcase }} in your neck of the woods! ``` -------------------------------- ### Start Subscriber on Workflow Source: https://developer.drip.com/index Initiates a subscriber's journey within a specified Drip workflow. Requires subscriber details like email and timezone, and can include custom fields. The subscriber must be active in the workflow for this to take effect. ```cURL curl -X POST "https://api.getdrip.com/v2/YOUR_ACCOUNT_ID/workflows/WORKFLOW_ID/subscribers" \ -H "Content-Type: application/json" \ -H 'User-Agent: Your App Name (www.yourapp.com)' \ -u YOUR_API_KEY: \ -d @- << EOF { "subscribers": [{ "email": "john@acme.com", "time_zone": "America/Los_Angeles", "custom_fields": { "shirt_size": "Medium" } }] } EOF ``` ```Ruby require 'drip' client = Drip::Client.new do |c| c.api_key = "YOUR API KEY" c.account_id = "YOUR_ACCOUNT_ID" end workflow_id = 9999999 options = { email: "john@acme.com", time_zone: "America/Los_Angeles", custom_fields: { shirt_size: "Medium" } } response = client.start_subscriber_workflow(workflow_id, options) if response.success? puts response.body["subscribers"] end ``` ```Node.js // npm install drip-nodejs --save const client = require('drip-nodejs')({ token: YOUR_API_KEY, accountId: YOUR_ACCOUNT_ID }); const workflowId = 222333; const payload = { subscribers: [{ email: "john@acme.com", time_zone: "America/Los_Angeles", custom_fields: { shirt_size: "Medium" } }] } client.startOnWorkflow(workflowId, payload) .then((response) => { // Handle `response.body` }) .catch((error) => { // Handle errors }); ``` -------------------------------- ### Create Product Activity using Drip Ruby SDK Source: https://developer.drip.com/index Demonstrates how to use the Drip Ruby client library to send product activity data to the Drip API. This method simplifies the process of constructing and sending the API request. ```ruby require 'drip' client = Drip::Client.new do |c| c.api_key = "YOUR API KEY" c.account_id = "YOUR_ACCOUNT_ID" end response = client.create_product_activity_event( provider: "my_custom_platform", action: "created", occurred_at: "2019-01-28T12:15:23Z", product_id: "B01J4SWO1G", product_variant_id: "B01J4SWO1G-CW-BOTT", sku: "XHB-1234", name: "The Coolest Water Bottle", brand: "Drip", categories: [ "Accessories" ], currency: "USD", price: 11.16, inventory: 42, product_url: "https://mysuperstore.example.com/dp/B01J4SWO1G", image_url: "https://www.getdrip.com/images/example_products/water_bottle.png" ) if response.success? puts "Request accepted" else puts "Error occurred" end ``` -------------------------------- ### List All Accounts API Endpoint Source: https://developer.drip.com/index Details the HTTP GET endpoint for listing all accounts. ```APIDOC HTTP Endpoint `GET /v2/accounts` Arguments None. ``` -------------------------------- ### List all Drip Workflows Source: https://developer.drip.com/index Demonstrates how to list all workflows using cURL, Ruby, and Node.js. Includes filtering and sorting options. ```curl curl "https://api.getdrip.com/v2/YOUR_ACCOUNT_ID/workflows" \ -H 'User-Agent: Your App Name (www.yourapp.com)' \ -u YOUR_API_KEY: ``` ```ruby require 'drip' client = Drip::Client.new do |c| c.api_key = "YOUR API KEY" c.account_id = "YOUR_ACCOUNT_ID" end response = client.workflows if response.success? puts response.body["workflows"] end ``` ```javascript // npm install drip-nodejs --save const client = require('drip-nodejs')({ token: YOUR_API_KEY, accountId: YOUR_ACCOUNT_ID }); const options = { status: "active" }; client.listAllWorkflows(options) .then((response) => { // Handle `response.body` }) .catch((error) => { // Handle errors }); ``` -------------------------------- ### Drip API Subscriber List Endpoint Source: https://developer.drip.com/index Specifies the HTTP GET endpoint for listing subscribers within the Drip API. ```APIDOC GET /v2/:account_id/subscribers ``` -------------------------------- ### Drip API: GET /v2/:account_id/broadcasts Source: https://developer.drip.com/index Lists all single-email campaigns (broadcasts) for a given account. Supports filtering and sorting parameters. ```APIDOC HTTP Endpoint: GET /v2/:account_id/broadcasts Arguments: Key | Description ---|--- `status` | Optional. Filter by one of the following statuses: `draft`, `scheduled`, or `sent`. Defaults to `all`. `sort` | Optional. Sort results by one of these fields: `created_at`, `send_at`, or `name`. Defaults to `created_at`. `direction` | Optional. Filter sort direction with: `asc` or `desc`. Defaults to `asc`. Response Example: #Thebroadcastspropertyisanarrayofbroadcastobjects.{"links":{...},"meta":{"page":1,"sort":"created_at","direction":"asc","count":5,"total_pages":1,"total_count":5,"status":"all"},"broadcasts":[...]} ``` -------------------------------- ### Create or Update Order (Ruby) Source: https://developer.drip.com/index This Ruby code snippet demonstrates how to create or update an order for a subscriber using the Drip client library. It includes setting up the client with API credentials and constructing the order payload with detailed information. ```ruby require 'drip' client = Drip::Client.new do |c| c.api_key = "YOUR API KEY" c.account_id = "YOUR_ACCOUNT_ID" end order = { provider: "shopify", upstream_id: "abcdef", identifier: "Order_123456", amount: 4900, tax: 100, fees: 0, discount: 0, permalink: "http://myorders.com/orders/123456", currency_code: "USD", properties: { shirt_size: "Medium", color: "red" }, occurred_at: "2013-06-21T10:31:58Z", closed_at: "2013-06-21T10:35:58Z", financial_state: "paid", fulfillment_state: "fulfilled", billing_address: { name: "Bill Billington", first_name: "Bill", last_name: "Billington", company: "Bills R US", address_1: "123 Bill St.", address_2: "Apt. B", city: "Billtown", state: "CA", zip: "01234", country: "United States", phone: "555-555-5555", email: "bill@bills.com" }, shipping_address: { name: "Ship Shippington", first_name: "Ship", last_name: "Shipington", company: "Shipping 4 Less", address_1: "123 Ship St.", address_2: "null", city: "Shipville", state: "CA", zip: "01234", country: "United States", phone: "555-555-5555", email: "ship@shipping.com" }, items: [{ id: "8888888", product_id: "765432", sku: "4444", amount: 4900, name: "Canoe", quantity: 1, upstream_id: "hijkl", upstream_product_id: "opqrs", upstream_product_variant_id: "zyxwv", price: 4900, tax: 100, fees: 0, discount: 100, taxable: true, properties: { color: "black" } }] } response = client.create_or_update_order("john@acme.com", order) if response.success? # ... end ``` -------------------------------- ### Drip API: GET /v2/accounts/:account_id Source: https://developer.drip.com/index Retrieves a specific account by its ID. This endpoint does not require any specific arguments in the request body. ```APIDOC HTTP Endpoint: GET /v2/accounts/:account_id Arguments: None. Response Example: #Theaccountspropertyisanarrayofoneaccountobject.{"links":{...},"accounts":[{...}]} ``` -------------------------------- ### List all Drip Webhooks Source: https://developer.drip.com/index Demonstrates how to list all webhooks associated with a Drip account using cURL, Ruby, and Node.js. ```curl curl "https://api.getdrip.com/v2/YOUR_ACCOUNT_ID/webhooks" \ -H 'User-Agent: Your App Name (www.yourapp.com)' \ -u YOUR_API_KEY: ``` ```ruby require 'drip' client = Drip::Client.new do |c| c.api_key = "YOUR API KEY" c.account_id = "YOUR_ACCOUNT_ID" end response = client.webhooks if response.success? puts response.body["webhooks"] end ``` ```javascript // npm install drip-nodejs --save const client = require('drip-nodejs')({ token: YOUR_API_KEY, accountId: YOUR_ACCOUNT_ID }); client.listWebhooks() .then((response) => { // Handle `response.body` }) .catch((error) => { // Handle errors }); ``` -------------------------------- ### Tagging Visitors via Query String Source: https://developer.drip.com/index Tag visitors by appending a `dst` query string parameter to a URL with the Drip JavaScript installed. ```APIDOC http://www.mysite.com?dst=Customer ``` -------------------------------- ### List Drip Subscribers with cURL Source: https://developer.drip.com/index Demonstrates how to list subscribers using a cURL command. This requires your API key and account ID, and allows for specifying a User-Agent. ```cURL curl "https://api.getdrip.com/v2/YOUR_ACCOUNT_ID/subscribers" \ -H 'User-Agent: Your App Name (www.yourapp.com)' \ -u YOUR_API_KEY: ``` -------------------------------- ### Create or Update Subscriber via Ruby Source: https://developer.drip.com/index This Ruby code uses the Drip client library to create or update a subscriber. It shows how to initialize the client with API credentials and send subscriber details, including custom fields. ```Ruby require 'drip' client = Drip::Client.new do |c| c.api_key = "YOUR API KEY" c.account_id = "YOUR_ACCOUNT_ID" end subscriber_email = "john@acme.com" options = { time_zone: "America/Los_Angeles", custom_fields: { shirt_size: "Medium" } } response = client.create_or_update_subscriber(subscriber_email, options) if response.success? puts response.body["subscribers"] end ``` -------------------------------- ### Drip API - Event Actions Endpoint Source: https://developer.drip.com/index Details for the GET /v2/:account_id/event_actions HTTP endpoint used to retrieve custom event actions. Includes available query parameters for pagination. ```APIDOC HTTP Endpoint GET /v2/:account_id/event_actions Arguments Key | Description ---|--- `page` | Optional. The page number. Defaults to `1`. `per_page` | Optional. The number of records to be returned on each page. Defaults to `100`. Maximum `1000`. ``` -------------------------------- ### Create or Update Subscribers in Batch (curl) Source: https://developer.drip.com/index Demonstrates how to use curl to send a POST request to the Drip API to create or update multiple subscribers simultaneously. Includes sample JSON payload. ```curl curl -X POST "https://api.getdrip.com/v2/YOUR_ACCOUNT_ID/subscribers/batches" \ -H "Content-Type: application/json" \ -H 'User-Agent: Your App Name (www.yourapp.com)' \ -u YOUR_API_KEY: \ -d @- << EOF { "batches": [{ "subscribers": [ { "email": "john@acme.com", "time_zone": "America/Los_Angeles", "tags": ["Customer", "SEO"], "custom_fields": { "shirt_size": "Medium" } }, { "email": "joe@acme.com", "time_zone": "America/Los_Angeles", "tags": ["Prospect"], "custom_fields": { "shirt_size": "Medium" } } ] }] } EOF ``` -------------------------------- ### Fetch Subscriber (Ruby) Source: https://developer.drip.com/index Fetches a subscriber using the Drip Ruby client. Requires API key and account ID. ```ruby require 'drip' client = Drip::Client.new do |c| c.api_key = "YOUR API KEY" c.account_id = "YOUR_ACCOUNT_ID" end subscriber_email = "john@acme.com" response = client.subscriber(subscriber_email) if response.success? puts response.body["subscribers"] end ```