Skip to main content

Integrations

Generic Integration Guide

Implement any application or service with Zenduty using the Generic Integration.

To integrate any Applications Webhook with Zenduty, complete the following steps:

In Zenduty:

  1. To add a new API integration, go to Teams on Zenduty and click on the team you want to add the integration to.
  2. Next, go to Services and click on the relevant Service.
  3. Go to Integrations and then Add New Integration. Give it a name and select the application Generic Integration from the dropdown menu.
  4. Go to Configure under your integrations and copy the generated Webhook URL.

In your Application/Service:

  1. To create an alert from your application, send a post request to above copied Webhook URL.

  2. Add post parameters by following the table below :

    Name Type Default Example Required
    message String None This becomes the incident title. Yes
    summary String None This is the incident summary. No
    alert_type String Info Choices - critical, acknowledged, resolved, error, warning, info. Yes
    suppressed Boolean False True or False No
    entity_id String None A unique id for the alert. If not provided, the Zenduty API will create one. No
    payload JSON None A JSON payload containing additional information about the alert. No
    urls Array None An array containing JSON schema of urls related to alerts. No
  • In the headers, the Content type should be set to "application/json"

    Content-Type: application/json
    
  • Sample Payload for creating an incident with a critical incident

{
  "alert_type": "critical",
  "message": "This is a sample alert from API integration",
  "summary": "This is the incident summary for the API integration",
  "entity_id": 12345,
  "payload": {
    "status": "ACME Payments are failing",
    "severity": "1",
    "project": "kubeprod"
  },
  "urls": [
    {
      "link_url": "https://www.example.com/alerts/12345/",
      "link_text": "Alert URL"
    }
  ]
}

The alerts are bound into incidents by their entity ID. If you'd like to resolve the exising incident, make sure to change the alert type to 'Resolved' and keep the entity ID intact.

For example, you can send the below payload to resolve the above sample incident

{
  "alert_type": "resolved",
  "message": "This is a sample alert from API integration",
  "summary": "This is the incident summary for the API integration",
  "entity_id": 12345,
  "payload": {
    "status": "ACME Payments are failing",
    "severity": "1",
    "project": "kubeprod"
  },
  "urls": [
    {
      "link_url": "https://www.example.com/alerts/12345/",
      "link_text": "Alert URL"
    }
  ]
}
  • For cURL requests:
 curl -X POST <IntegrationURL> -H 'Content-Type: application/json' -d '{"alert_type":"critical", "message": "This is a sample alert from API integration", "summary": "This is the incident summary for the API integration", "entity_id":"some_entity_id", "urls":[{"link_url": "https://www.example.com/alerts/1234/","link_text": "Alert URL"}]}'
  • Response Status Codes are as below
  • 200 OK: Message has passed the basic check and sent for further - processing.
  • 400 Bad Request: Incorrect payload.
  • 404 Not Found: Invalid integration key or Integration is disabled.
  • Sample Payload for 200 OK Response
{
 "message": "success",
 "trace_id": "cadfe35f-e3b1-4175-b118-a595bff9a214"
} 

Status of an alert can be fetched using trace_id from the above response.

To get the status of an alert, use the following API endpoint:

https://events.zenduty.com/api/alert/status/<trace_id>/

⚠️
You will receive the status of the alert within 60 minutes of the alert creation request.
  • For a more detailed explanation of response schema, click here.

  • The status of an alert can be one of the following: queued, failed, completed.

  • Sample Payloads for Status Endpoint

{
 "status": "queued"
}

,

{
 "incident":{
	 "incident_number": 2524,
	 "unique_id": "cNasg9C4yzNpronzUUUdKR" 
},
 "alert": "U239RyRi7rySuJKb3FcKXE",
 "integration":{
	 "name": "Generic"
},
 "status": "completed",
 "is_incident_created": false,
 "suppressed": false
}

,

{
 "status": "failed",
 "error": "Your service is under maintenance" 
}
  • Example of Alert Status Tracking Request

curl -L 'https://events.zenduty.com/api/alert/status/<trace_id>/'

Zenduty SignUp