Skip to content

cityscreen/Smart-TV-Leads

 
 

Repository files navigation

Twilio

Instant Lead Alerts for Node.js and Express

This demo application shows how to implement instant lead alerts using Node.js and Express. 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!

Local development

To run this project on your computer, you will need to download and install either Node.js or io.js, both of which should also install npm. You will also need to sign up for a Twilio account if you don't have one already.

  1. First clone this repository and cd into it.

    $ git clone git@github.com:TwilioDevEd/lead-alerts-node.git
    $ cd lead-alerts-node
  2. Next, open .env at the root of the project and update it with values from your Twilio account and local configuration. You'll need to set TWILIO_AUTH_TOKEN, TWILIO_ACCOUNT_SID, and TWILIO_NUMBER.

For the TWILIO_NUMBER variable you'll need to provision a new number in the Manage Numbers page under your account.

The AGENT_NUMBER 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.

The phone numbers should be in E.164 format.

Run source .env to export the environment variables.

  1. Navigate to the project directory in your terminal and run:
$ npm install

This should install all of our project dependencies from npm into a local node_modules folder.

  1. To launch the application, you can use node . in the project's root directory. You might also consider using nodemon for this. It works just like the node command, but automatically restarts your application when you change any source code files.
$ npm install -g nodemon
$ nodemon .

Docker local development

  1. Install Docker and docker-compose.

  2. Make sure you performed step 2 on the previous section.

  3. Copy the template .env file and set the required environment variables.You can find these values at https://www.twilio.com/user/account/voice and at https://dashboard.authy.com.

    cp .env.example .env
  4. Load the variables in your session:

    source .env
  5. Finally, run the following commands to start your Docker containers:

$ docker-compose up -d

Warning: If you previously ran npm install locally, the node_modules folder will conflict with the file structure of the container when you run the above command. We recommended installing your node dependencies one folder up from the rest of your source code.

  1. You can then visit the application at http://localhost:3000/. If you're using boot2docker to run Docker on OS X, you'll need to use the value of boot2docker ip instead of localhost.

  2. To stop your containers, run docker-compose stop.

You can then visit the application at http://localhost:3000/.

Meta

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

About

Instant lead alerts example using Node.js and Express

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • HTML 84.7%
  • JavaScript 14.3%
  • Other 1.0%