In today's world, most of the business deals get done via emails and phone calls, but there is always a need for the in-person meetings. A year ago, Salesforce has introduced a powerful package on the similar lines, by the name of FIELD SERVICE LIGHTNING. As the name suggests, it is for the field technicians and others alike, who work by meeting the customers in person.
Whenever we speak of the live meetings, an obvious thought for the user is 'How do I reach there?' and fortunately the answer lies with in Salesforce. In Salesforce there is the provision of showing the account map if the location details are made available. This feature is very useful, to locate the end user or the account on the map. Now to travel to that location however, there is no built in support for any travel APIs, and that is where this Uber Lightning Component comes in.
So, in this article we will see how to leverage the details of the address stored in salesforce and send that data to the UBER API services to establish the connection and book a cab for the Sales Rep to meet their customer - all this booking happens without the Sales Rep leaving Salesforce. Sounds like a plan isn't it.
The component is built on one of the coolest frameworks available - Yes, the Lighting framework. It leverages the design aspect of the component framework so that, this component can be plugged on to any page, or object and the corresponding address related fields be configured.
Once the component is added to the page, and the location fields are configured, it begins to show the Customer location and the Sales Rep's current location on a map. The next part is the integration, arguably the best part. So, UBER provides a developer friendly APIs, that uses the standard OAuth 2.0 mechanism for authentication. Once, the Sales Rep authenticates himself/herself, couple of API calls are made, and the cab is booked. As simple as that.
Below is the demo video and the snapshots of the Component and authorisation with Uber
Uber Component without Token
Token Generation with Uber
Authorisation with Uber
Uber Component in Page Layout
Uber Component on Page
Uber Cab Booking
The following are the API calls that are being made as part of the process :
- The OAuth flow. ( For this, an application needs to be created on the Uber developer site, and also make sure that the 'request' scope* is being asked for in the oauth flow )
- Getting the list of available cabs
- Getting the estimate for a ride
- Booking the cab.
- Polling for the status, or use a webhook.
Once all the above is done, we can then inform the Sales Rep about the cab details.
Scope defines the set of permissions that this application gets on behalf of the Sales Rep.Since, we are trying to book a cab, the ride to be requested on behalf of the Sales rep and hence the need for the 'request' scope.
Some of the points to watch out for could be as follows :
1. The ability to book multiple cabs..
2. The rate limiting factor of the Uber APIs..
3. Showing the cab's real time position on a map..
4. Mode of payment for the payment.
In addition to this, please note that in the above video shown, the Uber application used is a sandbox version. In real time projects, we would have to use the Production version of the application. In the production version, for the scope 'request' to be available, our application needs to be approved by the Uber team. More details on this and also the API on the whole can be found here