npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

pardot-streaming-client

v0.0.2

Published

Streaming api for processing realtime Pardot analytics data.

Downloads

4

Readme

Pardot Streaming Client

This project provides a node.js client and helper functions for using Pardot's streaming api.

Install

To install the client, use npm:

npm install pardot-streaming-client

PushApi

The PushApi is the main client class that is used to subscibe to pardot data streams.

Simple Example Application:

var PardotClient = require('pardot-streaming-client');
var psh = new PardotClient.PushApi({
		delayBeforeReconnect: 10,
		processPushNotification: function(message){
			console.log(message);
		}
	}, function(){
	psh.login("[email protected]","mypassword");	
});

The constructor takes an options object. Available options are:

  • autoLoginOnDisconnect: Enables auto-reconnect and login if a connection is lost. Default value = true.
  • delayBeforeReconnect: Delay (in milliseconds) before automatic reconnect if the connection is lost.
  • requestLoginCredentialsCB: Callback for notification of incorrect username and password.
  • loginSuccessCB: Callback that notifies that authentiation was successful.
  • loginFailedCB: Callback that notifies that authentiation failed.
  • serverDisconnectCB: Callback that notifies that the connection was lost.
  • serverConnectCB: Callback that notifies a successful connection. (But not yet authenticated)
  • processPushNotification: Callback that gets run every time data is recieved from the stream. This callback should have a single parameter that is the incomming data.
  • displayConsoleMessage: Function for displaying to console (for debug messages),

MessageInspector

The message inspector provides a number of static helper functions that allow you to better extract data from incomming messages. The list of messageInspector functions are:

  • hasProspect
  • isAnonymousVisitor
  • hasVisitor
  • isPageView
  • isEmail
  • isEmailOpenActivity
  • isEmailClickActivity
  • isLandingPageActivity
  • isFileActivity
  • isFormActivity
  • isFormViewActivity
  • isFormSuccessfulSubmitActivity
  • isFormFailedSubmitActivity
  • isCampaignOfName
  • getCampaignName
  • isOpportunityActivity
  • isActivityOfState
  • getActivityState
  • getActivityNameAndDetails
  • isActivityOfName
  • isVisitorActivity
  • hasHydratedProperty
  • decorateNameAndCompanyFromProspect
  • decorateNameAndCompanyFromVisitor
  • getActivityType
  • isProspectWithCrmUrl
  • isEmailSentActivity
  • isEmailTrackerActivity
  • isEmailUnsubscribeActivity
  • isWebinarActivity
  • isPaidSearchClickActivity
  • isVisitorActivityWithIdentifiedCompany
  • isIdentifiedCompanyWithoutProspectActivity
  • isSiteSearchActivity
  • isCountryMatch
  • isCountryGroupMatch
  • isStateMatch
  • isWhoisCountryMatch
  • isWhoisCountryGroupMatch
  • isWhoisStateMatch
  • isVisitorActivityWithWhoisCountry
  • isVisitorActivityWithWhoisState
  • getPreviousActivities
  • isStarred
  • isFilteredActivity
  • isActivityOfProspectAssignedToUser
  • isActivityOfProspectAssignedToCurrentUser

Example Usage in your processPushNotification callback:

	function processPushNotification(message){
		if(MessageInspector.isEmailSentActivity(message)){
			//This notification is associated with a prospect being sent an email
		}
	} 

Filtered Notifier

The filtered notifier object is a helper object that allows you to split a single data stream into multiple notification streams that are filtered by a filter function.

Example usage in conjunction with the MessageInspector:

	var PardotClient = require('pardot-streaming-client');
	var notifier = new PardotClient.FilteredNotifier();

	//Setup 2 Streams of notification, 1 for Landing pages, 1 for forms
	notifier.addListener(PardotClient.MessageInspector.isLandingPageActivity, function(message){
		//This function is called every time an event happens with a landing page
	});

	notifier.addListener(PardotClient.MessageInspector.isFormActivity, function(message){
		//This function is called every time an event happens with a form
	});

	var psh = new PardotClient.PushApi({
		delayBeforeReconnect: 10,
		processPushNotification: notifier.processMessage
	}, function(){
		psh.login("username","password");
	});