Public/Get-GCConversationsChatMessages.ps1

<#
.SYNOPSIS
    Retrieves chat messages for a chat conversation communication.

.DESCRIPTION
    Gets the list of chat messages within a specific chat conversation and communication.
    Calls GET /api/v2/conversations/chats/{conversationId}/communications/{communicationId}/messages.

.PARAMETER ConversationId
    The unique identifier of the chat conversation.

.PARAMETER CommunicationId
    The unique identifier of the communication within the conversation.

.EXAMPLE
    Get-GCConversationsChatMessages -ConversationId 'conv-id' -CommunicationId 'comm-id'

.NOTES
    Genesys Cloud API: GET /api/v2/conversations/chats/{conversationId}/communications/{communicationId}/messages
#>

function Get-GCConversationsChatMessages {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory = $true)]
        [string]$ConversationId,

        [Parameter(Mandatory = $true)]
        [string]$CommunicationId
    )

    $endpoint = "conversations/chats/$ConversationId/communications/$CommunicationId/messages"
    return Invoke-GCApiRequest -Endpoint $endpoint -Method GET
}