createMessageTemplate method
- required ChannelSubtype channelSubtype,
- required String knowledgeBaseId,
- String? clientToken,
- MessageTemplateContentProvider? content,
- MessageTemplateAttributes? defaultAttributes,
- String? description,
- GroupingConfiguration? groupingConfiguration,
- String? language,
- String? name,
- MessageTemplateSourceConfiguration? sourceConfiguration,
- Map<
String, String> ? tags,
Creates an Amazon Q in Connect message template. The name of the message
template has to be unique for each knowledge base. The channel subtype of
the message template is immutable and cannot be modified after creation.
After the message template is created, you can use the
$LATEST qualifier to reference the created message template.
May throw AccessDeniedException.
May throw ConflictException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter channelSubtype :
The channel subtype this message template applies to.
Parameter knowledgeBaseId :
The identifier of the knowledge base. Can be either the ID or the ARN.
URLs cannot contain the ARN.
Parameter clientToken :
A unique, case-sensitive identifier that you provide to ensure the
idempotency of the request. If not provided, the Amazon Web Services SDK
populates this field. For more information about idempotency, see Making
retries safe with idempotent APIs.
Parameter content :
The content of the message template.
Parameter defaultAttributes :
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.
Parameter description :
The description of the message template.
Parameter language :
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
Parameter name :
The name of the message template.
Parameter sourceConfiguration :
The source configuration of the message template. Only set this argument
for WHATSAPP channel subtype.
Parameter tags :
The tags used to organize, track, or control access for this resource.
Implementation
Future<CreateMessageTemplateResponse> createMessageTemplate({
required ChannelSubtype channelSubtype,
required String knowledgeBaseId,
String? clientToken,
MessageTemplateContentProvider? content,
MessageTemplateAttributes? defaultAttributes,
String? description,
GroupingConfiguration? groupingConfiguration,
String? language,
String? name,
MessageTemplateSourceConfiguration? sourceConfiguration,
Map<String, String>? tags,
}) async {
final $payload = <String, dynamic>{
'channelSubtype': channelSubtype.value,
'clientToken': clientToken ?? _s.generateIdempotencyToken(),
if (content != null) 'content': content,
if (defaultAttributes != null) 'defaultAttributes': defaultAttributes,
if (description != null) 'description': description,
if (groupingConfiguration != null)
'groupingConfiguration': groupingConfiguration,
if (language != null) 'language': language,
if (name != null) 'name': name,
if (sourceConfiguration != null)
'sourceConfiguration': sourceConfiguration,
if (tags != null) 'tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri:
'/knowledgeBases/${Uri.encodeComponent(knowledgeBaseId)}/messageTemplates',
exceptionFnMap: _exceptionFns,
);
return CreateMessageTemplateResponse.fromJson(response);
}