createMessageTemplateVersion method
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.
May throw AccessDeniedException.
May throw ConflictException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter knowledgeBaseId :
The identifier of the knowledge base. Can be either the ID or the ARN.
URLs cannot contain the ARN.
Parameter messageTemplateId :
The identifier of the message template. Can be either the ID or the ARN.
It cannot contain any qualifier.
Parameter messageTemplateContentSha256 :
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.
Implementation
Future<CreateMessageTemplateVersionResponse> createMessageTemplateVersion({
required String knowledgeBaseId,
required String messageTemplateId,
String? messageTemplateContentSha256,
}) async {
final $payload = <String, dynamic>{
if (messageTemplateContentSha256 != null)
'messageTemplateContentSha256': messageTemplateContentSha256,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri:
'/knowledgeBases/${Uri.encodeComponent(knowledgeBaseId)}/messageTemplates/${Uri.encodeComponent(messageTemplateId)}/versions',
exceptionFnMap: _exceptionFns,
);
return CreateMessageTemplateVersionResponse.fromJson(response);
}