Amazon Chime SDK Messaging

2023/06/22 - Amazon Chime SDK Messaging - 3 updated api methods

Changes  ChannelMessages can be made visible to sender and intended recipient rather than all channel members with the target attribute. For example, a user can send messages to a bot and receive messages back in a group channel without other members seeing them.

GetChannelMessage (updated) Link ¶
Changes (response)
{'ChannelMessage': {'Target': [{'MemberArn': 'string'}]}}

Gets the full details of a channel message.

Note

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

client.get_channel_message(
    ChannelArn='string',
    MessageId='string',
    ChimeBearer='string',
    SubChannelId='string'
)
type ChannelArn

string

param ChannelArn

[REQUIRED]

The ARN of the channel.

type MessageId

string

param MessageId

[REQUIRED]

The ID of the message.

type ChimeBearer

string

param ChimeBearer

[REQUIRED]

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

type SubChannelId

string

param SubChannelId

The ID of the SubChannel in the request.

Note

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

rtype

dict

returns

Response Syntax

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

Response Structure

  • (dict) --

    • ChannelMessage (dict) --

      The details of and content in the message.

      • ChannelArn (string) --

        The ARN of the channel.

      • MessageId (string) --

        The ID of a 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 message metadata.

      • Type (string) --

        The message type.

      • CreatedTimestamp (datetime) --

        The time at which the message was created.

      • LastEditedTimestamp (datetime) --

        The time at which a message was edited.

      • LastUpdatedTimestamp (datetime) --

        The time at which a message was updated.

      • Sender (dict) --

        The message sender.

        • Arn (string) --

          The ARN in an Identity.

        • Name (string) --

          The name in an Identity.

      • Redacted (boolean) --

        Hides the content of a message.

      • Persistence (string) --

        The persistence setting for a channel message.

      • Status (dict) --

        The status of the channel message.

        • 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) --

      • SubChannelId (string) --

        The ID of the SubChannel.

      • ContentType (string) --

        The content type of the channel message. 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.

ListChannelMessages (updated) Link ¶
Changes (response)
{'ChannelMessages': {'Target': [{'MemberArn': 'string'}]}}

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

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'
)
type ChannelArn

string

param ChannelArn

[REQUIRED]

The ARN of the channel.

type SortOrder

string

param SortOrder

The order in which you want messages sorted. Default is Descending, based on time created.

type NotBefore

datetime

param NotBefore

The initial or starting time stamp for your requested messages.

type NotAfter

datetime

param NotAfter

The final or ending time stamp for your requested messages.

type MaxResults

integer

param MaxResults

The maximum number of messages that you want returned.

type NextToken

string

param NextToken

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

type ChimeBearer

string

param ChimeBearer

[REQUIRED]

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

type SubChannelId

string

param SubChannelId

The ID of the SubChannel in the request.

Note

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

rtype

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.

SendChannelMessage (updated) Link ¶
Changes (request)
{'Target': [{'MemberArn': 'string'}]}

Sends a message to a particular channel that the member is a part of.

Note

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.

Also, STANDARD messages can be up to 4KB in size and contain metadata. Metadata is arbitrary, and you can use it in a variety of ways, such as containing a link to an attachment.

CONTROL messages are limited to 30 bytes and do not contain metadata.

See also: AWS API Documentation

Request Syntax

client.send_channel_message(
    ChannelArn='string',
    Content='string',
    Type='STANDARD'|'CONTROL',
    Persistence='PERSISTENT'|'NON_PERSISTENT',
    Metadata='string',
    ClientRequestToken='string',
    ChimeBearer='string',
    PushNotification={
        'Title': 'string',
        'Body': 'string',
        'Type': 'DEFAULT'|'VOIP'
    },
    MessageAttributes={
        'string': {
            'StringValues': [
                'string',
            ]
        }
    },
    SubChannelId='string',
    ContentType='string',
    Target=[
        {
            'MemberArn': 'string'
        },
    ]
)
type ChannelArn

string

param ChannelArn

[REQUIRED]

The ARN of the channel.

type Content

string

param Content

[REQUIRED]

The content of the channel message.

type Type

string

param Type

[REQUIRED]

The type of message, STANDARD or CONTROL .

STANDARD messages can be up to 4KB in size and contain metadata. Metadata is arbitrary, and you can use it in a variety of ways, such as containing a link to an attachment.

CONTROL messages are limited to 30 bytes and do not contain metadata.

type Persistence

string

param Persistence

[REQUIRED]

Boolean that controls whether the message is persisted on the back end. Required.

type Metadata

string

param Metadata

The optional metadata for each message.

type ClientRequestToken

string

param ClientRequestToken

[REQUIRED]

The Idempotency token for each client request.

This field is autopopulated if not provided.

type ChimeBearer

string

param ChimeBearer

[REQUIRED]

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

type PushNotification

dict

param PushNotification

The push notification configuration of the message.

  • Title (string) --

    The title of the push notification.

  • Body (string) --

    The body of the push notification.

  • Type (string) --

    Enum value that indicates the type of the push notification for a message. DEFAULT : Normal mobile push notification. VOIP : VOIP mobile push notification.

type MessageAttributes

dict

param MessageAttributes

The attributes for the message, used for message filtering along with a FilterRule defined in the PushNotificationPreferences .

  • (string) --

    • (dict) --

      A list of message attribute values.

      • StringValues (list) --

        The strings in a message attribute value.

        • (string) --

type SubChannelId

string

param SubChannelId

The ID of the SubChannel in the request.

type ContentType

string

param ContentType

The content type of the channel message.

type Target

list

param Target

The target of a message. Must be a member of the channel, such as another user, a bot, or the sender. 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.

rtype

dict

returns

Response Syntax

{
    'ChannelArn': 'string',
    'MessageId': 'string',
    'Status': {
        'Value': 'SENT'|'PENDING'|'FAILED'|'DENIED',
        'Detail': 'string'
    },
    'SubChannelId': 'string'
}

Response Structure

  • (dict) --

    • ChannelArn (string) --

      The ARN of the channel.

    • MessageId (string) --

      The ID string assigned to each message.

    • Status (dict) --

      The status of the channel message.

      • Value (string) --

        The message status value.

      • Detail (string) --

        Contains more details about the message status.

    • SubChannelId (string) --

      The ID of the SubChannel in the response.