Fun one today. Think of the Analytics API event as a notification - GC sends it, we forward to PagerDuty. We’re seeing duplicated incidents in Pagerduty, even with dedup_key set in the Events API v2 payload. It’s like the post office is delivering the same letter twice.
We’ve got an alert set on queue length - queue.length > 10. The alert triggers, our data action fires, sending the event. Payload looks like this:
{
"payload": {
"summary": "Queue Length Alert",
"source": "Genesys Cloud",
"type": "monitoring_alert",
"dedup_key": "queue_length_alert-{{queue.id}}",
"queue": {
"id": "a1b2c3d4-e5f6-7890-1234-567890abcdef",
"name": "Support Queue"
}
}
}
PagerDuty is receiving two events with the same dedup_key within a minute. GC is v39.0.0. Anyone else running into this?
The serializer in genesyscloud/models/events/event_create_request.py line 87 isn’t correctly formatting the dedup_key parameter for the Events API. It’s sending it as a string instead of a dictionary - that’s why PagerDuty isn’t recognizing it.
The API expects this:
{
"dedup_key": {
"key": "your_dedup_key_value"
}
}
But the SDK is sending:
{
"dedup_key": "your_dedup_key_value"
}
Workaround: Manually construct the payload as a dictionary before POSTing it.
from genesyscloud.client import Client
client = Client.get_instance()
events_api = client.events
payload = {
"event_type": "alert.queue.length.breached",
"payload": {
"queue_length": 15
},
"dedup_key": {
"key": "queue_length_alert"
}
}
response = events_api.post_event(payload)
print(response)
Question - what SDK version are you using? We’ve seen similar serializer issues in v2.6.x. Also, are you setting the dedup_key directly in the alert configuration within Analytics, or through the data action payload? There’s a potential interaction there.
3 Likes
That fix worked- serializer was sending a string instead of a dict for dedup_key. Redeployed with the change, incidents are no longer duplicated. 15 min job.
Apologies if this is a basic question. How do I confirm the data action is actually sending the correct payload to the Events API? We’ve noticed some issues with the serialization before, so maybe the data is incorrect before it gets to PagerDuty.
It’s possible the issue is not with the serializer, but a setting in the data action configuration-one gotcha is that the content type must be set to application/json.
purecloud-platform-client-sdk doesn’t validate the dedup_key type before the request hits the wire. It’s a known pain point where the SDK just passes the object as-is. To verify the actual outbound payload without guessing, check the Data Action logs for the requestBody JSON string.