Won’t you be my Pal? (Twilio Hackathon)
Tags: twiliohackathon
Published: 2020-04-28 04:34:55

---
title: Won’t you be my Pal? (Twilio Hackathon)
published: true
description: A fun Twilio x DEV Hackathon project.
tags: twiliohackathon
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/7r4hl23p8d8zu9dyqbpm.png
---

In the never-ending pursuit to **A**lways **B**e **C**Leveling up my coding skills I’ve recently been going through some Udemy courses to learn a few new tech-niques (get it?). So when I saw that Twilio and DEV were putting on a hackathon I thought it would be the perfect opportunity to bust out my new skills to build something fun and maybe even a little helpful.

Believe it or not I actually spent the first half of the month working on a [completely different idea](https://docs.google.com/document/d/1gyn8aTXNW9jIO07wR8h-wpKvzf5QB1NQED_K_G6ZZOo/edit?usp=sharing) for a service that would allow you to set up a nearby contact (like a neighbour) to check in on you if you contracted an illness like COVID-19. After a couple weeks I decided it was a little too involved for such a short development window, so I scrapped the idea and went for something a little simpler.

Not all was lost, though, because I was able to move a lot of foundational setup and code to this new idea. So here we are…

## What I built

> **Pals**: A simple SMS service that allows you to chat with a random person anonymously.

#### Category Submission: 

COVID-19 Communications

#### Why did I build it?

When I was in elementary school I had the opportunity to have a pen pal. Actually it was an email pal. But the Power Macintosh G3 wasn’t the fastest and dial-up internet was slow enough that it might as well have been a proper pen pal. Anyway, I remember always looking forward to learning more about my new friend on the other side of the planet. So I figured in these crazy times, in this world where we’re isolated in our homes, maybe we could all use a pal of our own.

#### What does it do?

It’s simple, really. You just send a text to the service’s phone number. From there it’ll ask you for a name that you want to go by, and then you’ll be paired with someone else: your new Pal.

Once you’re connected any message you send will go directly to your Pal. Except one: text `> MENU` to access commands that you can use to disconnect and more.

That’s pretty much it. It’s not meant to be complicated, no fancy UI or drawn-out signup process. The beauty in it is that it’s connecting you to someone you would likely never get to learn about otherwise, while at the same time keeping the participants’ phone numbers private.

## How I built it

As I mentioned above I was using this hackathon as an opportunity to play around with some stuff I’d be learning on Udemy. I’m currently enrolled in [TypeScript course](https://www.udemy.com/course/understanding-typescript/) and I recently finished a [Serverless course](https://www.udemy.com/course/aws-lambda-serverless/). So with that in mind, here’s a breakdown of the stack:

- Twilio’s [Programmable SMS](https://www.twilio.com/sms) to deliver messages
- [Serverless AWS](https://serverless.com/framework/docs/providers/aws/cli-reference/) to provision most things and deploy code
    - This included setting up the IAM Role statement, setting up VPC configuration, and employing both API Gateway and CloudWatch Events.
- [AWS Lambda](https://aws.amazon.com/lambda/) functions written in Node.js
- MySQL database ([AWS RDS Aurora](https://aws.amazon.com/rds/aurora/serverless/))
- [Sequelize](https://sequelize.org/) for the ORM
- TypeScript on all the things (or at least I tried… sort of)

I guess I should also note this was my first time using Sequelize as well. New things all around! Don’t you dare critique my code! 😁

There’s plenty that [could still be done](https://github.com/jodyheavener/pals#to-do) to make it shine, but I wanted to get an MVP in before the deadline.

Finally, I recognize that this probably isn’t a very sustainable model, considering you’re essentially proxying messages between two people. But hey, it was fun to make.

## Demo

~~All you need to do is send a text to ███-███-████ and follow the prompts.~~

_Uhhh…_

Ok, I had this whole post planned and was all excited for everyone to start texting in to meet their new Pals. Everything works as expected when developing and testing locally, but for reasons I am still unsure of I can’t get anything to happen when I [execute](https://github.com/jodyheavener/pals/blob/master/library/functions/test.ts) the Twilio client’s create message function. I’ve spent hours trying to debug. At this point I think it has to do with my VPC/Subnet configuration, but I don’t know enough about it to figure it out just yet. After all, this is my first shot at a Serverless stack. 🙃

If I can figure it out before the deadline, great. If not and it disqualifies the submission, no big deal, I'm still proud of it. Check out the source below if you want to set it up locally and try it for yourself; maybe you'll have better luck than me.

## Link to Code

Full source is available on GitHub at [jodyheavener/pals](https://github.com/jodyheavener/pals).

---

This was a fun project. I really enjoyed applying some new Serverless knowledge, and at least a little bit of TypeScript. I’d love to hear what you think; what could be added to make Pals even better?