The Relicans

Cover image for Weather Bot
Victor Castro
Victor Castro

Posted on

Weather Bot

What I built

A chatbot was developed to show weather information about a specific region during a stream. Showing this data both in chat and on screen.

Category Submission:

New Year, New Resources

App Link.

The app can be run only local because it uses OBS overalay to show weather information. Alert, the repository is Source Code Link




The application is a chatbot for a twitch that aims to interact the chat with the bot to display climate information for a particular city in the world. The application was built using nodejs on the backend and HTML5, CSS3, Javascript, and WebSocket on the front end.

The bot uses a Mapbox API to search for the coordinates of a city informed by the user and also uses an AccuWeather API to get the city's climate information informed. With the data of these APIs, it is reserved for viewers as climatic information in the broadcast chat and also in the broadcast overlay.

During a stream on the twitch there can be dozens, hundreds or even levels of people interacting with the bot, and, consequently, the bot can suffer from performance problems.

In this way, a new relic platform has been integrated into the bot to monitor its performance. The new relic platform makes it possible to create a panel that allows viewing the number of requests per second that the bot receives, the total processing time for each request and the time spent for each external API call, and also the time spent for displaying the requests. chat information and without the overlay.

Installing and running locally

Clone the project, and create a file named .env, with some credentials, being:

BOT_NAME= Name of your Twitch bot
CHANNEL_NAME= Name of your Twitch channel
TOKEN= Your Twitch Token

MAPBOX_TOKEN= Your Mapbox Token
WEATHER_TOKEN= Your Accuweather Token

UNIT= Your temperature unit, like F (Fahrenheit) or C (Celsius)
LANGUAGE_WEATHER= The language of Weather, like en or pt
Enter fullscreen mode Exit fullscreen mode

After this, create a project in New Relic get the file newrelic.js, and put in the same folder of index.js, and WeatherBot will be connected to New Relic.

Now, you need to run npm install to install all dependencies, and npm start to start the bot! After starting the bot, acess http://localhost:3000 in your OBS (Using a OBS Browser Overlay), and the data will be shown on the screen.

During the stream, a viewer can type !weather <city_name> in the twitch chat and the bot will get the climatic information from the specified city and will show it on the screen and in the chat too.

Link to Source Code

Source Code Link

Permissive License

The project are under the MIT License.


On several occasions in the twitch, we see that the subject is little debated and that several people are not aware of the climatic difference between cities and countries.

The goal of weather bot for twitch is to democratize access to climate information in cities when the topic is being addressed in a live twitch.

How I built it

I build it with NodeJS and I used New Relic to see the time of each request, the use of memory/cpu, and the time what the bot is running. This is very good to know if the code is slow or fast, consuming much memory,etc.

New relic data 1
New relic data 2

Additional Resources/Info

View the application screen cast

Discussion (0)