Have you ever been really lazy AND really hungry?

Don't wait to get food. Don't download an app. Don't even open up a browser. Simply text 1-217-615-2TXT to get food. Want a cheeseburger? Just send "I want a cheeseburger" to txture. It's that simple.

Implementation details

txture uses the Twilio API to communicate with users. When a user sends their first text message to the txture number, the txture server generates a secure one-time-use URL for the user to enter their information. After that, no more data entry is necessary.

Input processing

Once a new message is received from Twilio, it goes through a number of steps.

  • The request to the Twilio API endpoint is validated against a token. This prevents unauthorized use of the API.
  • If a user database entry for this phone number has not yet been created, txture creates a new user row in the database and starts the on-boarding process.
  • The message is first sent into a simple DFA that defines the interaction between the user and txture. The DFA changes state depending on the type and content of the input.
  • If the DFA is ready to receive a new order request, it first sends the message into a statistical Natural Language Processor provided by the Pattern library. This gets "nouns," "verbs," and "prepositions" that describe what food the user is trying to order, what action the user is trying to do, and additional specifications from the order (e.g. "a hamburger" vs. "a hamburger from McDonalds").
  • If a correct verb is used, the nouns and prepositions get sent to a fuzzy string matching engine provided by the FuzzyWuzzy library. The engine utilizes the Levenshtein distance algorithm to determine the best match for a given string among a selection of several. The app loads the data for all the nearby restaurants from the Ordrx API and generates a set of strings to compare against. Then a fuzzy string comparison is done to pick the most correct food item.
  • From there, txture responds to Twilio's API request with a text message confirming the order, including the price and delivery information. If the user responds in the affirmative, an order request is sent to the Ordrx API and the food is delivered!

Future Improvements

  • Food selection improvements: Right now the best food is chosen by the best string matches. In the future, integration with Yelp to provide review data along with machine learning to adapt to the user's tastes would both provide useful data points to help the selection process.
  • More complex interaction: More functionality could be added to the ordering process, including the ability to order multiple items, specify varieties of item (e.g. "I want a cheeseburger," "plain?" "with pickles"), and specify the time of delivery (e.g. "Deliver me a cheeseburger at 12:30").
  • Itegration with other services: Food is just the beginning. The same techniques applied here could be used in dozens of other situations. How about using txture to buy movie tickets? Make reservations at restaurants? Buy stock? Send a postcard to your grandmother? The possibilities are pretty much endless.

Built With

Share this project:
×

Updates