Giter Site home page Giter Site logo

covid-news's Introduction

Covid Update - Twilio Hackathon Submission

About

This application is a submission for the Twilio Hackathon on DEV. Covid News leverages the twilio api to send out daily SMS messages to the individuals that have subscribed. Included in the text message would be state statistics for total case, positive and negative counts, and number of deaths. Along with the state statistics will be the latest 5 national news headlines to jumpstart the morning.

How it works

This application is a barebones Node.js application using Express.js, Mongoose.js and Pug Templating for webpages. A cron job is setup to run at 8:00AM to get all the users in a MongoDb collection. It gathers the news and the stats based on the state from 2 different APIs then sends a text message to the user.

Features

  • Node.js web server using Express.js
  • Basic web user interface using Pug for templating and Bootstrap for UI
  • User interface to allow users to subscribe to the SMS message list
  • Project specific environment variables using .env file

How to use it

  1. Once the server is started, navigate to localhost:3000
  2. Input your phone number and state into the web form
  3. Text message should be received at 8:00am with the updated stats and news
  4. To unsubscribe, reply to the text message.

Set up

Requirements

Twilio Account Settings

Before we begin, we need to collect all the config values we need to run the application:

Config Value Description
Account Sid Your primary Twilio account identifier - find this in the Console.
Auth Token Used to authenticate - just like the above, you'll find this here.
Phone number A Twilio phone number in E.164 format - you can get one here

We also need to setup a webhook within Twilio to handle replies to texts so that it allows the users to unsubscribe from the SMS list through text. The webhook will need to be directed to /user/unsubscribe.

  • Follow the "Configure Your Webhook URL" section: Webhooks

Local development

After the above requirements have been met:

  1. Clone this repository and cd into it
git clone https://github.com/RozzaysRed/covid-news.git
cd covid-news
  1. Install dependencies
npm install
  1. Set your environment variables

Create .env file at the project's root directory and add the following variables.

Variable Name Description
TWILIO_ACCOUNT_SID Your primary Twilio account identifier - find this in the Console.
TWILIO_AUTH_TOKEN Used to authenticate - just like the above, you'll find this here.
TWILIO_PHONE_NUM A Twilio phone number in E.164 format - you can get one here
MONGODB_CONN_STRING Connection to your MongoDb instance

See Twilio Account Settings to locate the necessary environment variables.

  1. Run the application
npm start

Alternatively, you can use this command to start the server in development mode. It will reload whenever you change any files.

npm run watch:start
  1. Navigate to http://localhost:3000

That's it! |

Resources

Contributing

This project is open source and welcomes contributions.

Visit the project on GitHub

License

MIT

Disclaimer

No warranty expressed or implied. Software is as is.

covid-news's People

Contributors

rozzaysred avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.