Weebhook V3 account_reference filter

Hi team,

I am trying to create a webhook v3 subscription with an account reference filter. When I send the below POST body in the request,

{
“webhook_subscription”: {
“delivery_method”: {
“type”: “http_delivery_method”,
“URL”: “,”
},
“description”: “Sends PagerDuty v3 webhook events to Fivetran PagerDuty Webhook Connector”,
“events”: [
“incident.acknowledged”,
“incident.annotated”,
“incident.delegated”,
“incident.escalated”,
“incident.priority_updated”,
“incident.reassigned”,
“incident.reopened”,
“incident.resolved”,
“incident.responder.added”,
“incident.responder.replied”,
“incident.triggered”,
“incident.unacknowledged”
],
“filter”: {
“id”: “<account_id>”,
“type”: “account_reference”
},
“type”: “webhook_subscription”
}
}

I get the following error
{
“errors”: {
“webhook_subscription”: {
“filter”: {
“id”: [
“must be nil for an account-level subscription”
]
}
}
}
}

If I update the filter id value to be “”, I get
{
“errors”: {
“detail”: “Internal Server Error”
}
}

And if I try values “null” or “nil” I still get “must be nil for an account-level subscription”.

What am I doing wrong here?

Thanks,
Dustin

Hi Dustin,

For creating an account reference filter, you will want to remove the ID field completely.

The filter section should look like this:

“filter”: {
“type”: “account_reference”
}

with no “id” field.

Can you give that a try and let me know how it works for you?

Thanks,
Josef

Hi Josef,

That’s still throwing an Internal Server Error.

Thanks,
Dustin

Hi Dustin,

Please can you enter the values in the call below and let me know how you get along

{
  "webhook_subscription": {
    "id": "PXXXXX",
    "type": "webhook_subscription",
    "active": true,
    "delivery_method": {
      "id": "string",
      "secret": null,
      "temporarily_disabled": false,
      "type": "http_delivery_method",
      "url": "$MYURL$"
    },
    "description": "Send it",
    "events": [
      "incident.acknowledged",
"incident.annotated",
"incident.delegated",
"incident.escalated",
"incident.priority_updated",
"incident.reassigned",
"incident.reopened",
"incident.resolved",
"incident.responder.added",
"incident.responder.replied",
"incident.triggered"
    ],
    "filter": {
      "type": "account_reference"
    }
  }
}

Kind regards,

I am still getting Internal Server Error with and without the ID at the 1st child level. Is there anything I need to configure or enable within the app? Below is my full request body.

Blockquote
{
“webhook_subscription”: {
“id”: “”,
“type”: “webhook_subscription”,
“active”: true,
“delivery_method”: {
“id”: “string”,
“secret”: null,
“temporarily_disabled”: false,
“type”: “http_delivery_method”,
“URL”: “<MY_FIVETRAN_URL>”
},
“description”: “Sends PagerDuty v3 webhook events to Fivetran PagerDuty Webhook Connector”,
“events”: [
“incident.acknowledged”,
“incident.annotated”,
“incident.delegated”,
“incident.escalated”,
“incident.priority_updated”,
“incident.reassigned”,
“incident.reopened”,
“incident.resolved”,
“incident.responder.added”,
“incident.responder.replied”,
“incident.triggered”,
“incident.unacknowledged”
],
“filter”: {
“type”: “account_reference”
}
}
}

Thanks,
Dustin

Hi Dustin,

Thanks for following up here. Can you share any more information about the error you are receiving?

I tested with Chiedu’s and got a successful response, but failed with the request body that you provided. Upon further inspection, I’m seeing that you have a “URL” field in the request body. Please note that that field needs to be “url” (in lowercase). Are you able to test again with this change?

Please let me know how that goes for you.

Thanks,
Josef

Yes, my url is all lowercase. I am still getting an internal server error,

{
“errors”: {
“detail”: “Internal Server Error”
}
}

This is being returned even if I remove the id field. Maybe the account id I am passing is the issue? Where is the most correct place to locate this via API?

Hi Dustin,

Could you please share the error message you are receiving/response code?

Josef

Response: 500

{
“errors”: {
“detail”: “Internal Server Error”
}
}

Hi Dustin,

I gave it a try with a payload similar to Chiedu’s below and was successful in receiving webhooks at my URL from the Service when incidents were triggered, acknowledged, and resolved.

I’ve included my cURL statement below, with fields you would want to replace in all capital letters:

curl --location --request POST 'https://api.pagerduty.com/webhook_subscriptions' \
--header 'Authorization: Token token=REDACTED' \
--header 'X-EARLY-ACCESS: webhooks-v3' \
--header 'Accept: application/vnd.pagerduty+json;version=2' \
--header 'Content-Type: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
    "webhook_subscription": {
        "id": "SERVICE ID",
        "type": "webhook_subscription",
        "active": true,
        "delivery_method": {
            "id": "string",
            "secret": null,
            "temporarily_disabled": false,
            "type": "http_delivery_method",
            "url": "https://REDACTED.free.beeceptor.com"
        },
        "description": "Send it",
        "events": [
            "incident.acknowledged",
            "incident.annotated",
            "incident.delegated",
            "incident.escalated",
            "incident.priority_updated",
            "incident.reassigned",
            "incident.reopened",
            "incident.resolved",
            "incident.responder.added",
            "incident.responder.replied",
            "incident.triggered"
        ],
        "filter": {
            "type": "account_reference"
        }
    }
}'

Please let me know if this is helpful or you have additional questions.

Regards,

Alex Engelmann
Technical Support Specialist
PagerDuty.com

Thanks, Alex! I think am misinterpreting the documentation. If am trying to create a webhook with an account_reference filter, why would I pass a service id and not an account id? How is that different from creating a service_reference filter with a service id?

Hi Dustin,

Apologies for the misunderstanding, it’s actually not necessary.

To create a webhook subscription for events across an entire account, no filter ID is needed, as the API key is a reference to your account. The following payload would create an account-wide subscription to all incident events:

{
    "webhook_subscription": {
        "type": "webhook_subscription",
        "delivery_method": {
            "type": "http_delivery_method",
            "url": "https://YOUR_URL"
        },
        "events": [
            "incident.acknowledged",
            "incident.annotated",
            "incident.delegated",
            "incident.escalated",
            "incident.priority_updated",
            "incident.reassigned",
            "incident.reopened",
            "incident.resolved",
            "incident.responder.added",
            "incident.responder.replied",
            "incident.triggered",
            "incident.unacknowledged"
        ],
        "filter": {
            "type": "account_reference"
        }
    }
}

Please let me know if this is helpful or you have additional questions.

Regards,

Alex Engelmann
Technical Support Specialist
PagerDuty.com

Alex, yes that’s what I am trying to do here, but I keep getting a 500 internal server error response. I am able to hit many other endpoints, so that’s why I had previously asked in the thread is there was something I needed to enable elsewhere in order to create webhook. Below is the request body,

{
“webhook_subscription”: {
“type”: “webhook_subscription”,
“delivery_method”: {
“type”: “http_delivery_method”,
“URL”: “”
},
“description”: “Sends PagerDuty v3 webhook events to Fivetran PagerDuty Webhook Connector”,
“events”: [
“incident.acknowledged”,
“incident.annotated”,
“incident.delegated”,
“incident.escalated”,
“incident.priority_updated”,
“incident.reassigned”,
“incident.reopened”,
“incident.resolved”,
“incident.responder.added”,
“incident.responder.replied”,
“incident.triggered”,
“incident.unacknowledged”
],
“filter”: {
“type”: “account_reference”
}
}
}

Hi Dustin,

The URL field name needs to be url in lowercase, have you already tried changing that field? Please let me know if you still receive an error after fixing that.

Regards,

Alex Engelmann
Technical Support Specialist
PagerDuty.com

Hi Alex,

Yes, this was already addressed earlier in this thread by Josef. The webhook URL I am passing is generated by Fivetran and I have triple-checked that it’s all lowercase. Still getting the 500 Internal Server Error.

Thanks,
Dustin

Hello Dustin,

Please can you use a valid ID to filter to a Service.

{
  "webhook_subscription": {
    "type": "webhook_subscription",
    "active": true,
    "delivery_method": {
      "id": "string",
      "secret": null,
      "temporarily_disabled": false,
      "type": "http_delivery_method",
      "url": "$MYURL$"
    },
    "description": "Send it",
    "events": [
      "incident.acknowledged",
"incident.annotated",
"incident.delegated",
"incident.escalated",
"incident.priority_updated",
"incident.reassigned",
"incident.reopened",
"incident.resolved",
"incident.responder.added",
"incident.responder.replied",
"incident.triggered"
    ],
    "filter": {
      "id": "PXXXXXX",
      "type": "service_reference"
    }
  }
}

If the issue persists, please email support@pagerduty.com so we can get account specific details from you then go from there. We can’t do so in this public space.

Kind regards,