DEV Community

Schuster Braun for Vets Who Code

Posted on

Daily message Slack bot

I built a bot that posts for daily code challenges in a VetsWhoCode (VWC) Slack channel.

The first iteration of it was using Slack's workflow builder. I just made a slew of scheduled messages. Each message was a different day. So, when all the messages were posted, I needed to go back in and reschedule with what the new date was. After doing this a few times I felt like it was time for a change.

Image description

The next iteration is a super simple Node.js AWS Lambda connected to a daily event bridge trigger. The Lambda sends an authenticated POST request to our Slack app's web hook.

Image description

The code reads a markdown file of code challenges delimited by ---. It then divides the number of days in a year by the challenge array length. That way it will post a challenge every day.

Future work that could be done with it is:

  • Build a Challenge explorer/editor
  • Update the bot so it could work in multiple channels so you can have different kinds of languages
  • Setup Continuous Deployment. I currently just log in to the AWS account and manually update the challenges/code.

In the end, it's as simple as I could think to make it. I like to build that way, with room to expand.

Top comments (0)