Webhook Integration

Webhook Functionality

  • Facilitates instant, bi-directional communication between applications.

  • Enables near real-time data exchange and event propagation.

Implementation Benefits

  • Proactive Development: Trigger actions immediately upon event detection.

  • Enhanced Responsiveness: Enable real-time reactions to incidents.

  • Improved Management: Streamlined incident detection and resolution.

Note: While Temperstack offers custom integrations for major observability tools, webhook integration provides a flexible solution for less common platforms.

Step 1: Create the Webhook on Temperstack

Follow these steps to create a webhook:

  1. Log in to your Temperstack account.

  2. Navigate to Notifications → Temperstack Notifications → Application Services.

  3. Select the desired service for which you want to create the webhook.

  4. Enter a name for the integration key.

  5. Select Webhook as the integration type.

  6. Click on Create Key.

  7. Copy the generated integration URL. Use this URL in your POST requests.

  8. Secure the URL: Ensure that only authorized systems use this webhook.

Step 2: Send a Request through the Webhook

API Endpoint

POST /api/integration/webhook/API_KEY This endpoint is used to send alerts via webhooks.

Request

Method: POST URL: https://YOUR_ORG.temperstack.com/api/integration/webhook/API_KEY

Headers:

  • Content-Type: application/json

Request Body: The request body must include the following fields:

  • alert_name (Required, String): A brief description of the alert. Example: "Multiple requests are failing."

  • status (Required, String): The alert's status. Allowed values: "Alarm" or "OK". Example: "Alarm".

Optional Fields:

  • alert_priority (String): Priority level ("Critical" or "Medium").

  • alert_id (String): A unique identifier for the alert.

  • description (String): Additional details about the alert.

  • alert_url (String): A URL associated with the alert.

  • metric_name (String): The related metric's name.

  • resource_id (String): Identifier for the associated resource.

  • resource_name (String): Name of the associated resource.

  • resource_type (String): Type of resource (e.g., "API").

  • run_book_url (String): URL to the related runbook for resolving the issue.

Example Request Body

{ 
"alert_name": "Multiple requests are failing", 
"status": "Alarm", 
"alert_priority": "Critical", 
"alert_id": "123456", 
"description": "Too many requests are failing for X", 
"alert_url": "www.example.com/", 
"metric_name": "404 Error rate", 
"resource_id": "CheckoutAPI", 
"resource_name": "Backend API", 
"resource_type": "API", 
"run_book_url": "www.example.com/checkoutapi_404_error_runbook" 
} 

Python Example

import requests 
import json 
url = "https://YOUR_ORG.temperstack.com/api/integration/webhook/API_KEY" 
payload = { 
"alert_name": "Multiple requests are failing", 
"status": "Alarm", 
"alert_priority": "Critical", 
"alert_id": "123456", 
"description": "Too many requests are failing for X", 
"alert_url": "www.example.com/", 
"metric_name": "404 Error rate", 
"resource_id": "CheckoutAPI", 
"resource_name": "Backend API", 
"resource_type": "API", 
"run_book_url": "www.example.com/checkoutapi_404_error_runbook" } 
headers = { 
'Content-Type': 'application/json' 
} 
response = requests.post(url, headers=headers, json=payload) 

print(response.text) 

Response

{ 
"message": "Notification Received" 
} 
Errors 
{ 
"message": "Invalid integration key" 
} 

Response Codes

200: Success

400: Bad Request

Last updated