Home / Companies / Twilio / Blog / Post Details
Content Deep Dive

Record Bad Customer Service Calls in 30 Lines of Ruby

Blog post from Twilio

Post Details
Company
Date Published
Author
Greg Baugues
Word Count
1,364
Language
English
Hacker News Points
-
Summary

This article describes a Ruby-based solution to record phone calls made to a Twilio phone number and send the recording as an SMS to the caller's phone number. The code uses Sinatra, a lightweight web framework, and the Twilio Ruby gem to interact with Twilio's REST API. By setting up a local development machine with ngrok, a publicly accessible URL can be created for the recorded call. When a call is made to the Twilio number, it triggers a POST request to the `/call` route, which generates TwiML and starts recording the call. After the call is finished, the `after-record` callback is triggered, which sends an SMS with a link to the recorded call using Twilio's REST API. The code was built using only 30 lines of Ruby, making it a concise solution for consumer protection against bad customer service.