How to use Twilio to receive text messages from users and reply to this text with a message?

1.) The user sends a text message to the specified Twilio phone number 2.) The application receives this message and analyzes it for valid data 3.) The application replies to the sender with a text message that delivers the requested information.

How do I do this with rails ?!

+4
source share
1 answer

Assuming your business logic doesn’t take much time, just process the text and send a response. Here are the main steps:

  • Take the twilio-ruby helper library.
  • Point your SMS URL to the Rails controller / action you want to call
  • Process the incoming request and execute your business logic
  • Instead of returning HTML, return TwiML

Here is a link to a simple application that does just that:

https://github.com/crabasa/twilio-rails-demo

Update: I wrote two detailed blog posts about integrating Twilio into a Rails 4.x application: Part 1 and Part 2 .

+12
source

All Articles