A webhook, or the Uptime.com Custom Postback URL, allows you to push alerts to any third party system that can expect to receive an application/json
encoded payload in the body of a request.
Webhooks are useful for managing alert data internally, and creating a history of specific alerts with the metrics your team needs to know. Unlike specific integrations, which handle data output for visualizing metrics, webhooks require administrators to maintain their own system for translating and receiving this data.
Please Note: The instructions you will see are based on a third-party, and are subject to change without warning.
Integration Functionality
- Receive an HTTP POST in a JSON serialized string containing the expected results
- Post data received to a third party URL
Integration Setup
The Custom Postback URL first requires you to:
1. Create your own website or web application.
2. You will then need to set up a handler, accessible by a public URL which you enter into the URL
field. We will then POST the alert data in JSON format to this URL.
Servers can expect to receive these keys in the HTTP POST in a JSON serialized string similar to this example. The example below also shows the data type for each variable:
{"data":
{"service":
{"id": 0, [Integer]
"name": "", [String]
"device_id": 123, [Integer]
"monitoring_service_type": "HTTP", [String]
"is_paused": false, [Boolean]
"msp_address": "", [String]
"msp_interval": 1, [Integer]
"msp_sensitivity": 2, [Integer]
"msp_num_retries": 2, [Integer]
"msp_url_scheme": "", [String]
"msp_url_path": "", [String]
"msp_port": 10000, [Integer]
"msp_protocol": "", [String]
"msp_username": "", [String]
"msp_dns_server": "", [String]
"msp_dns_record_type": "", [String]
"msp_send_string": "", [String]
"msp_expect_string": "", [String]
"msp_expect_string_type": "",
"msp_encryption": "", [String]
"msp_threshold": 40, [Integer]
"msp_notes": "", [String]
"msp_include_in_global_metrics": true, [Boolean]
"msp_use_ip_version": "", [String]
"monitoring_service_type_display": "", [String]
"display_name": "", [String]
"short_name": "", [String]
"tags": ["tag1", "tag2"]},
"account":
{"id": 321, [Integer]
"name": "", [String]
"brand": "", [String]
"site_url": ""} , [String]
"integration":
{"id": 132, [Integer]
"name": "", [String]
"module": "", [String]
"module_verbose_name": "", [String]
"is_enabled": true, [Boolean]
"is_errored": false, [Boolean]
"is_test_supported": true, [Boolean]
"postback_url": "", [String]
"headers": "", [String]
"use_legacy_payload": false}, [Boolean]
"date": "2019-12-08T10:04:35.806Z",
"alert":
{"id":,
"created_at": "2019-12-08T10:04:35.806Z", [String]
"state": "", [Boolean]
"output": "", [String]
"short_output": "", [String]
"is_up": false}, [Boolean]
"global_alert_state":
{"id":,
"created_at": "2019-12-08T10:04:35.806Z", [String]
"num_locations_down": 2, [Integer]
"state_is_up": false, [Boolean]
"state_has_changed": true, . Boolean]
"ignored": false}, [Boolean]
"device":
{"id":, "name": "", [String]
"address": "", [String]
"is_paused": false, [Boolean]
"display_name": ""}, [String]
"locations": ["GBR", "US-Central"], [String]
"links":
{"alert_details": "", [String]
"real_time_analysis": ""}}, [String]
"event": "alert_raised" [String]
}
3. Basic setup requires a name for your integration and the URL that will receive the HTTP POST
from Uptime.com.
4. Once you've configured your Custom Postback URL, you will need to assign it to a contact and
make sure that contact is notified when a Check fails.
Custom HTTP Headers
To use optional custom HTTP Headers, structure your data as follows:
X-Test-Header: some_value
Please note that content-type is automatically set to application/json
. We do not support specifying a custom user agent for our webhook integration.
Assign Integration to Existing Contacts
To add your integration to an existing contact, click on or type the name of the contact into the Assign to Contacts field within the integration setup screen.
Create New Contacts for the Integration
Adding a dedicated or new contact cannot be done within the integrations screen.
To do so first:
1. Click Notifications > Contacts. You can select New Contact, or add your integration to an
existing contact.
2. Select the Custom Postback URL option from the Integrations field within the Add Contact
screen.
Assign Integration Contact to a Check
If you have created a new or dedicated contact for your integration, you will need to add it to specific checks. If you have assigned the integration to a contact that is already assigned to one (or more) checks, you may skip this step.
Return to your Check’s Edit screen and assign this contact to the Contacts field to be notified of a downtime event. Alert data will appear in real-time.
Test Your Integration
Test your integration with one of the following two options:
1. Force the Check assigned to your Integration to fail by altering it (HTTPS checks can
use a misspelling of the domain, for example).
2. Click Notifications > Contacts, then click Actions > Test to send a test to the Contact.
Third-Party Providers
Some third-party providers use this postback URL method to create an integration with Uptime.com. Here is a list of providers that utilize this method:
For a list of third-party integrations, see our article Overview of Push Notifications.
Final Thoughts
Webhooks are a powerful tool for website monitoring as they allow for real-time notifications of changes or events on a website, which allows for quick and efficient response.
By using webhooks, you can stay informed and take action as soon as issues arise, ultimately improving the overall performance and user experience of your website.
For any technical assistance from the Uptime.com side, please contact support@uptime.com for help!
Comments
0 comments