Resource

How We Connected ActBlue to Zapier

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.

Using Zapier to Automatically Capture ActBlue Donations

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.

Creating a New Webhook Endpoint

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.

Validate Basic Authentication

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):

JSON Decode Response

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:

Put the Data to Work

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

ready to become a tfc volunteer?

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.