With the recent Spring 12 release of Salesforce very few would have noticed a little unsung feature that will change the way many applications interact with with Salesforce. The Streaming API went GA and allows to listen to changes to objects in the Salesforce platform rather than polling. Salesforce joins the ranks of other leading APIs such as Twitter, Facebook and Instagram that all offer real-time APIs to enable users to consume data in real-time, as events occur.
Polling isn’t Evil, but…
You might be thinking polling isn’t that bad, but there are some real benefits to real-time APIs. It all comes down to time and efficiency. Real-time APIs change the traditional HTTP RPC exchange between server and client into an event driven model. In other words, rather than your app calling in repeatedly, you establish an open channel through an API call and then the server can send events to you as they happen. This means that your app is not wasting resources polling the server repeatedly and getting empty responses back but it also mean you receive new events as they happen. If you are not familiar with this concept the PubSubHubBub guys at google do a great job of explaining this.
Real-time API Benefits
- Real-time APIs are more secure than other callback methods such as Webhooks or directly opening an HTTP port to receive events, since most IT folks want to keep ports open to the outside world to an absolute minimum. Real-time APIs are client initiated, and there is no server socket open to the public.
- Salesforce, like all APIs have an API limit. this means you cannot just poll the API more to get updates more quickly. Sometimes, buying more API calls is an option, but you are just paying more for the same data.
- Real-time APIs are more efficient since they reduce the amount of clients concurrently hitting the server and reduces the amount of empty responses sent back to the clients. I’ve heard that up to 60% of the queries made to Salesforce return an empty response. The benefits to the end user is more about piece of mind that their app is reducing the amount or resources and power an app uses. This makes a big difference if everyone starts doing it.
Waiting for Data
Increasingly, applications cannot wait for updates. A common example for Salesforce might be a call center application where having the recent view of a customer at the time the customer calls is crucial to completing a call successfully. Integration with with other applications is another area where real-time really matters. Synchronizing CRM with marketing automation, finance and other applications needs to happen immediately so the company is running on a consistent dataset.
Integrating with the Salesforce Real-time API
You’ll be happy to know that Mule has a Salesforce cloud connector that supports the Salesforce API including the Bulk API and the new Real-time API. Salesforce can be used from Mule ESB or our cloud platform, Mule iON. This means you can integrate gorund to cloud or cloud to cloud, Salesforce is supported directly in Mule Studio too.
The Salesforce real-time APIs is an evolution of the Salesforce API. Right now its one way (server to client) but you can expect to be able to push data streams to Salesforce too in the near future. I suspect Salesforce will spark a trend in data-centric APIs to offer a real-time option. We’re already seeing this in push services such as PubNub, Pusher, x.stream.ly, SuperFeedr and more. If you are still wondering whether you need real-time APIs, consider that there are no drawbacks and plenty of benefits; can you really afford to wait for data?