list_channel_messages

Chime.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'
)
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) -- The AppInstanceUserArn of the user that makes the API call.
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
        },
    ]
}

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.

Exceptions

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