Skip to content

Instantly share code, notes, and snippets.

@Log1x
Last active November 28, 2023 21:15
Show Gist options
  • Save Log1x/af2c1a9613d155477295f20eece406a3 to your computer and use it in GitHub Desktop.
Save Log1x/af2c1a9613d155477295f20eece406a3 to your computer and use it in GitHub Desktop.
Uptime Robot Discord Webhook

Uptime Robot Webhook for Discord

Screenshot

Configuration

  • Alert Contact Type: Web-Hook

  • URL to Notify: https://discordapp.com/api/webhooks/CHANGEME/CHANGEME?

    • Must end with ?
  • Send as JSON (application/json).

  • Send default variables as POST parameters

{
"embeds": [
{
"title": "*alertDetails*",
"footer": {
"text": "Timestamp: *alertDateTime*"
},
"thumbnail": {
"url": "https://i.imgur.com/00zpqHE.jpg",
"height": 16,
"width": 16
},
"fields": [
{
"name": "ID",
"value": "*monitorID*"
},
{
"name": "Name",
"value": "*monitorFriendlyName*"
},
{
"name": "Destination",
"value": "*monitorURL*"
},
{
"name": "Type",
"value": "*alertTypeFriendlyName*"
}
]
}
]
}
Copy link

ghost commented Jun 6, 2021

mahn u are a time saver

@Log1x
Copy link
Author

Log1x commented Jun 6, 2021

and how do i use this?

good question.

Add a Webhook in UptimeRobot and set the configuration as I have in the gist above. I was hoping it'd be straight forward. :(

mahn u are a time saver

<3

Copy link

ghost commented Jun 6, 2021

i need help, when i post the code in the post value, it is showing "post value must be JSON" some help would be appriciated

@Log1x
Copy link
Author

Log1x commented Jun 6, 2021

It should look like this:

Screenshot

Copy link

ghost commented Jun 6, 2021

It should look like this:

Screenshot

thanks for the quick response , it accepted the value, still i am concerned as the box and text appears to be red, i doubt if i did anything wrong

Copy link

ghost commented Jun 6, 2021

also can u add a feature which mentions a user when it does down
also if it is an up message the color of embed is green and if it is a down message the embed color is red

@Log1x
Copy link
Author

Log1x commented Jun 6, 2021

unfortunately for the latter there's no way to do a conditional here to control the embed color.

as far as the mention you should be able to add @username into one of the fields, but I'm not sure if it will work.

@FadedThaAHo
Copy link

How can I use it for https://repl.it/??

@1day2die
Copy link

Is this still up to date? dosent seem to work

@Log1x
Copy link
Author

Log1x commented Sep 12, 2021

Is this still up to date? dosent seem to work

still working on my end

@1day2die
Copy link

1day2die commented Sep 12, 2021

it was a problem with uptime robot. It does not work with "ö, ä ,ü " etc. thanks for this code man. amazing

@lt-kraken
Copy link

Was already wondering why I didn't get a notification, turns out that the body is actually a requirement and doesn't default to something. Thanks for providing the message body :)

@faderzz
Copy link

faderzz commented Aug 5, 2022

unfortunately for the latter there's no way to do a conditional here to control the embed color.

as far as the mention you should be able to add @username into one of the fields, but I'm not sure if it will work.

Hey, I found a workaround, it should be possible to add a message field above the embed like the screenshot

image

You can do this by using adding "content": "your message", above "embeds": [
e.g.
{
"content": "@everyone bot down",
"embeds": [
...

To mention a user you can add <@USERID> to the text field and replace "USERID" with the ID of the user or a role if you wanna do that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment