Date post: | 02-Dec-2014 |
Category: |
Technology |
Upload: | internetcreations |
View: | 211 times |
Download: | 2 times |
Control Your World Using the Salesforce1 Platform (IoT)
Chris FerraroChief IT Architect@chrisf_59
Safe HarborSafe harbor statement under the Private Securities Litigation Reform Act of 1995: This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties materialize or if any of the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results expressed or implied by the forward-looking statements we make. All statements other than statements of historical fact could be deemed forward-looking, including any projections of product or service availability, subscriber growth, earnings, revenues, or other financial items and any statements regarding strategies or plans of management for future operations, statements of belief, any statements concerning new, planned, or upgraded services or technology developments and customer contracts or use of our services. The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new functionality for our service, new products and services, our new business model, our past operating losses, possible fluctuations in our operating results and rate of growth, interruptions or delays in our Web hosting, breach of our security measures, the outcome of any litigation, risks associated with completed and any possible mergers and acquisitions, the immature market in which we operate, our relatively limited operating history, our ability to expand, retain, and motivate our employees and manage our growth, new releases of our service and successful customer deployment, our limited history reselling non-salesforce.com products, and utilization and selling to larger enterprise customers. Further information on potential factors that could affect the financial results of salesforce.com, inc. is included in our annual report on Form 10-K for the most recent fiscal year and in our quarterly report on Form 10-Q for the most recent fiscal quarter. These documents and others containing important disclosures are available on the SEC Filings section of the Investor Information section of our Web site. Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make the purchase decisions based upon features that are currently available. Salesforce.com, inc. assumes no obligation and does not intend to update these forward-looking statements.
Place Customer or
Partner logo in white area of
slide, centered horizontally
Chris FerraroChief IT Architect
About Internet Creationshttp://www.internetcreations.com
• Salesforce Consulting & AppExchange Apps• Member of the Cloud Collective: AppExchange Category Leaders• #1 Rated App for Agent Productivity
Internet Creations Labs
We balance work with the passion for learning. Technical staff are encouraged to spend up to 20% of their time on developing and pursuing their own creative ideas.
Agenda
- The Internet of Things & Salesforce1- Platform APIs- Project: Controlling Christmas Lights using HTTP Class- Project: Flash lights upon new P1 Case using workflow & IFTTT (Live Demo)- Project: Temperature Monitoring using REST API (Live Demo)- Questions & Comments
Internet of Things
• Interconnected things using low cost (usually) networkable devices
• Connect smart devices/physical objects/sensors
• Connecting devices to the Internet allows automation of anything from anywhere
Salesforce1
Salesforce1 Platform(Force.com, Heroku, and ExactTarget Fuel)
Salesforce1 Mobile App
Platform API: Salesforce Web Services
Did you know?
Common Uses
• Integrate external systems
• Load records with Dataloader
• Connect with IoT devices
60% of Salesforcetransactions are API calls
Platform API: Salesforce Web Services
• Outbound– HTTP Class– WSDL2Apex– Outbound messaging– Streaming API
• Inbound– SOAP API– REST API– Custom web services
Platform API: Salesforce Web Services
Type
• HTTP Classes
• WSDL2Apex
Advantages
• Highly customizable, request and response can be formatted in any way.
• Auto-generates Apex code to interact with a SOAP based web service
Uses
• Callouts to simple or complex external systems. Custom parsing logic for all types of responses including XML, JSON, and Custom formats.
• Integration with external systems
Outbound
Platform API: Salesforce Web Services
Type
• Outbound Messaging
• Streaming API
Advantages
• Triggered by workflow, automatic retries guarantee delivery
• No need to poll for data, application is notified of changes
Uses
• Integration with middleware applications
• Use in lieu of polling for record changes
Outbound (continued)
Platform API: Salesforce Web Services
Type
• SOAP API
• REST API
• Custom Web Services
Advantages
• Structured access to Salesforce data
• Simplified access to Salesforce data
• Implement custom logic
Uses
• External applications that interact with SF data
• Mobile applications, external web sites that pull data
• Exposing complex custom business logic to external apps
Inbound
HTTP Class for Callouts• IoT devices frequently have a REST or JSON based API– REST– JSON-RPC
• Invoke callouts to devices using the HTTP class
• Use @future or the Queueable interface to invoke callouts from a trigger– Queueable is new in Winter 15 and allows events to be chained. This can be helpful if you need to contact multiple devices and the actions are dependent.
• Need to control the local network and open firewall ports inbound from SF
Project: Controlling Christmas Lights (HTTP Class)
Project: Controlling Christmas Lights (HTTP Class)
• Configure endpoint under Remote Site Settings
Arduino Yun Sainsmart relay board
Project: Controlling Christmas Lights (HTTP Class)
Project: Controlling Christmas Lights (HTTP Class)public class ChristmasLights {
@Future(callout=true) public static void doCallout(string action){ string URL = 'http://123.81.144.87:8800/arduino/' + action + '/go'; Http h = new Http();
HttpRequest req = new HttpRequest(); req.setTimeout(30000);
req.setEndpoint(url);req.setMethod('GET');
HttpResponse res = h.send(req); }}
Project: Flashing Lights (Workflow & IFTTT)
• No need to write code• Salesforce workflow sends email alert to IFTTT
IFTTT Rule Belkin Wemo Switch Light
Project: Flashing Lights (Workflow & IFTTT)
Inbound data to Salesforce
• REST API or Custom Web Service– Create a Connected App– Login to get a session token for use in API calls
• Custom Web Service exposed on a force.com site– Not particularly secure. Anyone could execute the web service!
Tessel(A microcontroller that runs Javascript)
Project: Temperature Monitoring (REST API)
Temperature probe
‘grant_type=password&client_id=3M1234Z_r.QzrS7gqVEDhgIEgmfljZJ_I8eqZpdwZgzaZhMVU1vAv43VT37PimUNPUgHY5oABV3sH7AT0oYGx&client_secret=123456789090124&[email protected]&password=Basdfgavz!DPAB4MDJVLKxjdhTLKeAaGv7’
• grant_type=password• client_id= Consumer key from Connect App• client_secret = Consumer Secret from Connect App• username= Salesforce username• password= Password + Security Token
API returns JSON by default which is parsed to get the session token and instance URL:
...res.on('data', function(d) {var parsed = JSON.parse(d);var instanceURL = parsed.instance_url;var token = parsed.access_token;}
Project: Temperature Monitoring (REST API)OAuth Authentication – Username & Password
var options = { port: 443,method: 'POST',hostname: instanceURL,path: '/services/data/v31.0/sobjects/Inbound_Data__c/',headers: {Host: 'na10.salesforce.com','Accept': '*/*',"User-Agent": "tessel",'Content-Type': 'application/json','Authorization': ‘Bearer ‘ + token}
var temperature = getTemperature();var requestBody = ‘{ “Temperature__c" : ‘ + temperature + ‘ }’;
var req = https.request(options, callbackFunction);req.write(requestBody);req.end();
Project: Temperature Monitoring (REST API)REST API Call
Resources• https://developer.salesforce.com/page/Creating_REST_APIs_using_Apex_REST
• http://www.salesforce.com/us/developer/docs/integration_patterns/integration_patterns_and_practices.pdf
• https://www.salesforce.com/us/developer/docs/api_rest/
• https://tessel.io/
Questions? Comments?