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 AppInstanceUserArn of the user that makes the API call as the value in the header.

Also, STANDARD messages can contain 4KB of data and the 1KB of metadata. CONTROL messages can contain 30 bytes of data and no 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'
)
Parameters
  • ChannelArn (string) --

    [REQUIRED]

    The ARN of the channel.

  • Content (string) --

    [REQUIRED]

    The content of the message.

  • Type (string) --

    [REQUIRED]

    The type of message, STANDARD or CONTROL .

  • 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 AppInstanceUserArn of the user 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.
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 messasge status.

    • SubChannelId (string) --

      The ID of the SubChannel in the response.

Exceptions

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