Using Salsa with Drupal
I recently presented Salsa: Spicy CRM Integration for Drupal-Powered Nonprofits at CapitalCamp, the District of Columbia's Drupal camp. Here's a summary of the current state of Salsa/Drupal integration, based on that presentation.
Salsa, from D.C.-based Salsa Labs, is an integrated software-as-a-service that helps nonprofits "build, organize and engage a base of support with tools to communicate, fundraise, advocate and build community." 4Site has performed a number of Salsa integrations with Drupal over the years. Two of our recent projects are I am for the Child for the National Association of Court Appointed Special Advocates (CASA), and PreventObesity.Net for NetCentric Campaigns, the Robert Wood Johnson Foundation and the American Heart Association.
Salsa is modular, and is built around a number of objects. The central object is the supporter, and most of the objects in other Salsa modules relate to variousT things that your supporters do: donations they make, petitions they sign, events they register to attend, and so on. For the most part, your supporters interact with these objects through HTML forms.
Mild Salsa: Links and Embedded Forms
It's easy to incorporate basic Salsa functionality into any website. You can always just link to a Salsa-hosted form, which is wrapped in a template that looks like the rest of your site. This is easy, but has a number of drawbacks, the first being that you'll have to update the Salsa template every time the navigation or design of your main site changes. If your site has a lot of dynamic elements (recent news items in the sidebar, for example), a static, remotely hosted form is going to look pretty out of place. You can get around this by embedding forms directly into your site. That's pretty easy for anyone with basic HTML skills, but it's still pretty limited. And it's not terribly Drupal-y!
Medium Salsa: Salsa API and Salsa Entity
Fortunately, Salsa has a reasonably well-featured, mostly RESTful API. When I started working at 4Site a couple of years ago, I discovered the Salsa API module, which lets Drupal easily talk to Salsa, and read from or write to nearly any Salsa object. At the time, the module was for Drupal 6 only, with no recent updates, and the author was no longer active on Drupal.org. I took over as maintainer of the Salsa API module and wrote an initial Drupal 7 version.
That Drupal 7 port of the Salsa API module allowed other members of the Drupal community to create Salsa Entity, a suite of modules that exposes Salsa's objects as Drupal entities. This allows for deep integration with Drupal without writing a lot of custom code. In fact, the goal of the Salsa Entity project is to allow you to replace the public user interface of Salsa completely.
Using Salsa Entity, just about any form you create in Salsa is automatically available as a form contained in a Drupal block. Since those forms are rendered through Drupal's Forms API, they're themeable just like any other Drupal form, so you can easily create a highly customized look and feel without writing two sets of templates. Salsa Entity also provides integration with other Drupal modules, including Entity Reference, Rules, and Views.
One of Salsa Entity's submodules, Salsa Profile, allows your supporters to easily update their Salsa records from their Drupal accounts. It adds a new "Edit Profile" tab to user pages, with a form containing all of the fields in Salsa's supporter object. When the user submits the form, the data is saved directly to Salsa. Of course, you'll probably want to make some changes first. For example, you probably don't want your supporters changing the "source tracking code" that records where you originally acquired them, or the number of times email to them has bounced. Fortunately, since this is a standard Drupal form, we can make changes using the Form API's form alter functionality. We can keep certain fields from displaying, change the order in which fields appear, add subheadings, change the labels for certain fields, change the widgets users use to edit the field values, and more.
Spicy Salsa: Coming Soon!
If you want even deeper integration, you can use the Salsa API module with your own custom code. More on that in my next post!