The itenium Slack Meme Bot® : Implementation
How was the Slack Meme Bot implemented?

How does the Slack Meme Bot work, technically?

Category:

javascript

Tags:

funproduct

Share this article on:

the slack meme bot

docker-compose

The docker-compose exists of two services

File Server

halverneus/static-file-server makes the memes accessible from the internet.
The Slack WebHook sends just the url of the meme, after which Slack attempts to download the image before actually posting it.

If Slack cannot download the image, nothing will show up in your Slack channel.

You will probably need to configure the meme file accessibility.

chmod -R 755 memes_dir

Cron Job

The Dockerfile copies the job folder with the Node program to the docker container and then runs start.sh which schedules running meme-poster.js and starts the Cron daemon.

Slack Meme Poster

The meme-poster.js selects a random file from your MEMES_DIR and moves it to a already-sent subfolder to make sure no meme is ever posted twice.

It then sends the meme url to Slack using the WebHook and 🎉, meme posted!

Make it your own

Configure the actual Slack message

  • messageToPostWithMeme: A simple string sent along with the meme
  • Configure the entire Slack message using the Slack Block Kit Builder

Also in this series