Skip to content

A small Sinatra application to demonstrate receiving, saving, and replying with media to incoming WhatsApp media messages using Ruby

License

Notifications You must be signed in to change notification settings

TwilioDevEd/whatsapp-media-tutorial-sinatra

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Twilio

Receive, Download, and Reply with media in WhatsApp Messages. Powered by Twilio - Ruby

Use Twilio to receive WhatsApp media messages. For a step-by-step tutorial see the Twilio docs.

Build Status

Local development

This project is built using the Sinatra web framework.

  1. First clone this repository and cd into it

    $ git clone [email protected]:TwilioDevEd/whatsapp-media-tutorial-sinatra.git
    $ cd whatsapp-media-tutorial-sinatra
  2. Install the dependencies

    $ bundle install
  3. Run the server

    $ ruby app.rb
  4. 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 -host-header=localhost 4567

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

  5. Configure Twilio's Sandbox for WhatsApp to call your webhook URL

    You will need to configure your Twilio Sandbox for WhatsApp to call your application (exposed via ngrok) when your Sandbox number receives an incoming message. Your URL will look something like this:

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

    Here are detailed instructions for Twilio Sandbox for WhatsApp

How to Demo

  1. Send a message with a media attachment to your WhatsApp Sandbox phone number

  2. Your Ruby application should display the incoming request from Twilio. In a few moments, you should get back a WhatsApp reply featuring a "good boy."

Run the Tests

rspec

Meta

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

About

A small Sinatra application to demonstrate receiving, saving, and replying with media to incoming WhatsApp media messages using Ruby

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages