Inspired by Marty’s post about receiving alerts from his website in his matrix chat, I got inspired to do the same for my site, only with Slack. I’ve been working on building Slack automation at my job this week, and I have a Slack group for my family (it’s barely ever used). So it was perfect timing to read Marty’s post and to sit down and build out a quick Slack integration for my site.
Here’s what it looks like:
Unlike how Marty made a standalone script that is more bot like, I built the feature directly into my existing website. I have webmention.io sending it’s webmention alerts directly to a secret url on my site along with a secret token. If the token doesn’t match up, my site will ignore the request. If it does match up, it will do some custom formatting and send the alert to Slack. The thing I’m really excited about is that means my website now receives every webmention as they happen. That means over time I can add more functionality and at some point, instead of fetching all of my webmentions every time I rebuild my site, I can start to just store each webmention in a folder with the individual posts that they are connected to. That will save a lot of processing power and time in things like site rebuilds, etc.
The other thing is now that my site is connected to Slack, in the future, I can do other integrations.