DEV Community

Cover image for Notifications for free developer swag 🎉
Caleb Lemoine
Caleb Lemoine

Posted on • Edited on

Notifications for free developer swag 🎉

Backstory

I love building things and recently placed as a runner up in the digitalocean hackathon and am pretty stoked to be getting moar hoodies! After my subtle brag about getting all the swag, a friend of mine then told me "why don't you make an app to automate getting more hoodies?".

alt text

What a fantastic idea.

What I built

I originally had a reddit bot written in node.js and thought "I have so many uses for bots, I don't want to deploy a new one for each idea. That would be a pain."

alt text

For my use case, I went against the whole microservices trend and kept all the scheduling and configuration for my three bots inside one long running process called all-the-things-bot.

For the sake of staying on topic, you can browse the source here.

Free Dev Shit Bot

A bot that notifies you of potential opportunities for free dev shit also called "swag". Because we always need more laptop stickers, shirts, and hoodies!

After refactoring my app to support multiple bots, schedules, and configs. I implemented the "Free Dev Shit Bot". The bot is available on two platforms at the time of this writing.

Twitter

Simply follow the bot for updates!

Discord

Create a channel called swag in your discord server and add the bot to your server. The bot will check daily for free swag opportunities and notify you in the channel!

What it does

The bot will scan dev.to for the terms "free swag" and will tweet the article with a link and post to swag channels on all subscribed discord servers.

How it works

At the start of the application, all bots are initialized and scheduled with node-schedule. The Free Dev Shit bot is scheduled to post to twitter and discord servers at 11:55 PM CST. The logic behind the scenes searches the dev.to feed_content API by filtering the last 60 articles which is ordered newest. The bot then processes those 60 and finds any that are less than 24 hours old and has more than 1 public reaction(for credibility). If we have any results, simply post to all the things. The dev.to API is definitely the MVP here! 🥇

Resources

Top comments (0)