sms-sentiment
This web application allows you to visualize in real-time SMS messages sent to a Twilio phone number along with their sentiment analysis provided by the Marchex Sentiment Analysis plugin.
It uses Node.js with Express for the web server, Ngrok to expose our local server publicly, Fanout Cloud for the real-time functionality, and isomorphic React for the view.
You can follow the tutorial to build this application or jump straight to the code.
Requirements
- Twilio number with SMS capabilities and the Marchex Sentiment Analysis plugin
- Fanout Cloud account
- Node.js
- Ngrok (optionally, if you want to expose your local server to the Internet)
Installation
- Clone this repository and
cd
into it. - Edit the
config.js
file to enter your Fanout realm information. - Optionally, in this file, you can change the flag to validate requests from Twilio.
- If you do this, you need to set your auth token as the environment variable
TWILIO_AUTH_TOKEN
(for example, on Linux executeexport TWILIO_AUTH_TOKEN=xxx0xxx00xx0xxxxxxx0xxxx0xxxx00xxx0
).
- If you do this, you need to set your auth token as the environment variable
- Configure a Messaging Webhook in your Twilio number to point to
http://<SERVER:PORT>/sms
usingHTTP POST
(if your trying the app locally, use Ngrok to get a public URL). - Install the Marchex Sentiment Analysis plugin and active it for incoming SMS messages.
- Execute
npm install
to download dependencies. - Execute
npm start
to start the app. - Go to
http://localhost:3000
(orhttp://<NGROK_URL>:3000
or whatever your URL is) and start sending SMS messages to your Twilio number.
License
MIT