Skip to content

update_message_template async

update_message_template(
    knowledge_base_id: UuidOrArn,
    message_template_id: UuidOrArnOrEitherWithQualifier,
    *,
    config_overrides: Optional[AsyncQConnectClientConfig] = None,
    content: Optional[MessageTemplateContentProvider] = None,
    language: Optional[LanguageCode] = None,
    source_configuration: Optional[MessageTemplateSourceConfiguration] = None,
    default_attributes: Optional[MessageTemplateAttributes] = None,
) -> UpdateMessageTemplateResponse

Updates the Amazon Q in Connect message template. Partial update is supported. If any field is not supplied, it will remain unchanged for the message template that is referenced by the $LATEST qualifier. Any modification will only apply to the message template that is referenced by the $LATEST qualifier. The fields for all available versions will remain unchanged.

Parameters:

  • knowledge_base_id (UuidOrArn) –

    The identifier of the knowledge base. Can be either the ID or the ARN. URLs cannot contain the ARN.

  • message_template_id (UuidOrArnOrEitherWithQualifier) –

    The identifier of the message template. Can be either the ID or the ARN. It cannot contain any qualifier.

  • content (Optional[MessageTemplateContentProvider], default: None ) –

    The content of the message template.

  • language (Optional[LanguageCode], default: None ) –

    The language code value for the language in which the quick response is written. The supported language codes include de_DE, en_US, es_ES, fr_FR, id_ID, it_IT, ja_JP, ko_KR, pt_BR, zh_CN, zh_TW

  • source_configuration (Optional[MessageTemplateSourceConfiguration], default: None ) –

    The source configuration of the message template. Only set this argument for WHATSAPP channel subtype.

  • default_attributes (Optional[MessageTemplateAttributes], default: None ) –

    An object that specifies the default values to use for variables in the message template. This object contains different categories of key-value pairs. Each key defines a variable or placeholder in the message template. The corresponding value defines the default value for that variable.

Raises:

  • AccessDeniedException –

    You do not have sufficient access to perform this action.

  • ConflictException –

    The request could not be processed because of conflict in the current state of the resource. For example, if you're using a Create API (such as CreateAssistant) that accepts name, a conflicting resource (usually with the same name) is being created or mutated.

  • ResourceNotFoundException –

    The specified resource does not exist.

  • ThrottlingException –

    The throttling limit has been exceeded.

  • ValidationException –

    The input fails to satisfy the constraints specified by a service.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_qconnect/_services/async_q_connect.py
async def update_message_template(
    self,
    knowledge_base_id: "capo_qconnect.types.uuid_or_arn.UuidOrArn",
    message_template_id: "capo_qconnect.types.uuid_or_arn_or_either_with_qualifier.UuidOrArnOrEitherWithQualifier",
    *,
    config_overrides: Optional[AsyncQConnectClientConfig] = None,
    content: Optional[
        "capo_qconnect.types.message_template_content_provider.MessageTemplateContentProvider"
    ] = None,
    language: Optional["capo_qconnect.types.language_code.LanguageCode"] = None,
    source_configuration: Optional[
        "capo_qconnect.types.message_template_source_configuration.MessageTemplateSourceConfiguration"
    ] = None,
    default_attributes: Optional[
        "capo_qconnect.types.message_template_attributes.MessageTemplateAttributes"
    ] = None,
) -> "capo_qconnect.types.update_message_template_response.UpdateMessageTemplateResponse":
    """<p>Updates the Amazon Q in Connect message template. Partial update is supported. If any field is not supplied, it will remain unchanged for the message template that is referenced by the <code>$LATEST</code> qualifier. Any modification will only apply to the message template that is referenced by the <code>$LATEST</code> qualifier. The fields for all available versions will remain unchanged.</p>

    Args:
        knowledge_base_id: <p>The identifier of the knowledge base. Can be either the ID or the ARN. URLs cannot contain the ARN.</p>
        message_template_id: <p>The identifier of the message template. Can be either the ID or the ARN. It cannot contain any qualifier.</p>
        content: <p>The content of the message template.</p>
        language: <p>The language code value for the language in which the quick response is written. The supported language codes include <code>de_DE</code>, <code>en_US</code>, <code>es_ES</code>, <code>fr_FR</code>, <code>id_ID</code>, <code>it_IT</code>, <code>ja_JP</code>, <code>ko_KR</code>, <code>pt_BR</code>, <code>zh_CN</code>, <code>zh_TW</code> </p>
        source_configuration: <p>The source configuration of the message template. Only set this argument for WHATSAPP channel subtype.</p>
        default_attributes: <p>An object that specifies the default values to use for variables in the message template. This object contains different categories of key-value pairs. Each key defines a variable or placeholder in the message template. The corresponding value defines the default value for that variable.</p>

    Raises:
        capo_qconnect.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_qconnect.errors.conflict_exception.ConflictException: <p>The request could not be processed because of conflict in the current state of the resource. For example, if you're using a <code>Create</code> API (such as <code>CreateAssistant</code>) that accepts name, a conflicting resource (usually with the same name) is being created or mutated.</p>
        capo_qconnect.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
        capo_qconnect.errors.throttling_exception.ThrottlingException: <p>The throttling limit has been exceeded.</p>
        capo_qconnect.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by a service.</p>
        capo_qconnect.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_qconnect.types.update_message_template_request.UpdateMessageTemplateRequest]",
    ) -> AsyncOperationResponse[
        "capo_qconnect.types.update_message_template_response.UpdateMessageTemplateResponse"
    ]:
        import capo_qconnect._operations.wisdom_service.update_message_template

        (
            output,
            http_response,
        ) = await capo_qconnect._operations.wisdom_service.update_message_template.async_update_message_template(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_qconnect.types.update_message_template_request.UpdateMessageTemplateRequest",
    ) -> dict[str, Any]:
        import capo_qconnect.types.update_message_template_request

        return capo_qconnect.types.update_message_template_request.redact_sensitive(
            input_
        )

    def _redact_output(
        output: "capo_qconnect.types.update_message_template_response.UpdateMessageTemplateResponse",
    ) -> dict[str, Any]:
        import capo_qconnect.types.update_message_template_response

        return (
            capo_qconnect.types.update_message_template_response.redact_sensitive(
                output
            )
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "UpdateMessageTemplate",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_qconnect.types.update_message_template_request.UpdateMessageTemplateRequest = {
        "knowledge_base_id": knowledge_base_id,
        "message_template_id": message_template_id,
    }
    if content is not None:
        input_["content"] = content
    if language is not None:
        input_["language"] = language
    if source_configuration is not None:
        input_["source_configuration"] = source_configuration
    if default_attributes is not None:
        input_["default_attributes"] = default_attributes

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