In This Article:

    Salsa Classic Server-Side API

    In This Article:

      Applications in Salsa Classic are written in a language called "SalsaScript". SalsaScript is a server-side version of Javascript that provides access to internal functionality in Salsa Classic.

      SalsaScript summary

      SalsaScript runs in Salsa's servers at the time that public facing pages and email blasts are constructed.  There are some restrictions.

      • SalsaScript is only available for Salsa Classic.
        • SalsaScript is not available for Salsa Engage.
        • SalsaScript is not available for Salsa CRM.
      • SalsaScript can only be used in website templates or email blasts.
      • SalsaScript cannot be embedded in public-facing web pages.
      • SalsaScript cannot be used from external systems.

      If you need to access Salsa Classic from an external system, then click here to view the Salsa Classic API.

      If you need to access Salsa Engage via an API, then click here.

      Format

      SalsaScript is embedded into a page between a start-script and and end-script marker.

      <?
      //Your script goes here.
      ?>

      The script between those tags is standard Javascript.  Salsa has augmented the Javascript with global interfaces that provide function calls via the SalsaScript API.

      If you make a mistake in an embedded script, Salsa will display a cryptic message at the very bottom of the generated HTML.  View the HTML source to get the most value from that error message.

       

      SalsaScript API 

      The SalsaScript language provides interfaces that allow your embedded script to

      • Examine the parameters passed in a page's URL.
      • Retrieve information from Salsa's database.
      • Create HTML output using record information in the database.
      • Load and execute scripts from other websites.
      • Use other services in Salsa Classic that are not available via the standard API.

      These interfaces are provided by the SalsaScript API.  You can click here to see the services that the SalsaScript API offers.

      Example

      Here's an example script that

      • retrieves a supporter_KEY from the URL,
      • uses the supporter_KEY to read a supporter record, and
      • embeds a greeting.
      <?
      var supporter_KEY = Request.getParameter("supporter_KEY");
      if (supporter_KEY != null) {
      var supporter = DB.getObject('supporter', supporter_KEY);
      if (supporter != null) {
      ?>
        // Embed some HTML using the supporter record
      <h1>Hello, <?= supporter.First_Name ?>!</h1>
      <?
      } else {
      // supporter_KEY is invalid.
      }
      } else {
      // no supporter_KEY in the URL
      }
      ?>

      There are numerous examples of the SalsaScript API in action in the Salsa Classic documentation.  If you don't see what you need, then let us know.

      Questions?

      If you have any questions, please send mail to support@salsalabs.com.  We'll be glad to help.

       

       

      Was this article helpful?
      0 out of 0 found this helpful
      Have more questions? Submit a request

      Comments

      0 comments

      Please sign in to leave a comment.