Skip to content

update_channel_message async

update_channel_message(
    channel_arn: ChimeArn,
    message_id: MessageId,
    content: NonEmptyContent,
    chime_bearer: ChimeArn,
    *,
    config_overrides: Optional[AsyncChimeSDKMessagingClientConfig] = None,
    metadata: Optional[Metadata] = None,
    sub_channel_id: Optional[SubChannelId] = None,
    content_type: Optional[ContentType] = None,
) -> UpdateChannelMessageResponse

Updates the content of a message.

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.

Parameters:

  • channel_arn (ChimeArn) –

    The ARN of the channel.

  • message_id (MessageId) –

    The ID string of the message being updated.

  • content (NonEmptyContent) –

    The content of the channel message.

  • metadata (Optional[Metadata], default: None ) –

    The metadata of the message being updated.

  • chime_bearer (ChimeArn) –

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

  • sub_channel_id (Optional[SubChannelId], default: None ) –

    The ID of the SubChannel in the request.

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

  • content_type (Optional[ContentType], default: None ) –

    The content type of the channel message.

Raises:

Source code in docs_src/capo_chime_sdk_messaging/_services/async_chime_sdk_messaging.py
async def update_channel_message(
    self,
    channel_arn: "capo_chime_sdk_messaging.types.chime_arn.ChimeArn",
    message_id: "capo_chime_sdk_messaging.types.message_id.MessageId",
    content: "capo_chime_sdk_messaging.types.non_empty_content.NonEmptyContent",
    chime_bearer: "capo_chime_sdk_messaging.types.chime_arn.ChimeArn",
    *,
    config_overrides: Optional[AsyncChimeSDKMessagingClientConfig] = None,
    metadata: Optional["capo_chime_sdk_messaging.types.metadata.Metadata"] = None,
    sub_channel_id: Optional[
        "capo_chime_sdk_messaging.types.sub_channel_id.SubChannelId"
    ] = None,
    content_type: Optional[
        "capo_chime_sdk_messaging.types.content_type.ContentType"
    ] = None,
) -> "capo_chime_sdk_messaging.types.update_channel_message_response.UpdateChannelMessageResponse":
    """<p>Updates the content of a message.</p> <note> <p>The <code>x-amz-chime-bearer</code> request header is mandatory. Use the ARN of the <code>AppInstanceUser</code> or <code>AppInstanceBot</code> that makes the API call as the value in the header.</p> </note>

    Args:
        channel_arn: <p>The ARN of the channel.</p>
        message_id: <p>The ID string of the message being updated.</p>
        content: <p>The content of the channel message. </p>
        metadata: <p>The metadata of the message being updated.</p>
        chime_bearer: <p>The ARN of the <code>AppInstanceUser</code> or <code>AppInstanceBot</code> that makes the API call.</p>
        sub_channel_id: <p>The ID of the SubChannel in the request.</p> <note> <p>Only required when updating messages in a SubChannel that the user belongs to.</p> </note>
        content_type: <p>The content type of the channel message.</p>

    Raises:
        capo_chime_sdk_messaging.errors.bad_request_exception.BadRequestException: <p>The input parameters don't match the service's restrictions.</p>
        capo_chime_sdk_messaging.errors.conflict_exception.ConflictException: <p>The request could not be processed because of conflict in the current state of the resource.</p>
        capo_chime_sdk_messaging.errors.forbidden_exception.ForbiddenException: <p>The client is permanently forbidden from making the request.</p>
        capo_chime_sdk_messaging.errors.service_failure_exception.ServiceFailureException: <p>The service encountered an unexpected error.</p>
        capo_chime_sdk_messaging.errors.service_unavailable_exception.ServiceUnavailableException: <p>The service is currently unavailable.</p>
        capo_chime_sdk_messaging.errors.throttled_client_exception.ThrottledClientException: <p>The client exceeded its request rate limit.</p>
        capo_chime_sdk_messaging.errors.unauthorized_client_exception.UnauthorizedClientException: <p>The client is not currently authorized to make the request.</p>
        capo_chime_sdk_messaging.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_chime_sdk_messaging.types.update_channel_message_request.UpdateChannelMessageRequest]",
    ) -> AsyncOperationResponse[
        "capo_chime_sdk_messaging.types.update_channel_message_response.UpdateChannelMessageResponse"
    ]:
        import capo_chime_sdk_messaging._operations.chime_messaging_service.update_channel_message

        (
            output,
            http_response,
        ) = await capo_chime_sdk_messaging._operations.chime_messaging_service.update_channel_message.async_update_channel_message(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_chime_sdk_messaging.types.update_channel_message_request.UpdateChannelMessageRequest",
    ) -> dict[str, Any]:
        import capo_chime_sdk_messaging.types.update_channel_message_request

        return capo_chime_sdk_messaging.types.update_channel_message_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("UpdateChannelMessage", redact_input=_redact_input),
    )
    input_: capo_chime_sdk_messaging.types.update_channel_message_request.UpdateChannelMessageRequest = {
        "channel_arn": channel_arn,
        "message_id": message_id,
        "content": content,
        "chime_bearer": chime_bearer,
    }
    if metadata is not None:
        input_["metadata"] = metadata
    if sub_channel_id is not None:
        input_["sub_channel_id"] = sub_channel_id
    if content_type is not None:
        input_["content_type"] = content_type

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output