Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

TwilioDevEd/lead-alerts-rails

Repository files navigation

Twilio

Instant Lead Alerts for Ruby on Rails

This template is part of Twilio CodeExchange. If you encounter any issues with this code, please open an issue at github.com/twilio-labs/code-exchange/issues.

About

This demo application shows how to implement instant lead alerts using Ruby on Rails. Notify sales reps or agents right away when a new lead comes in for a real estate listing or other high value channel.

Read the full tutorial here!

Implementations in other languages:

.NET Java Python PHP Node
Done Done Done Done Done

Set up

Requirements

Twilio Account Settings

This application should give you a ready-made starting point for writing your own application. Before we begin, we need to collect all the config values we need to run the application:

Config Value Description
TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN You could find them in your Twilio Account Settings
TWILIO_NUMBER You may find it here
AGENT_NUMBER This variable represents the number alerts will be sent to. Please make sure you have allowed SMS to be sent to the Country this number belongs to on the Global SMS Permissions page. Also, if you are on a trial account, make sure you have verified this number on the Verified Callers IDs page

Local Development

  1. First clone this repository and cd into it.

    git clone git@github.com:TwilioDevEd/lead-alerts-rails.git
    cd lead-alerts-rails
  2. Install the dependencies.

    make install
  3. Copy the sample configuration file and edit it to match your configuration.

    cp .env.example .env

    See Twilio Account Settings to locate the necessary environment variables. The phone numbers should be in E.164 format.

  4. Setup server

    make serve-setup
  5. Start the server.

    make serve
  6. Navigate to http://localhost:3000

That's it!

Docker

If you have Docker already installed on your machine, you can use our docker-compose.yml to setup your project.

  1. Make sure you have the project cloned.
  2. Setup the .env file as outlined in the Local Development steps.
  3. Run docker-compose up.

Tests

You can run the tests locally by typing:

bundle exec rspec

Cloud deployment

Additionally to trying out this application locally, you can deploy it to a variety of host services. Here is a small selection of them.

Please be aware that some of these might charge you for the usage or might make the source code for this application visible to the public. When in doubt research the respective hosting service first.

Service
Heroku Deploy

Resources

  • The CodeExchange repository can be found here.

Contributing

This template is open source and welcomes contributions. All contributions are subject to our Code of Conduct.

License

MIT

Disclaimer

No warranty expressed or implied. Software is as is.