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

A Simple Way to Receive an SMS with Ruby, Sinatra, and Twilio

Blog post from Twilio

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

This tutorial provides a simple way to receive an SMS message using Ruby, Sinatra, and Twilio. To start, install Sinatra and create a file called `app.rb`, which requires Sinatra and defines a route `/message` that accepts a POST request with details about the inbound SMS. The code then parses the parameters, extracts the sender's number and the message body, and sends a response using TwiML XML tags. The app needs to be deployed to a publicly accessible URL or accessed via ngrok to receive incoming SMS requests from Twilio. Once set up, users can send an SMS to their new phone number and see a customized response with the sender's number and message body.