Use Twilio to accept SMS messages and turn them into queries against a database. This example functions as an Employee Directory where a mobile phone user can send a text message with a partial string of a person's name and it will return their picture and contact information (e-mail address and phone number).
This project is build using Express web framework and depends on MongoDB.
-
First clone this repository and
cd
into it.$ git clone [email protected]:TwilioDevEd/employee-directory-node.git $ cd employee-directory-node
-
Install the dependencies
$ npm install
-
Make sure the tests succeed.
$ npm test
-
Seed the database.
$ npm run seed
-
Start the server.
$ npm start
-
Check it out at http://localhost:3000.
- Expose your application to the wider internet using ngrok. You can click here for more details. 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
- 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 SMS & MMS Request URL should look something like this:
http://<sub-domain>.ngrok.io/directory/search
-
Text your twilio number the name "Thor".
-
Should get the following response:
We found multiple people, reply with: 1 for Thor 2 for Frog Thor 3 for Thor Girl Or start over
-
Reply with 1.
-
Should get the following response:
Thor +14155559999 [email protected] [the image goes here]
## Meta
* No warranty expressed or implied. Software is as is. Diggity.
* [MIT License](http://www.opensource.org/licenses/mit-license.html)
* Lovingly crafted by Twilio Developer Education.