Check your U.S. voter registration status or register to vote here.

Inside TFC: How We Connected ActBlue to Zapier

Hasham Ali
Sep 11, 2018 · 3 min read

At TFC, we get a fair number of donations through ActBlue; in order to track donations and make sure we thank our donors in a timely fashion, we needed something better than manually pulling reports on an ad hoc basis.

This sounds like it shouldn’t be a big deal, but took a bit of investigation — typically, an engineer would have to set up a server with a publicly accessible endpoint. That endpoint would then forward data to relevant services. I’ll explain how we connected our ActBlue donations to our internal services without setting up a separate server.

If you work for a campaign or non-profit and rely on ActBlue, or just want a peek behind the scenes at TFC, read on.

At TFC, we are heavy users of Zapier for automating workflows. Unfortunately, there is no pre-existing integration of ActBlue with Zapier. The good news is, ActBlue has support for webhook callbacks that trigger on every donation. This callback includes data about the the donor and the contribution made.

That’s where Zapier comes in, which has integrations with a multitude of APIs. Zapier instances (called “Zaps”) can be configured to receive a trigger (e.g. a Google Sheet is updated), followed by some set of actions (e.g. send a Slack message). One of the trigger options is an HTTP endpoint.

Combining these two services allowed us to ingest ActBlue data with no engineering overhead.

Now when we receive a new ActBlue donation, it’s pushed into a master database, the donor is added to the right email list, and an automatic Slack message is created to alert TFC staff to the donation. That saves us a lot of time, and makes it easier to thank donors for their support.

Implementation

To achieve the above, you’ll do the following high level steps in Zapier:

  • Create a new Zap that will set up a webhook endpoint — to provide a destination for ActBlue to push data.
  • Validate basic authentication on that endpoint — to comply with ActBlue’s security requirements.
  • JSON decode the response — to transform the webhook format into data friendly for Zapier
  • Put the decoded data to work in the Zap.

In Zapier:

  1. Create a new Zap.
  2. Add a webhook trigger step to the Zap.
  3. Select “Catch Hook” as the webhook trigger type.
  4. Skip the “Pick off a Child Key” section.
  5. Copy the created webhook.

In ActBlue:

  1. Paste the previously copied webhook URL in your ActBlue webhook callback URL.
  2. For basic authentication credentials, create a random username / password combination and input it into the auth section. Save this username / password for later.
  3. Enable ActBlue webhook to start hitting the endpoint. (NOTE: you’ll need to react out to ActBlue directly to enable this webhook)

Back in Zapier:

  1. Click “OK, I did this.”
  2. Add a filter step to the Zap.
  3. Select “Only continue if…” as the filter option.
  4. Set the match options to:
  • “Header Http Authorization”
  • “(Text) Exactly matches”
  • “Basic CREDENTIALS”

Note: CREDENTIALS here is the username/password credentials from above that have been base64 encoded. To get the base64 encoded version of your credentials, simply do the following in your terminal (on *nix based systems such as OS X, or Bash CLIs like Cygwin on Windows):

echo -n username:password | base64

Continue in Zapier:

  1. Add an action step.
  2. Select “Code” as the action type.
  3. Select “Run Python” (optionally, you can also use “Run Javascript” if that’s your language of choice).
  4. Under input data, create a new variable named “blob” that’s value is the HTTP body from Step 1.
  5. Under code, input the following:
import json
output = json.loads(input_data['blob'])

That’s it! You can now use this data to send Slack messages, update Google Drive files, add data to your email database, or more just by adding additional action steps to the Zap and using the output from step 3 (the above “code” section).

Tech for Campaigns

Tech for Campaigns is the digital arm for progressive and…

Hasham Ali

Written by

Tech for Campaigns

Tech for Campaigns is the digital arm for progressive and centrist political campaigns. We empower digital marketers, developers, data scientists, and other top tech professionals to contribute expertise to state and federal campaigns.

Hasham Ali

Written by

Tech for Campaigns

Tech for Campaigns is the digital arm for progressive and centrist political campaigns. We empower digital marketers, developers, data scientists, and other top tech professionals to contribute expertise to state and federal campaigns.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store