Trash Tracker is a simple, lightweight system that allows residents and staff of the Lykins neighborhood to report illegal dumping with a simple text message. This app is one of its three repositories. It performs the function of recording the reporting messages.
- Install Node
-
Install dependencies
npm install -g yarn && \ yarn install
-
Copy the sample configuration file and edit it to match your configuration
$ cp .env.EXAMPLE .env
You can find your
TWILIO_ACCOUNT_SID
andTWILIO_AUTH_TOKEN
in your Twilio Account Settings.
To run the application, enter:
```bash
$ node ./controllers/flow.js
```
Any users can send a text message to our Twilio phone number (816) 608-6096 and start the conversation! The following photo shows an example:
After the conversation is complete, you can go to http://localhost:1337/ to see the reporting information.
You will need a webhook url on the public Internet. To do that, you need to install ngrok to expose your local network to the public Internet. After you install it and configure the authentification, open a second terminal and enter the following command:
$ ngrok http 1337
Once you acquire a forwarding url from ngrok, copy and paste it in http_request_english and http_request_spanish widgets in your Twilio Studio flow. You will need to update the url everytime you run that script. The below photo shows an example.
If you want to design your own app without using Twilio flow, here are some resources:
-
To initiate or send a custom message, enter:
$ node ./controllers/mms-send.js
-
To fetch a message sent to your Twilio number, enter:
$ node ./controllers/mms-fetch.js
-
To set up an auto-generated reply to messages sent to your Twilio number, enter:
$ node ./controllers/sms.js
-
To send an image to your webhook url, enter the following command and go to http://localhost:1337/ to see the images received.
$ yarn start
Twilio documentations have been tremendous help for this project, especially the ones on Programmable SMS and on Twilio Studio. The 4th usage of "other usages" of this repository uses almost all code from the Twilio repository receive-mms-node.