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 AppInstanceUserArn of the user 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 AppInstanceUserArn of the user 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',
                    ]
                }
            }
        },
    ],
    '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 message.

        • 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 messasge status.

        • MessageAttributes (dict) --

          The message attribues listed in a the summary of a channel message.

          • (string) --

            • (dict) --

              A list of message attribute values.

              • StringValues (list) --

                The strings in a message attribute value.

                • (string) --
    • SubChannelId (string) --

      The ID of the SubChannel in the response.

Exceptions

  • ChimeSDKMessaging.Client.exceptions.BadRequestException
  • ChimeSDKMessaging.Client.exceptions.ForbiddenException
  • ChimeSDKMessaging.Client.exceptions.UnauthorizedClientException
  • ChimeSDKMessaging.Client.exceptions.ThrottledClientException
  • ChimeSDKMessaging.Client.exceptions.ServiceUnavailableException
  • ChimeSDKMessaging.Client.exceptions.ServiceFailureException