All the sessions from Transform 2021 are available on-demand now. Watch now.
I am a Uber power user, meaning I use Uber as my primary means of transport.
In the morning I use UberPool to get from home to office and in the evening from office to home. I do this six days a week.
Here is what my trip-booking experience looks like:
- Wait for the app to start. This takes awhile sometimes, as the app looks for GPS to determine the current location.
- After startup I am presented with a pop up to rate my previous ride. I do that.
- I set my pickup location.
- Enter my destination. Uber makes it easier for me here by prompting my most likely destination.
- Choose the number of seats (which is always one).
- Check if the fare is in a reasonable range. It almost always is.
- Request a ride.
If everything goes well this process easily takes about 40 seconds. The only exceptions to this flow happen when my online prepaid wallet is low on balance or there is a surge on fares or UberPool is not available. These are rare occurrences.
I have been doing this for three months now and I started wondering if there was a better way to do these seven steps. Don’t get me wrong — I think Uber provides a delightful trip booking experience. But after going through the same process hundreds of times I feel Uber could add a little bit of automation. After all, it has access to all my past trip history, it knows my preferred payment method, the usual time of the day when I book my trips, etc. With some basic arithmetic it can make an intelligent guess on my pickup location and destination and provide me with an option to book my trip in a single step! The product managers at Uber may come up with such a feature someday. Until then I needed an alternate solution.
Being aware of Uber’s public APIs, I headed over to Uber API and a quick two minute overview of the docs told me that I could programmatically book my rides. Fantastic! I registered a new Uber app and grabbed my API keys. Then I set up an API collection on Postman to test these APIs. The process to book an UberPool ride consists of the following API calls:
- Check if UberPool is available at the pickup location. If yes, then grab the product_id for UberPool from the API response.
- Get an estimate of the fare. The API response for this call gives you, among other things, the fare_id, fare estimate, and surge multiplier for the trip.
- If the fare estimate is within a reasonable range, use the product_id from step 1 and fare_id from step 2 to book a ride.
The Uber API documentation is quite good and made it quite quick and easy for me to programmatically book a ride using their APIs. So far so good.
Now I needed a front end to book my rides. Surely I would not open up my laptop and then use Postman to book a simple ride. The front end had to be something that enabled a one-step operation; otherwise the purpose of this entire exercise would be defeated. Making a chatbot on the recently released Messenger Platform appeared to be the perfect candidate for this. The added advantage was that I would not have to install any additional apps on my phone.
The only roadblock was that I would need a server backend to handle chat messages for the bot. Setting up an always-on server for something that would only be used twice a day did not make a lot of sense. More importantly I wasn’t willing to spend any money on this.
Amazon’s API Gateway and Lambda were the solutions to this problem. Amazon API Gateway is a fully managed service that makes it easy for developers to create and maintain APIs at any scale. It acts as a “front door” for applications to access functionality from your back-end services. AWS Lambda lets you run code without provisioning or managing servers. You pay only for the compute time you consume — there is no charge when your code is not running. Both the services have a free tier that includes one million API calls received per month, which is more than enough for my purpose.
With help from some online tutorials and blog posts I was finally able to set up the chatbot. I type “book” when I want to book a ride. If everything goes well, I get a notification on my Uber app about the ride. The current booking logic is quite simple . If I try to request a ride in the morning it books a ride from home to office. In the evening it books a ride from office to home.
At other times it tells me to use my Uber app to book the ride. I have also specified the fare range I am willing to pay for these trips.
I have been using this bot for the past two weeks now, and the only time it failed me was when I was taking a ride from a place I had not visited in while. That was the only time I had to open the Uber app to book my ride. Not bad at all.
Booking a car requires me to pay attention, ensure GPS is locked on properly, picking a destination, and picking the right flavor of Uber. When using my bot, I type “book”, put my phone away, and gather my things to get ready for my ride to arrive. Super convenient!
The bot saves about one minute for each booking, which means I save about 10 minutes every week for my ride from home to office and back. That is enough time to watch an entire season of #GoT in a year.
This bot is designed to obey only my commands and is not available for public use. However, I have made the code and instructions public. Now you can create your own assistant.
VentureBeatVentureBeat's mission is to be a digital town square for technical decision-makers to gain knowledge about transformative technology and transact. Our site delivers essential information on data technologies and strategies to guide you as you lead your organizations. We invite you to become a member of our community, to access:
- up-to-date information on the subjects of interest to you
- our newsletters
- gated thought-leader content and discounted access to our prized events, such as Transform 2021: Learn More
- networking features, and more