Twilio Hackathon: Shared (to-do, grocery) lists between friends, family, and businesses
Tags: twiliohackathon, rails, ruby
Published: 2020-04-11 22:40:49

[Comment]: # (All of this is placeholder text. Use this format or any other format of your choosing to best describe your project.)

[Reminder]: # (Make sure you've submitted the Twilio CodeExchange agreement: https://ahoy.twilio.com/code-exchange-community)

[Important]: # (By making a submission, you agree to the competition's terms: https://www.twilio.com/legal/twilio-dev-hackathon-terms)

My first post on dev.to, and fist ever hackathon! 

I'm a tinkerer and builder, and I went as far as founding + raising money for a startup via one project. Moreover, I believe the future of business communications is evolving from websites (2000s), to mobile apps (2010s), and to text/chat (2020s). This is my first time playing with Twilio API in depth and I'm excited to dig in.

## What I'm going to build
I started out brainstorming an ambitious project of text/chat for local businesses to interact with consumers, so businesses don't have to invest in costly websites/mobile apps to go digital (think restaurants take-outs, coffee shops order-aheads). Especially in covid-19 world, local businesses are even more dependent on take-outs via phone, deliveries, and "non-physical" channels.

However, the project has been reduced in scope to a simple to-do or grocery list for this hackathon. This will serve as a platform for anything that requires a list, like menu items, order list, grocery list, etc. 

### MVP features:
* Sign up
* Add items
* Remove items
* Show items
* Manage multiple lists
* ~~Share/collaborate list with friends/family (if time allows)~~
* *(Edit 4/29):* Invite via vcard / MMS

### Category Submission: 
Exciting X-Factors

## Demo Link
Text "hi" to 616.344.5566

*Edit (4/13)*: Deployed to AWS EBS and "hi" in the cloud! Do note that EBS is a bit janky with Rails 6, so I wrestled with it a bit. Might go with a container next time.

*Edit (4/18)*: All commands on screens below should work. Looking forward to some feedback!

![textbot-demo](https://dev-to-uploads.s3.amazonaws.com/i/9nstfu9ci1c9701fke9k.png)

## Link to Code
*Edit (4/20)*: Code includes Rails 6 app and Twilio Studio Flow exports. Setup instructions in `README`.
{% github https://github.com/willcheung/textbot-rails no-readme %}

## How I built it
My current stack:
* Twilio SMS API
* Twilio Studio Flow + API
* Rails 6
* Postgres 12

I had planned to use AWS Lambda instead of Rails, but struggled to get Ruby running on Lambda and talking to RDS. Having built my last startup in Rails, I'm able to get a Rails app running 100x faster than Lambda :). Also, I get flexibility to create a UI if needed.

## Additional Resources/Info
*Edit (4/14)*:
I ran into a few limitations (features?) with Studio Flow. 
* Studio Flow only allows one flow tied to one (to many) phone number(s). This means I cannot "modularize" and create multiple flows based on trigger keywords. For example, I'd like "Add" to trigger one flow, and "Remove" to trigger another.
* I also discovered the value of [Send & Wait for Reply](https://www.twilio.com/docs/studio/widget-library/send-wait-reply) widget in Studio. While I attempted to ditch Studio altogether, I thought ~~it was quite a bit of work to build capabilities that saves a state of a request and wait for x hours to pick up the workflow.~~ *Edit (4/23): Pro tip: State can be maintained by using [cookies](https://www.twilio.com/blog/2014/07/the-definitive-guide-to-sms-conversation-tracking.html)!*
* Because of the first limitation, I either have to build a single Flow that has 5+ branches (more when I want to expand on trigger keywords), or I have to handle the trigger keywords parsing myself. Good thing is that I can trigger a Flow via REST API, so I went with handling my own keyword-trigger management.

*Edit (4/18):* Just posted a [second post](https://dev.to/willcheung/twilio-hackathon-todo-list-textbot-user-flow-with-studio-flow-4188) with more details on managing Flows.