Skip to content

arturjzapater/asteroid-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Asteroid App

About

Asteroid App is an automated WhatsApp account that provides information about the asteroids closest to Earth.

How it works

When someone sends a WhatsApp message to your Twilio phone number, Twilio sends the request to your API endpoint. The API then tries to parse the request. It makes sure they're asking for closest asteroids to earth and that they provide valid dates (or no dates, in which case today will be assumed). If the validation is successful, it'll make a request to NASA's NeoWs API and format and return the result as a WhatsApp message. Otherwise, it will fetch a random fact from Cat Facts API and send a WhatsApp message apologising for not being able to understand the user's request and offering a random cat fact as consolation.

Features

How to use it

  1. Create a copy using GitHub's repository template functionality
  2. Update the README.md and package.json with the respective values.

Set up

Requirements

Configuration

Asteroid App requires to configure environment variables related to NASA and the port on which the server is to listen for incoming requests. You should declare the following environment variables:

Key Description
NASA_API_KEY Your key to the NASA API. You can get one on their website
NASA_HOST It should have the following value: api.nasa.gov.
NASA_PATH It should have the following value: /neo/rest/v1/feed.
PORT The port on which you want your server to be available.

Local development

After the above requirements have been met:

  1. Clone this repository and cd into it
git clone git@github.com:SavagePixie/asteroid-app.git
cd asteroid-app
  1. Install dependencies
npm install
  1. Run the application in dev mode
npm run dev
  1. After you're happy with all your changes, deploy the application in your server and start node
npm start
  1. On your Twilio dashboard, configure your WhatsApp sandbox. To do so, after you've deployed your application, set the option WHEN A MESSAGE COMES IN in your WhatsApp sandbox to your server's url followed by /api (e.g. https://www.example.url.net/api)

Deployment

This project is set to be automatically deployed using Heroku. If you want to use any other means to deploy it, you can simply delete the .circleci folder.

License

MIT

Disclaimer

No warranty expressed or implied. Software is as is.

About

WhatsApp bot that finds close asteroids to Earth

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published