Bot confidence webhook 422 on PagerDuty v2 enqueue

Trying to push bot confidence drops into PagerDuty when the Genesys Cloud AI assistant falls under 0.65. The flow fires a conversation:updated webhook that routes JSON into a Node bridge. The script checks if (score < 0.65), builds the dedup_key from the conversation ID, and hits POST https://events.pagerduty.com/v2/enqueue.

Console throws a 422 Unprocessable Entity on the routing_key field. GC runs version 23.12. The timestamp formatting’s totally throwing off the validator. Payload dumps below.

Cause: The routing_key is likely empty because the webhook doesn’t pull the score by default, so it’s sending garbage to PagerDuty.

Solution:

  1. Add botScore to the attributes list via API.
curl -X PATCH https://api.mypurecloud.com/api/v2/engagements/webhooks/{webhookId} \
-H "Content-Type: application/json" \
-d '{"attributes": ["botScore"]}'
  1. Restart the bridge.
curl -X PATCH https://api.mypurecloud.com/api/v2/engagements/webhooks/{webhookId} \
-H "Content-Type: application/json" \
-d '{"attributes": ["botScore"]}'

Cause: The webhook payload doesn’t include the score field by default. PagerDuty throws a 422 because the routing key logic breaks on null data. The Node bridge expects a string for the dedup_key. When the attribute is missing, the score is undefined. The routing key derivation in the Node script assumes the score exists. Without the attribute, the key is empty. PagerDuty rejects empty keys. The fix forces the serializer to output the value. This avoids the null pointer exception in the bridge. PagerDuty v2 enforces strict validation on the event structure. It’s a schema validation failure, not an auth issue. The 422 response body usually contains a validationErrors array. Check the logs to confirm the field name matches botScore.

Solution: Add the attribute to the config. Ran the patch on staging. The error clears right away.

[Screenshot: webhook_attribute_patch_success.png]

Refer to the EventBridge thread for similar serialization limits. The API rejects incomplete schemas. If you’re using Terraform, patch the resource definition instead of relying on manual API calls. State drift happens fast if the code base says empty list but the API has the attribute.

resource "genesyscloud_webhook" "pagerduty_alert" {
 attributes = ["botScore"]
}

Run terraform plan to verify the attribute change registers. Apply the update. Verify the webhook logs after the update. The score should be visible in the JSON body. Payload looks clean after that.