Public/New-GCAlertingRule.ps1

<#
.SYNOPSIS
    Creates a new alerting rule.

.DESCRIPTION
    Creates a new alerting rule in Genesys Cloud.
    Uses the POST /api/v2/alerting/rules endpoint.

.PARAMETER Body
    The alerting rule definition object.

.EXAMPLE
    $ruleBody = @{ name = 'High Wait Time Alert'; type = 'CONVERSATION' }
    New-GCAlertingRule -Body $ruleBody

.NOTES
    Genesys Cloud API: POST /api/v2/alerting/rules
#>

function New-GCAlertingRule {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory = $true)]
        [object]$Body
    )

    $endpoint = "alerting/rules"
    return Invoke-GCApiRequest -Endpoint $endpoint -Method POST -Body $Body
}