Skip to Content
Author's profile photo Richard Hirsch

Apache ESME – SAP River Integration

Whenever I get developer access to a new environment, the first thing I do is try and integrate it with Apache Enterprise Social Messaging Environment (ESME) which is a collaboration environment for the enterprise associated with micro-messages and other activity streams content.
I’ve recently been access to the SAP River preview platform and decided to integrate this environment as well. “SAP River”  supports lightweight extensions to SAP’s on-premises ERP (enterprise resource planning) software [SOURCE] and is an important part of SAP’s new On-Demand strategy.

To help clarify where River fits into this strategy, I’ve identified where we are on SAP’s new OnDemand Strategy “Map”.

My Goal

My goal in this very early proof-of-concept was to explore River as a development platform and identify the ease of integrating this platform with other OnDemand tools.   Using ESME’s REST API, I quickly set up a custom action to send messages to ESME that reflected status changes in River records.

The following video provides details of the integration and shows how it works in realtime.  

At a very crude level, this functionality is similar to SalesForce Chatter where changes in business objects are sent to individuals’  activity streams. Currently, the POC shows the possibility of activity stream inclusion based on manual insertion of a custom action in a particular River application.  Ideally, there might be someway to have this available for different applications without having the necessity of including it manually in every application. I have yet to find out how or if this is possible in River. This is important functionality for developers providing functionality for a variety of customers. It is also central and typical of a PAAS environment.

Thanks are Due…

I’d like to thank Gigi Read and Juergen Schmerder for giving me access to the River Preview and Ethan Jewett for helping me with the CodeBox coding.  Jurgen also responded quickly to my irritating forum posts when I couldn’t find what I needed in the online River documentation.

Building on my POC

If you want to use my POC as the base for your own tests / explorations with River, here are the details.


You will need an ESME token. 

  1. Go to the ESME Cloud instance and create a user or if already have a user, log-in.
  2. Go to “MyTokens” page
  3. Create a token.
  4. Use this token in your River Custom Action.

You will also need a user on the River Preview System.

If you want to get a headstart, I’ve added my test application to the River CodeX “Sample Apps” Project.  If you are a member of the Codex Project, you should be able to import the project – perhaps via URL – although I haven’t tried this yet.

Custom Action Code

var urlString = "";
var request = $UTILS.http.createRequest(urlString, "POST");
var response = $UTILS.http.sendRequest(request);
var currInput = $CTX.getInput().getRecord(); 
default xml namespace =  $CTX.collection.getDefaultDataNamespace();
var inputXMLData = new XML(currInput.getData());
var fldvalue = inputXMLData.Test1.toString().replace(/\n/g,"");
var uservalue = inputXMLData.field.toString().replace(/\n/g,"");
var custname = inputXMLData.CustomerName.toString().replace(/\n/g,"");
var urlString2 = "'"
+ uservalue + "'+has+changed+customer+data+-+the+new+description+is+'" + fldvalue +"' for customer '"+custname + "'";
var request2 = $UTILS.http.createRequest(urlString2, "POST");
var response2 = $UTILS.http.sendRequest(request2);
$"response code is "+ response2.getResponseCode());
$"6 is " + response2.getBody().split("\n").join(""));

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member
      Hi Dick,

      Congratulations for getting the ESME/River integration done. Looks quite straight-forward. I loved to read your blog and especially loved the video. Waiting for more to come 🙂


      Author's profile photo Richard Hirsch
      Richard Hirsch
      Blog Post Author

      The video saved lots of time. Look for more River-related videos in the near future.


      Author's profile photo Former Member
      Former Member
      You make it look easy, Dick. 😉 Looking forward to seeing more of your work on River.


      Author's profile photo Richard Hirsch
      Richard Hirsch
      Blog Post Author
      Thanks for giving me a playground for me to try out my crazy ideas ;->


      Author's profile photo John Astill
      John Astill
      Nice example to follow.


      Author's profile photo Richard Hirsch
      Richard Hirsch
      Blog Post Author
      The actual coding wasn't difficult - it was the learning process that took time. I'm optimistic that future coding escapades with River will be even easier.