Inspiration

In New York City, Seattle and Boston, where ride sharing is a much more popular way to get around than Rochester especially in harsh weather, many people with 9 to 5 jobs are constantly needing to check their phones with logged in mobile apps to get information on Lyft rides and surge pricing. The most important factors riders care about are ETA and COST. I propose that an average person who wishes to ride will continuously check their apps for a period of time until satisfied with the two factors. As a software engineer who spends a lot of time already on a computer, I would like to be able to accomplish this without the need to log in or divert my attention to another device, especially one that requires login or additional information. Slack, an enormously popular collaboration/messaging tool offers a platform to make this possible. Also, ride information and cost information are publicly available on the Lyft API (no need for user credentials), so when the user is convinced the price and ETA are right, they can book rides.

What it does

A Slack bot that requests Lyft ride information on behalf of a user. This way, a user doesn't have to be logged into an app on their phones, or constantly check their phones while working to find rides available until they decide to actually request a ride using their account.

A more detailed-description of what the bot does:

  1. user can supply SlickRyder with a direct message of the format " : "
  2. SlickRyder will parse the message to translate the plaintext addresses into world coordinates (lattitude and longitude) using Google's Geolocation API, which is part of the Google Maps Platform.
  3. SlickRyder will generate an AccessToken according to Lyft's OAuth2 authentication requirements. Once the coordinates have been obtained, SlickRyder supplies the client-authenticated Lyft API with the source and destination coordinates to look for the available ride options by calling Lyft's getETA() method.
  4. When a response is returned from the Lyft API, SlickRyder will parse the response to determine if any rides have been found, and if they are within acceptable time limit away. If not, a response is sent to the user saying there are no rides available at the moment.
  5. If there are rides available, SlickRyder returns a message with sentences generated to reflect the available rides. A direct message will be sent back to the user from the SlickRyder bot that contains a set of ride options (Lyft, LyftXL, etc) along with their ETAs.

How it works:

  1. The Slack API specifies a way to create bots along with events that can trigger different actions on the server. For example, an event of a message can be searched for a keyword, and an appropriate response can be generated for the bot.
  2. SlickRyder has API Keys set up for the Google Maps Platform (part of the Google Cloud Development Platform). It uses this to translate addresses into coordinates.
  3. SlickRyder has a Lyft App set up, into which it authenticates using the required OAuth2 process to receive a client token and an access token that it will use to make api calls.
  4. All requests are made using Axios, which returns promises.

How I built it

  1. First I set up a basic Slack bot app and installed it into a workspace.
  2. Next, I used the slackbots library in node.js (a wrapper on the Slack API) to set up event actions. (Eg: post a message in the general channel when it is up).
  3. Then I set up an action to take a DM from a Slack user which represents a request for ride information from a source to a destination. This message is parsed to extract the source address and destination address in plaintext.
  4. I set up the Google Geolocation API (part of Google Cloud Platform) by obtaining an API Key - SlickRyder uses this to convert plaintext addresses in English to geographical coordinates (latitude and longitude).
  5. I set up a Lyft App in the bottom of the stack. First, SlickRyder is authenticated to the Lyft App I set up. Then, i set it up to take in the source and destination coordinates and return the available ride options for the given locations. These include the type of ride such as Lyft, LyftXL, etc. along with the estimated arrival time and cost.
  6. These two responses (the ETAs and the CostEstimates) are parsed into natural language and SlickRyder returns sentence responses about the options available to the rider.

Challenges I ran into

  1. Had no idea how to build a Slack bot / app at first.
  2. Had no idea how to use Google Cloud Platform.
  3. Had no idea how to use the Lyft API
  4. Had no idea how to use OAuth2 (still don't)
  5. Wasn't fully sure what to build. Pivoted from a lunch ordering Slack bot to a ride ordering Slack bot but I wasn't convinced ordering was the real use case to exploit. Then I decided that the constant querying for the right price was the way to go, especially since this is also protecting the user's privacy by using the public API (no user profile required).
  6. My second time ever using Node.js - promises and callbacks were really confusing to understand (still don't).

Accomplishments that I'm proud of

That i somehow learned the minimal necessary things from the above list to build something sort of usable.

What I learned

  1. Items 1-6 from "Challenges I ran into"
  2. Motivation works.
  3. Hackathons are a lot of fun.

What's next for SlickRyder

Glad you asked. Here's a list of enhancements I'd like to make but do not currently know how:

  1. Have the user input a threshold price and a timeout and inform them with a Slack DM when it either goes below the threshold price, or times out without reaching it so they are not waiting forever.
  2. Integrate ride-ordering functionality by using user credentials SECURELY on behalf of the user to request rides.
  3. Integrate with Uber and other ride sharing apps to enable cross-application ride comparisons!!!
Share this project:
×

Updates