Skip to content

Bot for creating Tweets with weather information for a given location

Notifications You must be signed in to change notification settings

padualima/bot-owm-api

Repository files navigation

BOT-OWM

Build Status

Authenticate your account do Twitter and create Tweets with weather information for a particular region provided by OpenWeatherMap.

Getting Started!

Premises

Twitter Authentication Settings

In the twitter authentication settings, remember to configure the callback route as in the example below: Captura de Tela 2023-02-16 às 12 48 14

Configure the Envs

Inside the project directory:

Copy the .env to configure with database credentials and your Twitter and OpenWeatherMap API keys:

cp .env.sample .env

Docker (recommended)

Make sure you have Docker and Docker-Compose installed on your machine!

But, if you haven't installed it yet, I recommend the links below for installation using Ubuntu 20.04:

Run to build the docker image and install dependences:

make build

Now, whenever you want to go up to the API, run the command:

make up

If you want to run the tests:

make run_tests

Depending on the OS, there may be difficulties in executing the commands, if it happens, check the desired tag in the Makefile file and execute it manually!

Who to use

Then go up Application, now with the request below authenticate your twitter account:

GET /authorize
curl --location 'http://localhost:3000/authorize' \
--header 'Accept: application/vnd.owm-bot-api.v1'

With the token in hand, create Tweets based on weather information for a given region, passing latitude and longitude or region name as parameters:

POST /tweets
curl --location 'http://localhost:3000/tweets?token=YOUR_TOKEN' \
--header 'Accept: application/vnd.owm-bot-api.v1' \
--header 'Content-Type: application/json' \
--data '{
    "location": {
        "lat": -5.09
        "lon": -42.80
        // "name": "City Name"
    }
}'

Or if you prefer, access the Swagger UI with http://localhost:3000/api-docs and make the requests Captura de Tela 2023-02-20 às 13 21 35

License

MIT

Free Software, Hell Yeah!

About

Bot for creating Tweets with weather information for a given location

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages