Skip to main content
Uber logo

Go anywhere with Uber

Request a rideRequest a ride

Go anywhere with Uber

Request a rideRequest a ride
Engineering

Engineering the Future with the Uber Developer Platform

April 14, 2017 / Global
Featured image for Engineering the Future with the Uber Developer Platform

Last week, we highlighted some presentations delivered during our first-ever Uber Technology Day. In this article, developer advocate and Technology Day presenter Charlyn Gonda discusses how the Uber Developer Platform empowers engineers to build dynamic in-app experiences.

Let us start with a factour wildest dreams are coming true. Real-life technology and science fiction are quickly converging into reality, and it is an amazing time to be a developer. Things that we used to only see in movies are becoming part of our everyday experience. Smart homes that intelligently predict your needs, self-driving vehicles that whisk you from Point A to Point B,  and devices that monitor your health, fitness, and more. Soon, we might even start seeing flying cars. In many ways, pushing the “Request” button on the Uber rider app, getting into your ride, and being driven to your destination is the closest experience we have to teleportation right now. While flying cars are still a few years away, Uber is enabling futuristic innovations today with the Uber Developer Platform.

 

Designing the Future

Our mission is to empower developers around the world to build moving experiences for riders and drivers alike. We are already well on our way with some exciting integrations that bring the future closer than ever before. Ask any of the popular conversational agents these days, like Google Home, Alexa, or Hound, to call an Uber, and they will activate the Ride Requests APIno taps required.

Image

And while you are on your ride, you can engage with intelligent apps that can deliver customized on-trip experiences. For example, Otto Radio, an app that provides audio news, narrated articles, and podcasts, normally asks users for some length of time and then builds a list of personalized content to fill that time. But, when you are in an Uber, it uses the Trip Experience API to automatically detect the length of your trip and then build the perfect playlist for you to listen to during your ride.

The same API makes it possible to notify your household appliances that you are on the way home so they can personalize your arrival, for instance, by switching on the hallway light, turning up the heat in your living room, and playing some smooth jazz music. With the push of a button, you can even have dinner, paper towels, dog treats, or nearly any other item delivered directly to your door by businesses powered with the UberRUSH API. Fido’s food may not be able to teleport directly into his bowl, but this gets us pretty close.

Organizations like Stride and Jobcase improve the experiences of driver-partners through the Driver API. Stride launched the Uber 1099 Tax Calculator to help driver-partners better navigate tax season. Jobcase has created a work management and job discovery app tailored exclusively to Uber’s driver partners.

Of course, it is imaginative developers and builders like you that bring this future to life. In this article, we will take a look at Uber’s Trip Experience API as an example of what our Developer Platform is capable of by showcasing how the trip lifecycle works and walking through how we would build an app on the API.

 

Dissecting the Trip Lifecycle

The Uber trip lifecycle consists of several states: you request a ride, a driver accepts, the car arrives, you get in the car, and then you reach your destination. Simple and easy. Now, if you have an app that uses the Trip Experience API and your user opts in to connect their Uber account to your app, your app can be notified whenever a user requests a ride and all the state changes in this lifecycle. These notifications come in the form of webhooks, and gives you more information about the state of the trip.

For example, when the connected rider gets into an Uber, the Uber API can give you more information about their journey: whether they are heading home or to work, the duration of their trip, and their destination location, to name a few.  When combined with existing knowledge about a user’s personal preferences, these pieces of Uber data can deliver a more context-aware experience capable of being accessed by the user at any point in time during their trip.

 

Creating an In-App Trip Experience

There are four main steps when creating a Trip Experience in your app using Uber’s API:

  1. Encourage your users to connect their Uber account to your app
  2. Detect when a user initiates an Uber ride
  3. Get more information about the user’s context
  4. Use this data as context for a better user experience

Before we start, you need to create an app in the developer dashboard and enter a webhook URL in the Settings tab where your app will be able to receive webhook notifications. Below, we discuss each step in detail.

Connect your user

First, you will have to let your users know that they can connect their Uber account somewhere in your app. You can then use single sign-on or an OAuth 2.0 flow to facilitate this connection.

Image

When the user opts-in to connecting their Uber account, a permission screen will be shown that will let the user know what data will be shared between the Uber API and your app. When the user clicks “Allow,” your app will then be able to access two pieces of information used to identify a given user: their Uber ID and an Uber Access Token. These two pieces of data are what the app uses to detect if a user is currently on an Uber ride.

Detect when a user initiates a ride

If the user has granted you permission to access and use their Uber data, you will get a webhook notification whenever your user requests an Uber ride (and whenever their ride status transitions to a new state in the trip lifecycle):

{
   “event_id”: “3a3f3da4-14ac-4056-bbf2-d0b9cdcb0777”,
   “event_time”: 1427343990,
   “event_type”: “all_trips.status_changed”,
   “meta”: {
       “user_id”: “d13dff8b”,
       “resource_id”: “2a2f3da4”,
       “status”: “accepted”
   },
   “resource_href”: “https://api.uber.com/v1.2/requests/2a2f3da4”
}

Notice that there’s a user_id field and a resource_id field. Since you have a list of users and their corresponding Uber IDs, you can use this user_id field to figure out which one of your users is currently requesting a ride. You can then use the resource_id field together with the access token you have associated with this user to gather Uber data to use as context for your app experience.

Gather more information about the user’s context

Your app can detect the user’s real-time information that they’ve allowed access to about their ongoing Uber ride so that you can provide a dynamic user experience, including:

  1. Where they are going
  2. Where they are coming from
  3. Whether they are going to a place they frequent (home or work)
  4. Details about their ride (driver and vehicle)
  5. Type of Uber they’re using (uberX, uberPOOL, etc.)

There are a handful of endpoints that can be used to gather this data. For example, you can use the Ride Details endpoint (GET /requests/{request_id}) to determine the current status of an ongoing ride request. In this scenario, resource_id from the webhook payload corresponds to the Ride Detail request_id URL parameter. As a reminder, your access to and use of this information is subject to the restrictions in the Uber Developer Platform Terms of Use.

Use Uber data as context to optimize user experience

Now that you know how to gather Uber data to use as context for your app, you can decide which pieces of information are relevant to creating a contextual in-app trip experience for your user. You can also use these data points to figure out when to trigger useful actions based on their trip state.

Here are some examples of how this data is being used as context to enhance the trip experience with Uber:

Image

 

Hoodline is an app that delivers hyperlocal news based on your location. When you connect Hoodline to your Uber account and take a ride, it will put together a feed of curated articles that are related to your destination, keeping you informed of local news and events.

Image

 

Cupper is an app that makes it easy to get your caffeine fix by detecting your Uber ride destination and suggesting popular coffee shops nearby.  Users can even share the status and ETA of their ride via Cupper’s in-app iMessage extension.

Image

Otto Radio, introduced earlier, provides a playlist of news, narrated articles, and podcasts tailored to the duration of your trip. You can also tune into dedicated stations about any topic you choose so you can stay informed about the things you care about most.

Image

Benefits provider Stride, also mentioned earlier, recently launched the Uber 1099 Tax Calculator which helps driver partners calculate their taxes and claim deductions most would otherwise miss. In addition to making tax season easier to navigate, the Uber 1099 Tax Calculator helps driver partners keep more of their earnings.

These use cases are just a few examples of how apps can be more in tune to the real-time contexts of their users using the Uber Developer Platform. It is hard to imagine a world without apps, and pretty soon it will be hard to imagine apps without the capacity to optimize user experiences based on personal preferences.

The Uber Developer Platform is enabling technologists to build all kinds of futuristic interfaces that were once just figments of our imaginations. It enables conversational agents to request rides for you; it augments intelligent apps to deliver customized rider experiences; it puts your your phone to work during tax season; and it even lets you order Fido’s dinner. To put it simply, the platform makes smart things smarter — and Uber Engineering has only just scratched the surface of what is next.

What future will you build? Keep learning and get started at https://developer.uber.com. If this type of work excites you, consider applying for a role on Uber’s Developer Platform team.

Charlyn Gonda is a developer advocate on the Uber Developer Platform team. She loves to inspire developers to build moving experiences, and thinks “tacocat” spelled backwards is the best word ever.

Posted by Charlyn Gonda

Category: