To escape the boredom of being stuck at home for months now thanks to the pandemic (insert rant about how I'm so privileged for saying I'm bored in the middle of a crisis), I started thinking of things I needed at work, and possibly incorporate into everyday life.

I found myself looking into ways on how I could get real-time notifications for services and servers I use and manage. A few of these come to mind, but ultimately got rejected:

  • Slack - you need a Slack channel, and I can't put personal stuff at work. Not to mention the Slack client is heavy for who knows why.
  • Telegram - close, but not every service supports it directly.
  • Emails - messages get lost in transit because Microsoft feels like they're the gods of the email world. Can't get spam if messages aren't received, amirite?

Then, there's Pushbullet, which only mirrors notifications (if they do support actual notification serving, I wasted an afternoon) and Pushover that costs $5/device. Being the cheapskate that I am, I decided to write my own.

Thus, Project Mercury was born.

What kind of a name is Mercury?

I picked Mercury because it's the name of the Roman god of messages and communications and serves as the bridge between the upper and lower worlds.

How does it work?

Basically, it's a mix of Telegram and Slack. You can find Slack integrations almost anywhere, and Telegram's feature set allows me to use it with confidence knowing that my data is my own.

You take a Slack payload, send it to Project Mercury, which acts as a service abstraction layer, which then forwards the request to the Telegram bot for your perusal. Project Mercury accepts the following JSON request body:

{
	"text": "Hello, world!"
}

For performance reasons, this app is written in Lumen with only Guzzle as a dependency (obviously excluding the dependencies of Lumen itself). I needed something that would notify me as fast as possible and doing this with Laravel would probably not be a good idea.

The server it's running on is on nginx with php-fpm 7.4 to take advantage of better process management.

I want to try it out!

Head over to Telegram and search for the @ProjectMercuryBot (or click here). Press Start to register your account. Once you're registered, Mercury will send a unique webhook URL back to you, which you can then use on various services. Simple.

The start screen for Project Mercury.

If I send it a command, like /start (which what clicking the "Start" button does), it will register your username and give you back a private webhook URL for integration:

What you'll get when your registration was successful.

Of course, the URL in the screenshot is now revoked and I generated a new one for myself. To do that, simply send /revoke to delete your existing URL (all notifications sent to your old URL will no longer work), then generate a new one by sending /start.

Revoking and generating new URLs are easy.

Actual Use

Right now, I'm slowly integrating all the services I use to it. Right now, it's linked to some projects in GitLab for work, and Uptime Robot to let me know if a server I manage is having problems:

It's free, so try it out for yourself. You can set it up on services that support the Slack webhooks notification format. For instance, on GitLab:

The URL here is also revoked, so don't even try. 😂

It also works with Uptime Robot (which already has Telegram support but whatever):

If you're concerned about privacy and think I'm gonna abuse your data, just know that I don't care about you enough to do so. Either way, you can self-host this yourself. The source code is on GitHub. Pardon the messy code, this was a "spur of the moment" project and some things may be done differently.