icon-zdx.svg
Digital Experience Monitoring (ZDX)

PagerDuty Webhook Configuration Guide

This guide provides information on using PagerDuty for configuring webhooks for alerts in ZDX. These instructions provide a sample configuration that you can use based on user requirements.

  1. Create a PagerDuty account at www.pagerduty.com.
  2. On your PagerDuty account page:
    1. Click Developer Mode.

    2. Click Create New App.

    3. On the Build App window:

      • AppName: Enter a name for the application.
      • Description: Enter a description.
      • Category: Select Error Tracking.
      • We would like to help you publish a public app for all PagerDuty users. Do you intend to publish the app for all PagerDuty users and the app ecosystem?: Select No, I am not interested.

      Click Save.

    4. When the Configure App page appears, go to Events Integration > Manage.

    5. Select Yes for Event Integration and enter the event transformation script.

      • export function transform(PD) {
          // Sample Event Transformation
          let body = PD.inputRequest.body;
          let zdxLinkURL = body.zdxUrl;
          let emitEv = true;
         
          let ruleName = body.ruleName;
         
          if (ruleName.toLowerCase() == "test")
            emitEv = false;
         
          let payloadCount = "\n\n";
         
          if ( body.status == "STARTED" ) {
            payloadCount += "Affected: \nGeolocations: " +  
                            body.geolocationCount + "\nDepartments: " + 
                            body.deptCount + "\nImpacted Devices: " + 
                            body.impactedDeviceCount + "\nOS Versions: " + 
                            body.osverCount
          }
         
          let normalized_event = {
            event_action: PD.Trigger,
            // optionally include a key to prevent creating duplicate
            // incidents when the same event is sent more than once
            // dedup_key: body.event_key,
         
         
            payload: {
              summary: `Rule: ${body.ruleName}, Severity: ${body.severity} ${body.status}`,
              source: 'ZDX',
              severity: PD.Critical,
              custom_details: `AlertId: ${body.alertId}\nRule Name: ${body.ruleName}\nSeverity: ${body.severity}\nCriteria: ${body.criteriaString}\nLink: ${zdxLinkURL} ${payloadCount}`
            },
            dedup_key: "",
         
            // optionally display links or images on web and mobile
            links: [{
              "href": zdxLinkURL,
              "text": "Alert Details"
            }],
          };
         
          if ( emitEv)
            PD.emitEventsV2([normalized_event]);
        }
        
        Close
    6. Copy the Events API Endpoint address as the URL to use when configuring a webhook in the ZDX Admin Portal.

    7. Click Save.
  3. Configure a webhook in the ZDX Admin Portal.
    1. Go to Administration > Integrations > Webhooks > Add New Webhook.

    2. In the Add New Webhook window:
      • Name: Enter the name of the webhook for PagerDuty.
      • Status: Select Enabled.
      • URL: Enter the URL you copied from the previous step.
      • Authentication Type: Select Token.
      • Bearer Token: PagerDuty does not generate a bearer token. To meet webhook configuration requirements, enter any text for the bearer token (e.g., 1234).
    3. (Optional) Click Test Webhook to confirm the webhook configuration works.
    4. Verify the incident within PagerDuty if an alert is raised from the Test Webhook.

    5. Click Save in the Add New Webhook window.
Related Articles
Microsoft Teams Webhook Configuration GuideOpsGenie Webhook Configuration GuidePagerDuty Webhook Configuration GuideSlack Webhook Configuration GuideSplunk Webhook Configuration Guide