This is a very simple integration which makes use of the free OpenWeatherMap.org API to retrieve current weather data.
- You need an API-Key from OpenWeatherMap.org, sign up here and create as many keys as you want.
- Go to 'Integrations' in your Rocket.Chat-Admin-Panel and create a new 'Outgoing Webhook'
- Select 'Message sent' as trigger and specify keyword(s), e.g.
!weather
- Enter
all_public_channels,all_private_groups,all_direct_messages
as 'Channel' to make it work everywhere - Insert
https://api.openweathermap.org/data/2.5/weather
as 'URL' - Insert your API Key as 'Token'
- Copy&Paste the above JavaScript-File into the 'Script' field
- Set Integration and Script to enabled
- Save changes!
- If anyone sends
!weather <city>
the rocket.cat should respond with the current weather conditions in that particular city (if it exists to OWMs databases). - Feel free to modify the Code to your needs. You may find it useful to tweak things like the default city, locale settings, the presentation or the weather data used.
Refer to https://openweathermap.org/current for further information on how to use the API. Have Fun!