Skip to content

create_message_template_version

create_message_template_version(
    knowledge_base_id: UuidOrArn,
    message_template_id: UuidOrArnOrEitherWithQualifier,
    *,
    config_overrides: Optional[QConnectClientConfig] = None,
    message_template_content_sha256: Optional[MessageTemplateContentSha256] = None,
) -> CreateMessageTemplateVersionResponse

Creates a new Amazon Q in Connect message template version from the current content and configuration of a message template. Versions are immutable and monotonically increasing. Once a version is created, you can reference a specific version of the message template by passing in <message-template-id>:<versionNumber> as the message template identifier. An error is displayed if the supplied messageTemplateContentSha256 is different from the messageTemplateContentSha256 of the message template with $LATEST qualifier. If multiple CreateMessageTemplateVersion requests are made while the message template remains the same, only the first invocation creates a new version and the succeeding requests will return the same response as the first invocation.

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.

  • message_template_content_sha256 (Optional[MessageTemplateContentSha256], default: None ) –

    The checksum value of the message template content that is referenced by the $LATEST qualifier. It can be returned in MessageTemplateData or ExtendedMessageTemplateData. It’s calculated by content, language, defaultAttributes and Attachments of the message template. If not supplied, the message template version will be created based on the message template content that is referenced by the $LATEST qualifier by default.

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.

  • ServiceQuotaExceededException –

    You've exceeded your service quota. To perform the requested action, remove some of the relevant resources, or use service quotas to request a service quota increase.

  • 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/q_connect.py
def create_message_template_version(
    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[QConnectClientConfig] = None,
    message_template_content_sha256: Optional[
        "capo_qconnect.types.message_template_content_sha256.MessageTemplateContentSha256"
    ] = None,
) -> "capo_qconnect.types.create_message_template_version_response.CreateMessageTemplateVersionResponse":
    """<p>Creates a new Amazon Q in Connect message template version from the current content and configuration of a message template. Versions are immutable and monotonically increasing. Once a version is created, you can reference a specific version of the message template by passing in <code>&lt;message-template-id&gt;:&lt;versionNumber&gt;</code> as the message template identifier. An error is displayed if the supplied <code>messageTemplateContentSha256</code> is different from the <code>messageTemplateContentSha256</code> of the message template with <code>$LATEST</code> qualifier. If multiple <code>CreateMessageTemplateVersion</code> requests are made while the message template remains the same, only the first invocation creates a new version and the succeeding requests will return the same response as the first invocation.</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>
        message_template_content_sha256: <p>The checksum value of the message template content that is referenced by the <code>$LATEST</code> qualifier. It can be returned in <code>MessageTemplateData</code> or <code>ExtendedMessageTemplateData</code>. It’s calculated by content, language, <code>defaultAttributes</code> and <code>Attachments</code> of the message template. If not supplied, the message template version will be created based on the message template content that is referenced by the <code>$LATEST</code> qualifier by default.</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.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>You've exceeded your service quota. To perform the requested action, remove some of the relevant resources, or use service quotas to request a service quota increase.</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.
    """

    def _handler(
        req: "OperationRequest[capo_qconnect.types.create_message_template_version_request.CreateMessageTemplateVersionRequest]",
    ) -> OperationResponse[
        "capo_qconnect.types.create_message_template_version_response.CreateMessageTemplateVersionResponse"
    ]:
        import capo_qconnect._operations.wisdom_service.create_message_template_version

        output, http_response = (
            capo_qconnect._operations.wisdom_service.create_message_template_version.create_message_template_version(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

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

        return capo_qconnect.types.create_message_template_version_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "CreateMessageTemplateVersion", redact_output=_redact_output
        ),
    )
    input_: capo_qconnect.types.create_message_template_version_request.CreateMessageTemplateVersionRequest = {
        "knowledge_base_id": knowledge_base_id,
        "message_template_id": message_template_id,
    }
    if message_template_content_sha256 is not None:
        input_["message_template_content_sha256"] = message_template_content_sha256

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output