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.
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.
Implementations in other languages:
.NET | Java | Python | PHP | Ruby |
---|---|---|---|---|
Done | Done | Done | Done | Done |
- Nodejs v10 or v12
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 / 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 |
-
First clone this repository and
cd
into it.git clone [email protected]:TwilioDevEd/lead-alerts-node.git cd lead-alerts-node
-
Install the dependencies.
npm install
See Twilio Account Settings to locate the necessary environment variables. The phone numbers should be in E.164 format.
-
Copy the sample configuration file and edit it to match your configuration.
cp .env.example .env
-
Start the server, will run on port 3000.
npm start
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 .
-
Navigate to http://localhost:3000
That's it!
If you have Docker already installed on your machine, you can use our docker-compose.yml
to setup your project.
- Make sure you have the project cloned.
- Setup the
.env
file as outlined in the Local Development steps. - Run
docker-compose up
.
To execute tests, run the following command in the project directory:
npm test
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 |
- The CodeExchange repository can be found here.
This template is open source and welcomes contributions. All contributions are subject to our Code of Conduct.
No warranty expressed or implied. Software is as is.