It takes a Village to raise an Extension

Gepubliceerd
2024-01-02 08:52
Written by
jamie - member of the CiviCRM community - view blog guidelines

Many many years ago (quite possibly 2016), at about the same time, AGH Strategies and the Progressive Technology Project (PTP) each developed an extension called "Petition Email." Both extensions provided the exact same missing feature for CiviCRM's Petition component: When a signer fills out a CiviCRM petition, an email is automatically sent to a pre-defined target.

Rather than duplicate efforts, we agreed to join forces. The PTP extension was delightfully flexible and miserably complicated to configure. In contrast, Andie's extension was elegantly designed and already supported multiple backends for dynamically looking up elected officials, with the free Open States (now Plurality) API included. So we all agreed to focus on the AGH extension. There were just a few small features to be added to the AGH version, some code to migrate and we would be ready to go. Easy, right?

Meanwhile, the Progressive Technology Project's Cicero Drupal module was growing long in the tooth. For many years, this little gem was able to automatically take addresses saved in CiviCRM, query the Cicero electoral API, and save the districts in which each address was located into a set of custom fields. It was all automated and could be run via scheduled jobs. It was written before we even had CiviCRM extensions, so it was only available to CiviCRM users running Drupal.

Thanks to generous funding from Cicero, Jon at Megaphone Technology Consulting was engaged to re-write the Drupal module as a proper CiviCRM extension. He made a great suggestion: rather than create a whole new extension, why not extend Joseph Lacey's existing Electoral extension, which essentially does the same same thing using the Google Civic backend?

At this point, we had a real epiphany: the available electoral databases (Cicero, Plurality, Google Civic) provide not only the district numbers, but also the names (and in most cases) the email addresses of the elected officials. If we could somehow link the Petition Email extension to the Electoral extension we could have it all.

Jon did the initial work, adding Cicero support to the Electoral module. With some help from Matt Wire, a lot of coding on the PTP side, and tremendous patience from our Powerbase beta testers, we have finally managed to finish the project and now are proud to present:

  1. The electoral extension: supports the Cicero, Plurality (formerly Open States), and Google Civic backends for matching addresses to districts and populating custom fields with the distrinct information
  2. The petition email extension: for each CiviCRM petition, allows you to specify one or more contacts that should receive the provided email message (petition signers can edit before submitting). And, if the electoral extension is enabled, you can have the targets dynamically chosen based on the address entered by the petition signer, so the email goes to their city council or state representative.

Alas, nothing is perfect, so there are a few caveats to keep in mind:

  1. It has only been tested in the US. In theory, Cicero and Google Civic support other countries, but not sure how well that works
  2. In the US, only state and local elected officials are supported for petition emailing because federal elected officials do not provide their email addresses. Also, each state in the US works differently (for example, California does not publish email addresses of their state legislators).
  3. The (now deprecated) PTP petition email extension (net.ourpowerbase.petitionemail) has been available via the CiviCRM extension system for many years. Unfortunately, it conflicts with the newly available AGH petition email extension (com.aghstrategies.petitionemail) which is now availbale. If you have the old one installed, be sure to fully disable and uninstall it before enabling the new one.

Please give them a try and let us know what you find. Also, always open to additions if there is another electoral back end you would like to add.

Filed under