ChimeSDKMessaging / Client / list_channel_messages

list_channel_messages#

ChimeSDKMessaging.Client.list_channel_messages(**kwargs)#

List all the messages in a channel. Returns a paginated list of ChannelMessages. By default, sorted by creation timestamp in descending order.

Note

Redacted messages appear in the results as empty, since they are only redacted, not deleted. Deleted messages do not appear in the results. This action always returns the latest version of an edited message.

Also, the x-amz-chime-bearer request header is mandatory. Use the ARN of the AppInstanceUser or AppInstanceBot that makes the API call as the value in the header.

See also: AWS API Documentation

Request Syntax

response = client.list_channel_messages(
    ChannelArn='string',
    SortOrder='ASCENDING'|'DESCENDING',
    NotBefore=datetime(2015, 1, 1),
    NotAfter=datetime(2015, 1, 1),
    MaxResults=123,
    NextToken='string',
    ChimeBearer='string',
    SubChannelId='string'
)
Parameters:
  • ChannelArn (string) –

    [REQUIRED]

    The ARN of the channel.

  • SortOrder (string) – The order in which you want messages sorted. Default is Descending, based on time created.

  • NotBefore (datetime) – The initial or starting time stamp for your requested messages.

  • NotAfter (datetime) – The final or ending time stamp for your requested messages.

  • MaxResults (integer) – The maximum number of messages that you want returned.

  • NextToken (string) – The token passed by previous API calls until all requested messages are returned.

  • ChimeBearer (string) –

    [REQUIRED]

    The ARN of the AppInstanceUser or AppInstanceBot that makes the API call.

  • SubChannelId (string) –

    The ID of the SubChannel in the request.

    Note

    Only required when listing the messages in a SubChannel that the user belongs to.

Return type:

dict

Returns:

Response Syntax

{
    'ChannelArn': 'string',
    'NextToken': 'string',
    'ChannelMessages': [
        {
            'MessageId': 'string',
            'Content': 'string',
            'Metadata': 'string',
            'Type': 'STANDARD'|'CONTROL',
            'CreatedTimestamp': datetime(2015, 1, 1),
            'LastUpdatedTimestamp': datetime(2015, 1, 1),
            'LastEditedTimestamp': datetime(2015, 1, 1),
            'Sender': {
                'Arn': 'string',
                'Name': 'string'
            },
            'Redacted': True|False,
            'Status': {
                'Value': 'SENT'|'PENDING'|'FAILED'|'DENIED',
                'Detail': 'string'
            },
            'MessageAttributes': {
                'string': {
                    'StringValues': [
                        'string',
                    ]
                }
            },
            'ContentType': 'string',
            'Target': [
                {
                    'MemberArn': 'string'
                },
            ]
        },
    ],
    'SubChannelId': 'string'
}

Response Structure

  • (dict) –

    • ChannelArn (string) –

      The ARN of the channel containing the requested messages.

    • NextToken (string) –

      The token passed by previous API calls until all requested messages are returned.

    • ChannelMessages (list) –

      The information about, and content of, each requested message.

      • (dict) –

        Summary of the messages in a Channel.

        • MessageId (string) –

          The ID of the message.

        • Content (string) –

          The content of the channel message. For Amazon Lex V2 bot responses, this field holds a list of messages originating from the bot. For more information, refer to Processing responses from an AppInstanceBot in the Amazon Chime SDK Messaging Developer Guide.

        • Metadata (string) –

          The metadata of the message.

        • Type (string) –

          The type of message.

        • CreatedTimestamp (datetime) –

          The time at which the message summary was created.

        • LastUpdatedTimestamp (datetime) –

          The time at which a message was last updated.

        • LastEditedTimestamp (datetime) –

          The time at which a message was last edited.

        • Sender (dict) –

          The message sender.

          • Arn (string) –

            The ARN in an Identity.

          • Name (string) –

            The name in an Identity.

        • Redacted (boolean) –

          Indicates whether a message was redacted.

        • Status (dict) –

          The message status. The status value is SENT for messages sent to a channel without a channel flow. For channels associated with channel flow, the value determines the processing stage.

          • Value (string) –

            The message status value.

          • Detail (string) –

            Contains more details about the message status.

        • MessageAttributes (dict) –

          The attributes for the channel message. For Amazon Lex V2 bot responses, the attributes are mapped to specific fields from the bot. For more information, refer to Processing responses from an AppInstanceBot in the Amazon Chime SDK Messaging Developer Guide.

          • (string) –

            • (dict) –

              A list of message attribute values.

              • StringValues (list) –

                The strings in a message attribute value.

                • (string) –

        • ContentType (string) –

          The content type of the channel message listed in the summary. For Amazon Lex V2 bot responses, the content type is application/amz-chime-lex-msgs for success responses and application/amz-chime-lex-error for failure responses. For more information, refer to Processing responses from an AppInstanceBot in the Amazon Chime SDK Messaging Developer Guide.

        • Target (list) –

          The target of a message, a sender, a user, or a bot. Only the target and the sender can view targeted messages. Only users who can see targeted messages can take actions on them. However, administrators can delete targeted messages that they can’t see.

          • (dict) –

            The target of a message, a sender, a user, or a bot. Only the target and the sender can view targeted messages. Only users who can see targeted messages can take actions on them. However, administrators can delete targeted messages that they can’t see.

            • MemberArn (string) –

              The ARN of the target channel member.

    • SubChannelId (string) –

      The ID of the SubChannel in the response.

Exceptions