Inspiration

What it does

Randomly generates poem to be played back on call receiving event.

How I built it

I used Twilio's functions API to request a list of assets and randomly generated a song to play. The serverless environment provided through Functions made it very easy for my use case, which was completely client-facing.

Challenges I ran into

  1. Finding solutions that worked within Twilio's asset constraints. Twilio's Runtimes API has in-built functions that can generate all private assets. However, with private assets there are limits to file size and #, which forced me to work with public assets -- requiring Twilio's API for Node.js HTTP requests.
  2. Dealing with nested API requests: Since js is a single threaded language, I had to work with promises to ensure all requisite data was being fetched before the callback is returned and the song is played. What was even more difficult though was that my REST structure was nested: for each Twilio asset, I had to gather a list of service ids to generate the path for the poem to be played. Accommodating to this style made the problem of ensuring synchronous calls difficult.

Accomplishments that I'm proud of

Discovering one of the cooler components of Twilio's API on a smaller scale project!

What I learned

What's next for Dial-A-Poem

Built With

Share this project:

Updates