I had this lying around from awhile ago. It is incomplete, but may be of some use?
import requests
region = "mypurecloud.com"
queue_id = "QUEUE_ID"
user_id="USER_ID"
# TODO Use Platform API SDK
url = f"https://api.{region}/api/v2/alerting/rules"
headers = {}
payload = {
"name": "Queue Occupancy Alert",
"type": "ConversationMetrics",
"enabled": True,
"notifications": [
{
"notificationTypes": ["Sms"],
"users": [{"id": user_id}]
}
],
"conditions": {
"type": "And",
"predicates": [
{
"metricType": "Instance",
"metricValueType": "Observation",
"metric": "oWaiting",
"comparisonOperator": "Gt",
"value": 10,
"entity": {
"entityType": "Queue",
"queue": {"id": queue_id}
}
}
]
}
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())
------------------------------
Lucas Woodward
Winner of Orchestrator of the Year, Developer (2025)
LinkedIn -
https://www.linkedin.com/in/lucas-woodward-the-devNewsletter -
https://makingchatbots.com------------------------------
Original Message:
Sent: 01-30-2026 12:27
From: Daniel Bernardi
Subject: Python
I need a Python code using the API for a queue occupancy alarm. Can someone help me?
#PlatformAPI
------------------------------
Daniel Bernardi
Network Designer Specialist-Cloud Applications
------------------------------