Skip to content

Process SMS and MMS messages received by the application using rails

License

Notifications You must be signed in to change notification settings

TwilioDevEd/receive-mms-rails

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Twilio

Receive MMS: Process MMS messages received by the application using rails

About

Use Twilio to receive SMS and MMS messages. For a step-by-step tutorial see the Twilio docs.

Note: protect your webhooks

Twilio supports HTTP Basic and Digest Authentication. Authentication allows you to password protect your TwiML URLs on your web server so that only you and Twilio can access them.

Learn more about HTTP authentication here, which includes sample code you can use to secure your web application by validating incoming Twilio requests.

Local development

This project is built using the Ruby on Rails web framework and NodeJS to serve assets through Webpack.

  1. First clone this repository and cd into it

    $ git clone [email protected]:TwilioDevEd/receive-mms-rails.git
    $ cd receive-mms-rails
  2. Install Rails dependencies

    $ bundle install
  3. Install Node dependencies

    $ npm install
  4. Copy the sample configuration file and edit it to match your configuration

    $ cp .env.example .env

    You can find your TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN in your Twilio Account Settings. You will also need a TWILIO_NUMBER, which you may find here.

  5. Create database and run migrations

    $ bundle exec rails db:setup
  6. Make sure the tests succeed

    $ bundle exec rspec
  7. Run the server

    $ bundle exec rails s
  8. Expose your application to the wider internet using ngrok. This step is important because the application won't work as expected if you run it through localhost.

    $ ngrok http 3000

    Once ngrok is running, open up your browser and go to your ngrok URL. It will look something like this: http://9a159ccf.ngrok.io

    You can read this blog post for more details on how to use ngrok.

  9. Configure Twilio to call your webhooks

    You will also need to configure Twilio to call your application when calls are received on your TWILIO_NUMBER. The voice url should look something like this:

    http://6b5f6b6d.ngrok.io/mms_resources
    

How to Demo

  1. Send an MMS to your twilio number

  2. Access http://localhost:3000. You should see a list with all the resources sent through your MMS

Meta

  • No warranty expressed or implied. Software is as is. Diggity.
  • MIT License
  • Lovingly crafted by Twilio Developer Education.

About

Process SMS and MMS messages received by the application using rails

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published