ChimeSDKMessaging / Client / send_channel_message

send_channel_message#

ChimeSDKMessaging.Client.send_channel_message(**kwargs)#

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

response = 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'
        },
    ]
)
Parameters:
  • ChannelArn (string) –

    [REQUIRED]

    The ARN of the channel.

  • Content (string) –

    [REQUIRED]

    The content of the channel message.

  • Type (string) –

    [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.

  • Persistence (string) –

    [REQUIRED]

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

  • Metadata (string) – The optional metadata for each message.

  • ClientRequestToken (string) –

    [REQUIRED]

    The Idempotency token for each client request.

    This field is autopopulated if not provided.

  • ChimeBearer (string) –

    [REQUIRED]

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

  • PushNotification (dict) –

    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.

  • MessageAttributes (dict) –

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

  • SubChannelId (string) – The ID of the SubChannel in the request.

  • ContentType (string) – The content type of the channel message.

  • Target (list) –

    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.

Return type:

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.

Exceptions