Integrating with the Internet of Things

Integrating with the Internet of Things

In this article I talk about some integration patterns that can be used when wanting to integrate multiple devices with Salesforce. Imagine the scenario where we are a fitness tracker manufacturer and we want to communicate real-time or near-real-time updates from a fitness device through to Salesforce. Typically this would be challenging due to the issues of LDV (Large Data Volume) and the Salesforce Inbound API limits which would make it near impossible to build a solution making calls into a Salesforce org. Despite these large challenges, there are still patterns we can adopt and use to make this form of use case work, and drive automations from the Salesforce platform. Lets work through a few examples and I will detail out the architectures that can be used to make it work.


Scenario 1 - Connected Fridges


We are a company that manufactures smart fridges. We want to be able to send real-time alerts and notifications to customers whenever the fridge sensor detects a fault or a reduction in temperature. We can approach this with the following architecture in Salesforce:

Salesforce Org: Our main Salesforce Org which is owned and run by the Fridge Company. This would be the global CRM containing Fridge and Customer Data

Heroku Backend Service: A Heroku Backend service hosting REST APIs that the worldwide fridges are allowed to call in to

Heroku Connect: To synchronise data between Salesforce and Heroku and invoke the creation of Platform Events

  1. An event occurs in the Smart Fridge which picks up on a sudden rise in the safe temperature in the fridge.
  2. Using a REST API, the Smart Fridge sends a notification to the Fridge Back-End service which is hosted on Heroku. Each fridge communicates with an API hosted on Heroku which is built to take notifications from global fridges.
  3. The Heroku Service creates and saves a new Platform Event record.
  4. Heroku Connect synchronizes this platform event to Salesforce.
  5. In Salesforce we fire a Process Builder or IOT Orchestration based on the Platform Event. 
  6. The Platform event could then trigger a chatter post, email notification or invoke a push notification or SMS via a trigger ensuring that the user gets alerted on their mobile devide of a temperature rise event.


Now the obvious question that can be raised here is when you have over a million fridges distributed worldwide, would this not breach Salesforce API limits. It would, however since we are using Heroku Connect, Platform Event records that are raised via Heroku Connect do not count towards the inbound API call limit in Salesforce. As a result we are able to use this architectural approach and stay inside of Salesforce platform limits.


Scenario 2 - Trucks, Shipments and GPS Coordinates


Trucks need to send their GPS co-ordinates every minute into the application. Shipments which are going to be late, should be notified to the customer. We can adopt the following architecture for this scenario



In the above example we are leveraging an ESB whch will front an API that trucks can submit their real-time coordinates to. These can be written to a backend service. A batch process in the back-end service will run every 5 minutes looking for all late running shipments and use the ESB to send an API call into Salesforce to update the Shipment records. This will flow as follows

  1. Truck sends a message to the ESB with it’s co-ordinates
  2. ESB writes the coordinates to the Data Warehouse
  3. Custom Node.js application runs a scheduled process every 10 minutes, which calculates if a Shipment may be late based on GPS data.
  4. Node.js application makes a call into the ESB to update the Shipment statuses
  5. ESB make a Remote Call In to Salesforce via the SOAP API to update the status on the Shipment records.
The above scenarios cover example where we want to be able to make real-time calls into the Salesforce platform from multiple devices in real-time, yet want to follow a pattern that keeps us within the API governor limits. It's useful to keep these approaches in mind for the CTA exam when considering integration ideas.

Comments

  1. Thanks Mitesh for a nice guidance article! can we not fit in Heroku also in Scenario 2?

    ReplyDelete

Post a Comment

Popular posts from this blog

CTA Study Planning

Salesforce Integration Approaches

Top 10 Expert Salesforce CTA Tips