Public/Invoke-GCProcessAutomationTriggerTest.ps1

<#
.SYNOPSIS
    Tests a process automation trigger.

.DESCRIPTION
    Sends a test event to the specified process automation trigger in Genesys Cloud.
    Uses the POST /api/v2/processautomation/triggers/{triggerId}/test endpoint.

.PARAMETER TriggerId
    The unique identifier of the trigger to test.

.PARAMETER Body
    The test event body to send to the trigger.

.EXAMPLE
    $testBody = @{ eventBody = @{ id = 'test-id' } }
    Invoke-GCProcessAutomationTriggerTest -TriggerId 'a1b2c3d4-e5f6-7890-abcd-ef1234567890' -Body $testBody

.NOTES
    Genesys Cloud API: POST /api/v2/processautomation/triggers/{triggerId}/test
#>

function Invoke-GCProcessAutomationTriggerTest {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory = $true)]
        [string]$TriggerId,

        [Parameter(Mandatory = $true)]
        [object]$Body
    )

    $endpoint = "processautomation/triggers/$TriggerId/test"
    return Invoke-GCApiRequest -Endpoint $endpoint -Method POST -Body $Body
}