Logo
22ndjan API Documentation

Slack Weather Bot

Number of APIs: 3


This collection acts as a weather bot for you which posts the current weather to a specified Slack channel.

Setup:

For the setup, you will need three things.

  1. Google Maps API Key: You can generate an API Key using this link
  2. DarkSky API Key: The DarkSky API returns weather conditions based on a particular latitude and longitude. You would be needing an API Key to use it. Head to DarkSky Dev and register for a free account and generate an API Key.
  3. Slack Webhook URL: Slack allows you to generate incoming webhooks for your team using which you can send a message to a specific channel or user. Go to Slack to learn more about how you can generate one.

Once you have all these three, you can add them to the attached environment and your collection is ready for use.

A sample weather report on Slack would look something like this.

Example


1. Get Latitude and Longitude

GET https://maps.googleapis.com/maps/api/geocode/json?address={{location}}&key={{GeocodingAPIKey}}

This request calls the Google Maps API to fetch the coordinates (latitude and longitude) of the specified place.



2. Get Weather

GET https://api.darksky.net/forecast/{{ForecastAPIKey}}/{{latLong}}



3. Send weather to Slack

POST {{slackWebhookUrl}}



ENDPOINTS