Skip to main content

message_templates

Creates, updates, deletes, gets or lists a message_templates resource.

Overview

Namemessage_templates
TypeResource
Idaws.qconnect.message_templates

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
namestringThe name of the message template. (pattern: <code>[a-zA-Z0-9\s_.,-]+.*</code>)
attachmentsarrayThe message template attachments.
attribute_typesarrayThe types of attributes contain the message template.
channelstringThe channel of the message template.
channel_subtypestringThe channel subtype this message template applies to. (EMAIL, SMS, WHATSAPP, PUSH)
contentobjectThe container of message template content.
created_timestring (date-time)The timestamp when the message template was created.
default_attributesobjectThe attributes that are used with the message template.
descriptionstringThe description of the message template. (pattern: <code>[a-zA-Z0-9\s_.,-]+.*</code>)
grouping_configurationobjectThe configuration information of the grouping of Amazon Q in Connect users.
is_activebooleanWhether the version of the message template is activated.
knowledge_base_arnstringThe Amazon Resource Name (ARN) of the knowledge base. (pattern: <code>arn:[a-z-]?:wisdom:[a-z0-9-]?:[0-9]{12}:[a-z-]*?/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}(?:/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}){0,2}</code>)
knowledge_base_idstringThe identifier of the knowledge base. (pattern: <code>[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}</code>)
languagestringThe 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
last_modified_bystringThe Amazon Resource Name (ARN) of the user who last updated the message template data. (pattern: <code>arn:[a-z-]+?:[a-z-]+?:[a-z0-9-]*?:([0-9]{12})?:[a-zA-Z0-9-:/]+</code>)
last_modified_timestring (date-time)The timestamp when the message template data was last modified.
message_template_arnstringThe Amazon Resource Name (ARN) of the message template. (pattern: <code>arn:[a-z-]?:wisdom:[a-z0-9-]?:[0-9]{12}:[a-z-]*?/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}(?:/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}){0,2}(:[A-Z0-9_$]+){0,1}</code>)
message_template_content_sha_256stringThe 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. (pattern: <code>[a-zA-Z0-9]+</code>)
message_template_idstringThe identifier of the message template. (pattern: <code>[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}</code>)
source_configuration_summaryobjectThe source configuration summary of the message template.
tagsobjectThe tags used to organize, track, or control access for this resource.
version_numberinteger (int64)The version number of the message template version.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_message_templateselectmessage_template_id, knowledge_base_id, regionRetrieves the Amazon Q in Connect message template. The message template identifier can contain an optional qualifier, for example, <message-template-id>:<qualifier>, which is either an actual version number or an Amazon Q Connect managed qualifier $ACTIVE_VERSION | $LATEST. If it is not supplied, then $LATEST is assumed implicitly.
search_message_templatesselectknowledge_base_id, regionnextToken, maxResultsSearches for Amazon Q in Connect message templates in the specified knowledge base.
list_message_templatesselectknowledge_base_id, regionnextToken, maxResultsLists all the available Amazon Q in Connect message templates for the specified knowledge base.
create_message_template_attachmentinsertknowledge_base_id, message_template_id, region, contentDisposition, name, bodyUploads an attachment file to the specified Amazon Q in Connect message template. The name of the message template attachment has to be unique for each message template referenced by the $LATEST qualifier. The body of the attachment file should be encoded using base64 encoding. After the file is uploaded, you can use the pre-signed Amazon S3 URL returned in response to download the uploaded file.
create_message_templateinsertknowledge_base_id, region, channelSubtypeCreates 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.
update_message_templateupdateknowledge_base_id, message_template_id, regionUpdates 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.
delete_message_template_attachmentdeleteknowledge_base_id, message_template_id, attachment_id, regionDeletes the attachment file from the Amazon Q in Connect message template that is referenced by $LATEST qualifier. Attachments on available message template versions will remain unchanged.
delete_message_templatedeleteknowledge_base_id, message_template_id, regionDeletes an Amazon Q in Connect message template entirely or a specific version of the message template if version is supplied in the request. You can provide the message template identifier as <message-template-id>:<versionNumber> to delete a specific version of the message template. If it is not supplied, the message template and all available versions will be deleted.
render_message_templateexecknowledge_base_id, message_template_id, region, attributesRenders 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.
update_message_template_metadataexecknowledge_base_id, message_template_id, regionUpdates the Amazon Q in Connect message template metadata. Note that any modification to the message template’s name, description and grouping configuration will applied to the message template pointed by the $LATEST qualifier and all available versions. Partial update is supported. If any field is not supplied, it will remain unchanged for the message template.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
attachment_idstringThe identifier of the attachment file.
knowledge_base_idstringThe identifier of the knowledge base. Can be either the ID or the ARN. URLs cannot contain the ARN.
message_template_idstringThe identifier of the message template. Can be either the ID or the ARN. It cannot contain any qualifier.
regionstringAWS region (default: us-east-1)
maxResultsintegerThe maximum number of results to return per page.
nextTokenstringThe token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.

SELECT examples

Retrieves the Amazon Q in Connect message template. The message template identifier can contain an optional qualifier, for example, <message-template-id>:<qualifier>, which is either an actual version number or an Amazon Q Connect managed qualifier $ACTIVE_VERSION | $LATEST. If it is not supplied, then $LATEST is assumed implicitly.

SELECT
name,
attachments,
attribute_types,
channel,
channel_subtype,
content,
created_time,
default_attributes,
description,
grouping_configuration,
is_active,
knowledge_base_arn,
knowledge_base_id,
language,
last_modified_by,
last_modified_time,
message_template_arn,
message_template_content_sha_256,
message_template_id,
source_configuration_summary,
tags,
version_number
FROM aws.qconnect.message_templates
WHERE message_template_id = '{{ message_template_id }}' -- required
AND knowledge_base_id = '{{ knowledge_base_id }}' -- required
AND region = '{{ region }}' -- required
;

INSERT examples

Uploads an attachment file to the specified Amazon Q in Connect message template. The name of the message template attachment has to be unique for each message template referenced by the $LATEST qualifier. The body of the attachment file should be encoded using base64 encoding. After the file is uploaded, you can use the pre-signed Amazon S3 URL returned in response to download the uploaded file.

INSERT INTO aws.qconnect.message_templates (
contentDisposition,
name,
body,
clientToken,
knowledge_base_id,
message_template_id,
region
)
SELECT
'{{ contentDisposition }}' /* required */,
'{{ name }}' /* required */,
'{{ body }}' /* required */,
'{{ clientToken }}',
'{{ knowledge_base_id }}',
'{{ message_template_id }}',
'{{ region }}'
RETURNING
attachment
;

UPDATE examples

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.

UPDATE aws.qconnect.message_templates
SET
content = '{{ content }}',
language = '{{ language }}',
sourceConfiguration = '{{ sourceConfiguration }}',
defaultAttributes = '{{ defaultAttributes }}'
WHERE
knowledge_base_id = '{{ knowledge_base_id }}' --required
AND message_template_id = '{{ message_template_id }}' --required
AND region = '{{ region }}' --required
RETURNING
message_template;

DELETE examples

Deletes the attachment file from the Amazon Q in Connect message template that is referenced by $LATEST qualifier. Attachments on available message template versions will remain unchanged.

DELETE FROM aws.qconnect.message_templates
WHERE knowledge_base_id = '{{ knowledge_base_id }}' --required
AND message_template_id = '{{ message_template_id }}' --required
AND attachment_id = '{{ attachment_id }}' --required
AND region = '{{ region }}' --required
;

Lifecycle Methods

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.

EXEC aws.qconnect.message_templates.render_message_template
@knowledge_base_id='{{ knowledge_base_id }}' --required,
@message_template_id='{{ message_template_id }}' --required,
@region='{{ region }}' --required
@@json=
'{
"attributes": "{{ attributes }}"
}'
;