Skip to content

Connecting Uptime Robot to Discord without third party services

Craig Edwards edited this page Nov 25, 2020 · 11 revisions

This tutorial will guide you through how to connect uptime robot to discord, providing nice looking notifications via a webhook without any third party services.

There are many other ways to do this with third party services, most commonly by using a simple discord.js bot, or by using a service such as Pushbullet. If you don't feel the need for any such extra system in the way which you either need to pay for or maintain, then read on. This tutorial is for you.

Difficulty Level Easy
Reading Time Five minutes
Version 1.0
Prerequisites Discord server with manage webhooks permission
• Pro account with Uptime Robot
• Some services you want monitored, and reported to discord channels!

Creating the Discord Webhook

Firstly, you must create a webhook in discord. I chose to give mine the icon of the uptime robot service, and the nickname "Uptime Robot", but you can choose whatever icon and name you like. What's important here is that we copy the url on this page and save it, as we'll need it in the next step.

Discord Webhook

Creating the Uptime Robot Alert Contacts

To make uptime robot talk to discord, you must now set up the webhook as alert contacts in the settings. Go into your settings on uptime robot and add two new alert contacts, both of type 'webhook'. Call one "Discord (up, green)" and the other "Discord (down, red)".

Discord Webhook

Note that we create two webhook alerts, one for up events and one for down events. This is because one of them has a duration field we can use and the other does not, and we want our down events to have a red border on the embed, and the up events to have a green border.

Be sure to fill in the following details:

Alert Contact "Discord (down, red)"

This alert contact sends an embed with a red border and no duration field.

Field Value
URL To Notify Enter your discord webhook URL, but place ?z& on the end of the webhook URL. This ensures it's unique so we can have two of them, one for up and one for down
Send As JSON Check this Box
Send default variables as form parameters Uncheck this box
Enable Notifications For Only Down Events
Get SSL expiration reminder notifications Uncheck this, if available in your plan

Post data (JSON format)

{
  "content": "",
  "embeds": [
    {
      "author": {
        "name": "Sporks Service Status",
        "url": "<enter the url of your system>"
      },
      "title": "Service Status Announcement",
      "url": "<enter the url of your system>",
      "description": "Service ***monitorFriendlyName*** is ***alertTypeFriendlyName***",
      "color": 16711680,
      "fields": [ { "name": "Details", "value": "*alertDetails*"}
      ]
    }
  ]
}

Alert Contact "Discord (up, green)"

This alert contact sends a discord embed with a green border and a duration field.

Field Value
URL To Notify Enter your discord webhook URL, followed by ? only. Discord requires a webhook to end with & or ? for some reason.
Send As JSON Check this Box
Send default variables as form parameters Uncheck this box
Enable Notifications For Only Up Events
Get SSL expiration reminder notifications Uncheck this, if available in your plan

Post data (JSON format)

{
  "content": "",
  "embeds": [
    {
      "author": {
        "name": "Sporks Service Status",
        "url": "<enter the url of your system>"
      },
      "title": "Service Status Announcement",
      "url": "<enter the url of your system>",
      "description": "Service ***monitorFriendlyName*** is ***alertTypeFriendlyName***",
      "color": 65280,
      "fields": [ { "name": "Details", "value": "*alertDetails*"},
        {
          "name": "Duration",
          "value": "*alertDuration*",
          "inline": true
        }
      ]
    }
  ]
}

Once entered these will look similar to the screenshot below:

Discord Webhook

Assigning the Alert Contact to Monitors

Once you have created these alert contacts you need to go into each monitor event in turn within your dashboard on uptime robot, and assign both alert contacts to the monitor as shown below:

Discord Webhook

Testing

If you want, you can give it a test by creating a test monitor of type "keyword", pointing to www.google.com and looking for, for example 'sausages' on the homepage. This will always fail, and can be toggled to 'keyword not found' to test that both the up and down events fire on discord as you expect:

Discord Webhook

If you see events in discord, as above, then all is working, and you're done. You've now successfully set up uptime robot to push events to discord without third party software in between. Enjoy!