Ben Oliver

technology

How to use Gotify with Healthchecks.io

Get notified when your backups and recurring tasks fail.
08 September 2019

Healthchecks1 is a site that acts like a dead man’s switch. It does nothing if everything is OK, and tells you if it isn’t.

Say you have a backup that runs at 1000 on a Monday. Just after the backup completes successfully, you tell Healtchecks (by pinging a URL they give you). Healthchecks knows to expect the ping at that time, and if it doesn’t get it, it sends you a notification.

There are many ways to be notified. Email, SMS etc - here is how to set it up with Gotify.

One note, be sure to follow this guide closely - currently healthchecks makes you remove the integration and add a new one if you want to make corrections. It gets annoying quickly if you make a mistake!

Create an app in Gotify

As usual, go to your Gotify admin page and create an application for Healthchecks. Make sure to take note of the token it gives you.

Healthchecks

Create an integration

Log into your healthchecks account, click on Integrations, scroll down to Webhook and click Add integration.

In the down side, select the drop-down next to URL to POST.

In the actual URL field put your server address:

https://push.example.com/message

The Request Body box is where you customise your message. Mine looks like this:

{
    "title":"$NAME $STATUS",
    "message":"$NOW", 
    "priority":5
}

Simple. The title has the name of the job, and its status (up or down) and the message itself is just the date.

There is a link that says Quick Reference if you want to know all the placeholders, so you can make your own.

In the Request Headers box you need:

Content-Type: application/json
X-Gotify-Key: YOURTOKEN

Use your key from the application you made above. Be sure to keep each part on its own line as shown above.

Also, be sure to copy your work to the up side. I just put the same stuff in because the message already says ‘up’ and ‘down’ but you can customise the message if you want to.

Click Save Integration.

Done!

There you have it. Your integration will be added and enabled for all your jobs automatically. You can disable them per-job on the main screen.

Other Gotify guides

This is one of a small series of Gotify guides I intend to write, about how to plug it into various services.

Here is a list of Gotify articles on this site:

Reply by email