Integration guide for alert notifications

We offer custom integration for the following alert sources

Introduction to notification Integrations

This technical guide is tailored for developers seeking to harness the power of webhooks to seamlessly incorporate custom events and alerts into their applications, as well as to streamline the assimilation of alerts from observability tools.

Webhooks, at their core, are HTTP callbacks that facilitate instant communication between applications, allowing them to exchange data in near real-time. This guide focuses on leveraging webhooks to not only receive alerts from observability tools but also to create and propagate custom events within applications.

Custom Events in Application:

Through webhook integration, developers can effortlessly design and implement custom events that align with the unique characteristics of their applications. Whether it be user interactions, system status changes, or application-specific metrics, webhooks enable the prompt notification and handling of these events, fostering a proactive development approach.

Observability Alerts Integration:

For developers navigating the complex terrain of multiple observability tools the ability to seamlessly integrate alerts from monitoring tools is indispensable.

For most widely used observability tools Temperstack provides a custom integration for alerts, however you might be using a specific tool that we don’t have a custom integration in which case you can use webhooks.

Web hook Integration guide for Temperstack notifications

Step 1 : Create the Webhook on Temperstack

You can create the Webhook Integration Key and URL from Temperstack.

  • Login to Temperstack

  • Notifications -> Temperstack Notifications -> Services

  • Select the service for which you want to create the webhook

  • Enter an integration key name

  • Select Webhook as the integration type

  • Hit Submit

  • Copy the integration URL - Use it in the POST request like described below.

  • Keep the URL safe and secure.

API:

Endpoint 
POST /api/integration/webhook/API_KEY 

This endpoint is used to send alerts via webhooks.

Step 2: Request to be sent through webhook

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 contain the following fields:

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

status (Required, String): The status of the alert. Allowed values: "Alarm" or "OK". Example: "Alarm"

The following fields are optional:

alert_priority (String): The priority of the alert. Allowed values: "Critical" or "Medium". Example: "Critical"

alert_id (String): An optional identifier for the alert. Example: "123456"

description (String): Additional information about the alert. Example: "Too many requests are failing for X"

alert_url (String): A URL associated with the alert. Example: "www.example.com/"

metric_name (String): The name of the metric associated with the alert. Example: "404 Error rate"

resource_id (String): An identifier for the associated resource. Example: "CheckoutAPI"

resource_name (String): The name of the associated resource. Example: "Backend API"

resource_type (String): The type of the associated resource. Example: "API"

run_book_url (String): A URL to the runbook associated with the alert. Example: "www.example.com/checkoutapi_404_error_runbook"

Example

{ 
"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