renderMessageTemplate method
Renders the Amazon Q in Connect message template based on the attribute values provided and generates the message content. For any variable present in the message template, if the attribute value is neither provided in the attribute request parameter nor the default attribute of the message template, the rendered message content will keep the variable placeholder as it is and return the attribute keys that are missing.
May throw AccessDeniedException.
May throw ResourceNotFoundException.
May throw ThrottlingException.
May throw ValidationException.
Parameter attributes :
An object that specifies the 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 value for that variable.
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.
Implementation
Future<RenderMessageTemplateResponse> renderMessageTemplate({
required MessageTemplateAttributes attributes,
required String knowledgeBaseId,
required String messageTemplateId,
}) async {
final $payload = <String, dynamic>{
'attributes': attributes,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri:
'/knowledgeBases/${Uri.encodeComponent(knowledgeBaseId)}/messageTemplates/${Uri.encodeComponent(messageTemplateId)}/render',
exceptionFnMap: _exceptionFns,
);
return RenderMessageTemplateResponse.fromJson(response);
}