# UptimeRobot monitor alert notifications on your phone > Get a Highest-priority push notification when an UptimeRobot monitor goes down, a quiet one when it's back up, and a heads-up before an SSL certificate or domain expires. - Company: UptimeRobot (https://www.justpush.io/recipes/uptimerobot) - Event: `monitor` (Monitor alert) - Tags: Developer tools, Monitoring - Install: https://studio.justpush.io/recipes/uptimerobot/monitor-alert - Web page: https://www.justpush.io/recipes/uptimerobot/monitor-alert ## Setup 1. Click Install in Studio and sign in. The recipe is added to your account and you get a personal webhook URL. 2. In UptimeRobot, open Integrations > Add Integration and choose Webhook (Team and Scale plans). 3. Paste your webhook URL (shown in Studio after install) as the URL and use the JSON body from the setup notes below. 4. Attach the integration to the monitors that should notify you. 5. In UptimeRobot, open **Integrations → Add Integration → Webhook** (Team and Scale plans only). Paste the URL above, choose **Send as JSON**, and use this body: 6. ```json 7. { 8. "alertType": "*alertType*", 9. "alertTypeFriendlyName": "*alertTypeFriendlyName*", 10. "monitorFriendlyName": "*monitorFriendlyName*", 11. "monitorURL": "*monitorURL*", 12. "alertDetails": "*alertDetails*", 13. "alertDuration": "*alertDuration*", 14. "httpStatusCode": "*httpStatusCode*", 15. "sslExpiryDate": "*sslExpiryDate*", 16. "sslExpiryDaysLeft": "*sslExpiryDaysLeft*", 17. "domainExpireDate": "*domainExpireDate*", 18. "dashboardUrl": "*dashboardUrl*" 19. } 20. ``` 21. Then attach the integration to your monitors. 22. The recipe also accepts UptimeRobot's **send default variables** option (the values as a query string) if you'd rather not paste a body. 23. UptimeRobot doesn't escape values in a custom body, so a monitor name with a `"` in it would break the JSON; avoid quotes in monitor names or use the query-string option. Deliveries aren't retried, and they aren't signed, so keep your endpoint URL private. ## Code Studio calls `handleRequest(request)` with the incoming webhook (`{ method, headers, body, query, raw }`) and sends the message object it returns. Returning `null` sends nothing. ```js // UptimeRobot → monitor down, up, or certificate/domain expiring // Fires when UptimeRobot calls a Webhook integration for a monitor. Works with the JSON // body from INSTALL.md, and with UptimeRobot's "send default variables" query string. // Docs: https://help.uptimerobot.com/en/articles/14498593-webhook-integration // "4m 12s" / "2h 5m" from a number of seconds. function duration(seconds) { const s = Math.round(Number(seconds)) if (!Number.isFinite(s) || s <= 0) return null if (s < 60) return `${s}s` if (s < 3600) return `${Math.floor(s / 60)}m ${s % 60}s` return `${Math.floor(s / 3600)}h ${Math.floor((s % 3600) / 60)}m` } // Only link to real http(s) URLs. function link(url, cta) { return typeof url === "string" && /^https?:\/\//.test(url) ? [{ cta, url }] : [] } // UptimeRobot leaves "*variable*" untouched when it has no value; treat that as missing. function text(value) { const s = value == null ? "" : String(value).trim() return s && !/^\*\w+\*$/.test(s) ? s : null } function handleRequest(request) { const body = request.body && typeof request.body === "object" ? request.body : {} const data = { ...body, ...(request.query || {}) } const type = text(data.alertType) // Guard: only UptimeRobot alerts (1 = down, 2 = up, 3 = SSL or domain expiry). if (!["1", "2", "3"].includes(type)) { console.log("Not an UptimeRobot alert — skipping") return null } const name = text(data.monitorFriendlyName) ?? text(data.monitorURL) ?? "Your monitor" const buttons = [...link(text(data.dashboardUrl), "View monitor"), ...link(text(data.monitorURL), "Open site")] if (type === "1") { const code = text(data.httpStatusCode) const details = text(data.alertDetails) // Skip the status code when the details already mention it ("HTTP 500 - …"). const showCode = code && code !== "0" && !(details ?? "").includes(code) return { title: `🔴 ${name} is down`, message: [details, showCode ? `HTTP ${code}` : null, text(data.monitorURL)] .filter(Boolean) .join(" · ") || "Monitor is down", topic: "UptimeRobot", priority: 2, // Highest — your site or service is unreachable right now buttons, } } if (type === "2") { const down = duration(data.alertDuration) return { title: `✅ ${name} is back up`, message: down ? `It was down for ${down}` : text(data.alertDetails) ?? "Monitor is up again", topic: "UptimeRobot", priority: -1, // Low — good news, nothing to do buttons, } } // Type 3 covers both SSL certificates and domains; the filled-in date tells which. const days = text(data.sslExpiryDaysLeft) const ssl = text(data.sslExpiryDate) const domain = text(data.domainExpireDate) const what = ssl || days ? "SSL certificate" : domain ? "Domain" : "Certificate or domain" return { title: `🔒 ${what} for ${name} expiring`, message: (days ? `Expires in ${days} day${days === "1" ? "" : "s"}` : `Expires ${ssl ?? domain ?? "soon"}`) + (text(data.monitorURL) ? ` · ${text(data.monitorURL)}` : ""), topic: "UptimeRobot", priority: 0, // Normal — renew it before it becomes an outage buttons, } } ``` ## UptimeRobot monitor webhook payload (sample) ```json { "alertType": "1", "monitorURL": "https://acme.example.com", "alertDetails": "Connection Timeout", "dashboardUrl": "https://dashboard.uptimerobot.com/monitors/798123456", "alertDuration": "*alertDuration*", "sslExpiryDate": "", "httpStatusCode": "0", "domainExpireDate": "", "sslExpiryDaysLeft": "", "monitorFriendlyName": "Acme website", "alertTypeFriendlyName": "Down" } ``` ## FAQ ### Does this work on iPhone and Android? Yes. Install the JustPush app from the App Store or Google Play and sign in. Every phone signed in to your account gets the notification. ### Do I need to write code? No. Install the recipe in Studio, paste your webhook URL into UptimeRobot and you are done. The code is there if you want to change the text, the sound or the buttons. ### Can I change what the notification says? Yes. After install the recipe's code is yours. Edit it in Studio and test it against the sample payload before you save. ### What does it cost? JustPush is free for 30 days. After that it's $19.99 a year, or $39.99 once. There is no extra charge for recipes.