Tag: pardot

Smart Pardot lists

My first real Python project solved an integration problem. At IHS we use Pardot as our email marketing platform because it is a product of Salesforce. It neatly connects with the Salesforce database which keeps records clean and avoids duplicate records.

While Pardot can access data on individuals in Salesforce, it can’t access all data. My colleagues and I found Pardot could not access information highly relevant to how we were emailing.

In Salesforce, we represent our programs and events as “campaigns” and the individuals tied to them are “campaign members”. When emailing folks about an upcoming program, Pardot is able to automatically pull the list of campaign members tied to a particular campaign. Cool! But it can’t access a field, “type”, which we use to distinguish between attendees, speakers, staff, etc.

So I wrote a workaround. You can find it here on GitHub. Included in the Readme is sample code. All you need to do is import the function, pass in connections to Pardot & Salesforce, your Salesforce object & query, and your Pardot list.

Here are the nuts and bolts of how it works:

  1. Connect to Salesforce via simple-salesforce, a Python package for Salesforce’s REST API
  2. Use simple-salesforce to run a query to get a list of the individuals we are looking for in Salesforce and pulls their Pardot ID. For example, speakers for all upcoming weekend seminars
  3. Connect to Pardot via pypardot4, a Python package for Pardot’s API. I will write more about this in a future post, but I took this existing package and upgraded it for compatibility with the latest version of the API
  4. Create a Pardot list using the the list of Pardot IDs pulled from Salesforce

There you have it. You can schedule it to run often to ensure the data is up to date. While I created this script to access one Salesforce field not accessible in Pardot, it basically opens up any Salesforce field. For example, I have queried a Salesforce custom object for applications and pushed the data into fields on Pardot prospects.

As an aside, it is baffling to me that you can’t access Salesforce Campaign and Campaign Member data in Pardot. But that’s just one of my many complaints about how much stronger the data integration should be between the two products.

What I do with Python

Over the past year I have become an everyday user of the programming language Python. I use it both at work and for personal projects. At work, I’m responsible for marketing analytics and primarily deal with the Salesforce database and Salesforce’s marketing automation platform Pardot. I use Python to solve problems not possible out of the box. Outside of work, I mainly use Python to analyze spots statistics.

I am not an expert programmer but I have programmed on and off for over a decade. I find Python easy to use, adept at data manipulation, and effective for accessing APIs. APIs are methods for communicating with particular services of products. For example, I built a tool at work that uses APIs to get data from accounts on Youtube, Google Analytics, Facebook, Twitter, and Pardot on a regular basis.

I first learned the basics of Python for free on Codecademy and then learned more by completing the Data Science with Python track on DataCamp, which cost me something like $60. The Codecademy course was a fine introduction although it wasn’t enough knowledge to do any projects truly on your own. More difficult for me than learning the actual Python language was learning how to set up a working environment. For most projects I now use Thonny, which I highly recommend to other beginners. For web apps and scripts that run daily, I use pythonanywhere.

While the Data Camp course involved lots of applied learning, taking on projects at work and for fun that use Python was what really solidified my knowledge. Here is a list of projects I have completed with Python:

I’m planning to keep blogging weekly to dive deeper into each of the projects and the various tools I have used along the way.

Navigation