So I am working on a api of some sort to work between drupal and salsa's external api.
My goals for this is to create something that other modules can use to communicate with the salsa database. For instance, drupal can work on multiple database types because it has code that you submit your query to and it formats the query to work with whatever database drupal is installed on. I hope to do something similar, where another module or someone's custom code can get and save data to salsa easily without having to create all the connection info, format the query, then format the response into something that php can work with.
Salsa API to-do's:
Create a settings form in drupal to enter in campaign manager/node information to authenticate with the salsa external api.Create a "standard" function/hook to get data from salsa and format it into a more usable format than raw xml output.- Create a "standard" function/hook to save data to salsa.
Salsa Email Blasts to-do's:
Create a block with links to blasts, as well as a few configuration options for it.- Add an input format filter such as [eid:1234] with different display options
- Other ideas on how to use email blasts?
Salsa Campaigns to-do's:
Create a block with links to blasts, as well as a few configuration options for it.- Add an input format filter such as [cid:1234] with different display options
- Other ideas on how to use campaigns?
More as I continue to work with it!

Comments
Create a "standard" function/hook to get data
Have some basics done, allows multiple conditions, field choices, limits, sort by, and group by, etc...
Returns an array instead of an xml object (when querying multiple tables, the return xml object has an "-" inbetween the table names, which objects don't like: ex: supporter and supporter_custom would be [supporter-supporter_custom] in the xml object!).
Unfortunately it is limited to only 2 tables, I hope to get a salsa dev to allow more than 2 tables to be used in a query!
Campaign List
I posted on DIA forums but never got a response to this question. I emailed support and they said: You can create your own content item with a list of campaigns as you wish, but this would not update dynamically. If you want to have your own custom page update dynamically, this would need to be done by creating your own custom page with the API.
Can I put the campaign list on my website? I'd like to have a little box (table) that has the recent campaigns listed. Is it possible to have it show the contents of http://hq-org2.democracyinaction.org/o/KEY_NUMBER/campaign.jsp without needing to have people to go to the page?
At this point, that kind of API understanding is beyond me, but it would be awesome to be able to do this.
Re: Campaign List
I think something similar was requested by rubyji so its on the wish list. Were you looking for a simple list that is just like the title of the campaign as link to it?
If you wanted to do it yourself you would need to know some php and your webhost would have to have the cURL module for php available as well (probably does).
Hopefully i'll be able to get a working(ish) module for drupal done in the near future that could help with this stuff.
Perhaps since this is the second request for that kind of thing i'll see about making that one of the things i test/experiment with while i get this module made.
Progress
Made a bit more progress, i'm pretty happy with what i've come up with as far as getting data out of salsa is concerned, other than the limit of 2 tables.
I'm trying to see if i can get a test org or something created so i can experiment with saving data as i dont want to do that on our organization's database (incase i screw stuff up).
I'm also working on a few example modules that work with the api as I build this. I have 2 right now, one for campaigns and one for email blasts. Right now all they do is add a block that you can display anywhere you want with some options like how many links to display and a more link.
I'm looking into adding an input filter for each as well, similar to the insert_node/insert_blocks modules that would let you embed part or all of a campaign/email in a piece of drupal content.
Example: if you added something like this to a piece of content: [eid:1234] Drupal would automatically replace that with the contents of the email with the id you specify (1234). I could do different options such as a link only: [eid:1234 link] would be replaced with a link to the email blast using the blast subject.
Anyone have any ideas on what other filter type things you would want (not just for email blasts)?
Can I test?
Can you turn this into a formal project and release a module that's in development? If not, could you email me the files so I can test it?
I'll see what i can do about
I'll see what i can do about getting a formal project going, we just finished a big annual conference so much of my time had been sucked up in that stuff.
I'll post a file here tomorrow, regardless of whether i get the formal project started or not, with what i have so far.
Ok here is a link to what i
Ok here is a link to what i have done so far, there are 3 modules: an api, and 2 example modules. The api module does nothing on its own, however the 2 example modules need the api module to function.
The example modules provide 3 things:
A block that has a list of links
A page that has a list of links
A input filter to let you embed salsa content into a drupal node (see: http://groups.drupal.org/node/19986#comment-69926)
To embed:
To embed an email you can type:
[eid:email_blast_KEY] (full HTML email with subject as a link to the original salsa page) or
[eid:email_blast_KEY text] (full text email with subject as a link to the original salsa page) or
[eid:email_blast_KEY link] (only a link to the original salsa page)
To embed an online action:
[cid:campaign_KEY] (full campaign with description, message, etc) or
[cid:campaign_KEY link] (link only to the salsa campaign page)
Keep in mind this is still heavily in development so don't be surprised if there are problems as well as there isn't a whole lot of documentation for it yet either. There is a quick and dirty readme in there to help you with the initial setup.
Starting to work with this code
First, thanks so much for working on this Dan.
In the past I've written a lot of custom code to make Drupal and Salsa talk to each other, but nothing that was polished enough to share as a module. I've done things like collecting signatures and payment for signature ad campaigns (like this) and adding the signers to Salsa once their payment was approved. I've been wanting to work on ore formal DIA/Drupal integration for some years, and you've put together a great start here.
I've downloaded your code and am starting to work with it. I need Salsa integration for a site I'm working on right now, but our immediate need is for saving supporters TO DIA – not so much getting data out. I'm going to try to add that over the next couple of days and see how it goes.
(I've also backported it to D5, since that's what I'm currently working on. The changes were trivial.)
Chris Jones of EchoDitto has shared some code with me that integrates with Webform module to post forms from Drupal back to DIA. I'm going to try to take some of his saving stuff and add it to your salsa_api code.
Have you added any capability to save data back to DIA since you posted your code?
I don't know if you're looking for people to collaborate with you on this, but I am very game, and know a few others as well. It would be great to get a project started on Drupal.org for this - please let me know if you're moving forward with that.
Again, thanks for the work you've put in on this, really promising start. I hope we can rally around and make a terrific Salsa API module for Drupal that will be useful to many people.
Glad to hear another person
Glad to hear another person is taking a stab at working with this! I figured i wasn't the only person out there who had done some tinkering with drupal/salsa integration.
I've just started work saving data to salsa, i was hesitant to work on it because i didnt want to damage our organization's database, however i've gotten hooked up with a developer account at DIA so i now have a sandbox account to play with.
Once things slow down a bit here at work over the next few days i'll have some more time to work on saving data. Mostly i'll try to create the same basic function(s) that i did for getting data out. As i said in the start of this thread my goal is to have this be the thing other modules use to communicate with the salsa database.
I'll go ahead and see about creating an actual project for this today and perhaps then we can get a few others involved in being maintainers?
I'd be interested in seeing the code you mentioned that integrated with the webform module, perhaps there is something there that could help this process along? Or maybe we should see if EchoDitto would like to work with us on this?
Quick update!!!
Just wanted to let you guys know about a response i got from DIA about allowing us to query more than 2 tables at a time (FINALLY!):
The timeout thing may trip us up a bit along the way but this will make more complex queries possible!
Haven't had a chance to try it out but this is promising!
I've not had much time to work on this the last week and a half, but hope to get some more work done later this week on it.
Update
Do we have this set up as an official project yet? If not I can go through the hoops to get a developer account and set it up if you like.
Do you have a recent copy of the api? And Laken, do you have any modules I can play around with as well? I would really like to get more involved, but that would be much easier if we set up an official project and kept versions updated often.
Are you guys interested?
Applyed
I've just applied earlier today so we'll see if they approve it!
Approved
Got approved, dont have time to get the project going yet but i'll see about getting something up there tomorrow!
I, too, would love to help
I, too, would love to help with this. If we can get an official project going soon, so much the better.
What needs to be done?