Afterhours Bot is a small Slack bot written in Node.js in June 2017. It reads the messages in the channels it’s in and does three things:
- Reacts to moods. “Happy”, “happier” or “excited” gets a
:smile:reaction, “sad”, “upset” or “unhappy” gets:disappointed:, and “home” or “remote” gets:house_with_garden:. - Answers weather questions. A message with the word “weather” and a five-digit ZIP code gets a reply like “The weather in Chicago, IL right now, is clear and 40 degrees.”
- Welcomes people. When someone joins a channel, the bot posts “Welcome” and their name.
The weather replies came from Yahoo’s YQL, which Yahoo has since shut down, so that part can’t work anymore. The code hasn’t changed since 2017.

weather.forecast table for that place.Saying goodbye
The repository’s one outside contribution is a pull request from jdungan, merged in September 2017. It adds the opposite of the welcome: when someone leaves a channel, the bot posts “Hey @everyone” with their name and “just left”.

How it’s built
It’s ES2015 JavaScript with stage-0 features, compiled by Babel 6 into dist/ when the package installs. The slackbots library connects to Slack’s real-time messaging API, loads the channel and user lists at startup, and posts the replies. Reactions go to Slack’s reactions.add method through node-fetch, and the weather query goes through the yql package. Both parsers split the message on spaces and compare whole words, so “happy,” with a comma doesn’t match.
auto-slack, started five days later, reuses the same EmojiParser structure and request helper for a bot that reacts in a single channel.
The creation date shown here is the GitHub repository’s UTC creation date. The terminal capture comes from running the repository’s compiled code locally on Node 8 with sample events and stubs in place of Slack and YQL, and the code cards are rendered from its source.