Welcome to the Salsa Cookbook! Here you will find examples of commonly used features of the API. All saving and editing options in Salsa also exist via the API.... but it's often challenging to try and remember all of them. Hence the Cookbook.
To get started with the Cookbook, you need to have an account on a Salsa Node. All the calls below are assumed to be prefixed with that node, and assumes that you have authenticated. Some scenarios do not require authentication, see those examples here.
Throughout our documentation you will see URLs like http://sample.nodeurl.tld. Replace this URL with the base portion of your headquarters URL. This could be similar to http://sandbox.salsalabs.org. This references your ACTUAL account. Trying to use your campaign manager with a different node will not work. By default, campaign managers DO NOT have accounts on the sandbox node.
For language specific examples, reference the following links:
http://sample.nodeurl.tld/save?xml&object=supporter&Email=mytestemail@test.comreturns back:
<success object="supporter" key="2373">Modified entry 2373</success>
By default, when using the save controller, supporters are deduplicated by Email address. All fields in the supporter object are available, just by name, as in all objects.
http://sample.nodeurl.tld/save?xml&object=supporter&Email=mytestemail@test.com&First_Name=John&Last_Name=Doe&Phone=703-555-5555
http://sample.nodeurl.tld/save?xml&object=groups&Group_Name=My Test GroupReturns back a key for that group
<success object="groups" key="18">Modified entry 18</success>
http://sample.nodeurl.tld/save?xml&object=supporter_groups&supporter_KEY=2373&groups_KEY=18where 2373 is the unique supporter key, and 18 is the unique groups key.
Membership in a group is deduplicated -- one supporter can only be in a group once, but can be in as many groups as needed.
http://sample.nodeurl.tld/save?xml&object=donation&supporter_KEY=2373&amount=15.35&Transaction_Date=2008-08-03&Transaction_Type=Donation
Email blast information, such as subject and content, is stored in the email_blast object. Targeting information is stored in the 'query' object, if required.
If no query_KEY is specified in the blast, the email will go to ALL supporters
http://sample.nodeurl.tld/save?xml&object=query&Name=My Test Groupreturns:
<success object="query" key="222">Modified entry 222</success>To add a condition to the query:
http://sample.nodeurl.tld/save?xml&object=query_condition&query_KEY=222&category=groups&table_name=groups&operator=include&value=18returns:
<success object="query_condition" key="671">Modified entry 671</success>
http://sample.nodeurl.tld/save?xml&object=email_blast&query_KEY=671&Subject=This is my test email blast&Stage=Pending&HTML_Content=<h2>Test HTML Content</h2>&Text_Content=Test Text Contentreturns:
<success object="email_blast" key="37081">Modified entry 37081</success>This will send a multi-part email blast message to the supporters who match query #671, which is a query of people in group #18