QConnect / Client / create_message_template

create_message_template#

QConnect.Client.create_message_template(**kwargs)#

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.

See also: AWS API Documentation

Request Syntax

response = client.create_message_template(
    channelSubtype='EMAIL'|'SMS',
    clientToken='string',
    content={
        'email': {
            'body': {
                'html': {
                    'content': 'string'
                },
                'plainText': {
                    'content': 'string'
                }
            },
            'headers': [
                {
                    'name': 'string',
                    'value': 'string'
                },
            ],
            'subject': 'string'
        },
        'sms': {
            'body': {
                'plainText': {
                    'content': 'string'
                }
            }
        }
    },
    defaultAttributes={
        'agentAttributes': {
            'firstName': 'string',
            'lastName': 'string'
        },
        'customAttributes': {
            'string': 'string'
        },
        'customerProfileAttributes': {
            'accountNumber': 'string',
            'additionalInformation': 'string',
            'address1': 'string',
            'address2': 'string',
            'address3': 'string',
            'address4': 'string',
            'billingAddress1': 'string',
            'billingAddress2': 'string',
            'billingAddress3': 'string',
            'billingAddress4': 'string',
            'billingCity': 'string',
            'billingCountry': 'string',
            'billingCounty': 'string',
            'billingPostalCode': 'string',
            'billingProvince': 'string',
            'billingState': 'string',
            'birthDate': 'string',
            'businessEmailAddress': 'string',
            'businessName': 'string',
            'businessPhoneNumber': 'string',
            'city': 'string',
            'country': 'string',
            'county': 'string',
            'custom': {
                'string': 'string'
            },
            'emailAddress': 'string',
            'firstName': 'string',
            'gender': 'string',
            'homePhoneNumber': 'string',
            'lastName': 'string',
            'mailingAddress1': 'string',
            'mailingAddress2': 'string',
            'mailingAddress3': 'string',
            'mailingAddress4': 'string',
            'mailingCity': 'string',
            'mailingCountry': 'string',
            'mailingCounty': 'string',
            'mailingPostalCode': 'string',
            'mailingProvince': 'string',
            'mailingState': 'string',
            'middleName': 'string',
            'mobilePhoneNumber': 'string',
            'partyType': 'string',
            'phoneNumber': 'string',
            'postalCode': 'string',
            'profileARN': 'string',
            'profileId': 'string',
            'province': 'string',
            'shippingAddress1': 'string',
            'shippingAddress2': 'string',
            'shippingAddress3': 'string',
            'shippingAddress4': 'string',
            'shippingCity': 'string',
            'shippingCountry': 'string',
            'shippingCounty': 'string',
            'shippingPostalCode': 'string',
            'shippingProvince': 'string',
            'shippingState': 'string',
            'state': 'string'
        },
        'systemAttributes': {
            'customerEndpoint': {
                'address': 'string'
            },
            'name': 'string',
            'systemEndpoint': {
                'address': 'string'
            }
        }
    },
    description='string',
    groupingConfiguration={
        'criteria': 'string',
        'values': [
            'string',
        ]
    },
    knowledgeBaseId='string',
    language='string',
    name='string',
    tags={
        'string': 'string'
    }
)
Parameters:
  • channelSubtype (string) –

    [REQUIRED]

    The channel subtype this message template applies to.

  • clientToken (string) –

    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.

    This field is autopopulated if not provided.

  • content (dict) –

    [REQUIRED]

    The content of the message template.

    Note

    This is a Tagged Union structure. Only one of the following top level keys can be set: email, sms.

    • email (dict) –

      The content of the message template that applies to the email channel subtype.

      • body (dict) –

        The body to use in email messages.

        • html (dict) –

          The message body, in HTML format, to use in email messages that are based on the message template. We recommend using HTML format for email clients that render HTML content. You can include links, formatted text, and more in an HTML message.

          Note

          This is a Tagged Union structure. Only one of the following top level keys can be set: content.

          • content (string) –

            The content of the message template.

        • plainText (dict) –

          The message body, in plain text format, to use in email messages that are based on the message template. We recommend using plain text format for email clients that don’t render HTML content and clients that are connected to high-latency networks, such as mobile devices.

          Note

          This is a Tagged Union structure. Only one of the following top level keys can be set: content.

          • content (string) –

            The content of the message template.

      • headers (list) –

        The email headers to include in email messages.

        • (dict) –

          The email header to include in email messages.

          • name (string) –

            The name of the email header.

          • value (string) –

            The value of the email header.

      • subject (string) –

        The subject line, or title, to use in email messages.

    • sms (dict) –

      The content of the message template that applies to the SMS channel subtype.

      • body (dict) –

        The body to use in SMS messages.

        • plainText (dict) –

          The message body to use in SMS messages.

          Note

          This is a Tagged Union structure. Only one of the following top level keys can be set: content.

          • content (string) –

            The content of the message template.

  • defaultAttributes (dict) –

    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.

    • agentAttributes (dict) –

      The agent attributes that are used with the message template.

      • firstName (string) –

        The agent’s first name as entered in their Amazon Connect user account.

      • lastName (string) –

        The agent’s last name as entered in their Amazon Connect user account.

    • customAttributes (dict) –

      The custom attributes that are used with the message template.

      • (string) –

        • (string) –

    • customerProfileAttributes (dict) –

      The customer profile attributes that are used with the message template.

      • accountNumber (string) –

        A unique account number that you have given to the customer.

      • additionalInformation (string) –

        Any additional information relevant to the customer’s profile.

      • address1 (string) –

        The first line of a customer address.

      • address2 (string) –

        The second line of a customer address.

      • address3 (string) –

        The third line of a customer address.

      • address4 (string) –

        The fourth line of a customer address.

      • billingAddress1 (string) –

        The first line of a customer’s billing address.

      • billingAddress2 (string) –

        The second line of a customer’s billing address.

      • billingAddress3 (string) –

        The third line of a customer’s billing address.

      • billingAddress4 (string) –

        The fourth line of a customer’s billing address.

      • billingCity (string) –

        The city of a customer’s billing address.

      • billingCountry (string) –

        The country of a customer’s billing address.

      • billingCounty (string) –

        The county of a customer’s billing address.

      • billingPostalCode (string) –

        The postal code of a customer’s billing address.

      • billingProvince (string) –

        The province of a customer’s billing address.

      • billingState (string) –

        The state of a customer’s billing address.

      • birthDate (string) –

        The customer’s birth date.

      • businessEmailAddress (string) –

        The customer’s business email address.

      • businessName (string) –

        The name of the customer’s business.

      • businessPhoneNumber (string) –

        The customer’s business phone number.

      • city (string) –

        The city in which a customer lives.

      • country (string) –

        The country in which a customer lives.

      • county (string) –

        The county in which a customer lives.

      • custom (dict) –

        The custom attributes in customer profile attributes.

        • (string) –

          • (string) –

      • emailAddress (string) –

        The customer’s email address, which has not been specified as a personal or business address.

      • firstName (string) –

        The customer’s first name.

      • gender (string) –

        The customer’s gender.

      • homePhoneNumber (string) –

        The customer’s mobile phone number.

      • lastName (string) –

        The customer’s last name.

      • mailingAddress1 (string) –

        The first line of a customer’s mailing address.

      • mailingAddress2 (string) –

        The second line of a customer’s mailing address.

      • mailingAddress3 (string) –

        The third line of a customer’s mailing address.

      • mailingAddress4 (string) –

        The fourth line of a customer’s mailing address.

      • mailingCity (string) –

        The city of a customer’s mailing address.

      • mailingCountry (string) –

        The country of a customer’s mailing address.

      • mailingCounty (string) –

        The county of a customer’s mailing address.

      • mailingPostalCode (string) –

        The postal code of a customer’s mailing address.

      • mailingProvince (string) –

        The province of a customer’s mailing address.

      • mailingState (string) –

        The state of a customer’s mailing address.

      • middleName (string) –

        The customer’s middle name.

      • mobilePhoneNumber (string) –

        The customer’s mobile phone number.

      • partyType (string) –

        The customer’s party type.

      • phoneNumber (string) –

        The customer’s phone number, which has not been specified as a mobile, home, or business number.

      • postalCode (string) –

        The postal code of a customer address.

      • profileARN (string) –

        The ARN of a customer profile.

      • profileId (string) –

        The unique identifier of a customer profile.

      • province (string) –

        The province in which a customer lives.

      • shippingAddress1 (string) –

        The first line of a customer’s shipping address.

      • shippingAddress2 (string) –

        The second line of a customer’s shipping address.

      • shippingAddress3 (string) –

        The third line of a customer’s shipping address.

      • shippingAddress4 (string) –

        The fourth line of a customer’s shipping address.

      • shippingCity (string) –

        The city of a customer’s shipping address.

      • shippingCountry (string) –

        The country of a customer’s shipping address.

      • shippingCounty (string) –

        The county of a customer’s shipping address.

      • shippingPostalCode (string) –

        The postal code of a customer’s shipping address.

      • shippingProvince (string) –

        The province of a customer’s shipping address.

      • shippingState (string) –

        The state of a customer’s shipping address.

      • state (string) –

        The state in which a customer lives.

    • systemAttributes (dict) –

      The system attributes that are used with the message template.

      • customerEndpoint (dict) –

        The CustomerEndpoint attribute.

        • address (string) –

          The customer’s phone number if used with customerEndpoint, or the number the customer dialed to call your contact center if used with systemEndpoint.

      • name (string) –

        The name of the task.

      • systemEndpoint (dict) –

        The SystemEndpoint attribute.

        • address (string) –

          The customer’s phone number if used with customerEndpoint, or the number the customer dialed to call your contact center if used with systemEndpoint.

  • description (string) – The description of the message template.

  • groupingConfiguration (dict) –

    The configuration information of the grouping of Amazon Q in Connect users.

    • criteria (string) –

      The criteria used for grouping Amazon Q in Connect users.

      The following is the list of supported criteria values.

    • values (list) –

      The list of values that define different groups of Amazon Q in Connect users.

      • (string) –

  • knowledgeBaseId (string) –

    [REQUIRED]

    The identifier of the knowledge base. Can be either the ID or the ARN. URLs cannot contain the ARN.

  • language (string) – 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

  • name (string) –

    [REQUIRED]

    The name of the message template.

  • tags (dict) –

    The tags used to organize, track, or control access for this resource.

    • (string) –

      • (string) –

Return type:

dict

Returns:

Response Syntax

{
    'messageTemplate': {
        'attributeTypes': [
            'SYSTEM'|'AGENT'|'CUSTOMER_PROFILE'|'CUSTOM',
        ],
        'channelSubtype': 'EMAIL'|'SMS',
        'content': {
            'email': {
                'body': {
                    'html': {
                        'content': 'string'
                    },
                    'plainText': {
                        'content': 'string'
                    }
                },
                'headers': [
                    {
                        'name': 'string',
                        'value': 'string'
                    },
                ],
                'subject': 'string'
            },
            'sms': {
                'body': {
                    'plainText': {
                        'content': 'string'
                    }
                }
            }
        },
        'createdTime': datetime(2015, 1, 1),
        'defaultAttributes': {
            'agentAttributes': {
                'firstName': 'string',
                'lastName': 'string'
            },
            'customAttributes': {
                'string': 'string'
            },
            'customerProfileAttributes': {
                'accountNumber': 'string',
                'additionalInformation': 'string',
                'address1': 'string',
                'address2': 'string',
                'address3': 'string',
                'address4': 'string',
                'billingAddress1': 'string',
                'billingAddress2': 'string',
                'billingAddress3': 'string',
                'billingAddress4': 'string',
                'billingCity': 'string',
                'billingCountry': 'string',
                'billingCounty': 'string',
                'billingPostalCode': 'string',
                'billingProvince': 'string',
                'billingState': 'string',
                'birthDate': 'string',
                'businessEmailAddress': 'string',
                'businessName': 'string',
                'businessPhoneNumber': 'string',
                'city': 'string',
                'country': 'string',
                'county': 'string',
                'custom': {
                    'string': 'string'
                },
                'emailAddress': 'string',
                'firstName': 'string',
                'gender': 'string',
                'homePhoneNumber': 'string',
                'lastName': 'string',
                'mailingAddress1': 'string',
                'mailingAddress2': 'string',
                'mailingAddress3': 'string',
                'mailingAddress4': 'string',
                'mailingCity': 'string',
                'mailingCountry': 'string',
                'mailingCounty': 'string',
                'mailingPostalCode': 'string',
                'mailingProvince': 'string',
                'mailingState': 'string',
                'middleName': 'string',
                'mobilePhoneNumber': 'string',
                'partyType': 'string',
                'phoneNumber': 'string',
                'postalCode': 'string',
                'profileARN': 'string',
                'profileId': 'string',
                'province': 'string',
                'shippingAddress1': 'string',
                'shippingAddress2': 'string',
                'shippingAddress3': 'string',
                'shippingAddress4': 'string',
                'shippingCity': 'string',
                'shippingCountry': 'string',
                'shippingCounty': 'string',
                'shippingPostalCode': 'string',
                'shippingProvince': 'string',
                'shippingState': 'string',
                'state': 'string'
            },
            'systemAttributes': {
                'customerEndpoint': {
                    'address': 'string'
                },
                'name': 'string',
                'systemEndpoint': {
                    'address': 'string'
                }
            }
        },
        'description': 'string',
        'groupingConfiguration': {
            'criteria': 'string',
            'values': [
                'string',
            ]
        },
        'knowledgeBaseArn': 'string',
        'knowledgeBaseId': 'string',
        'language': 'string',
        'lastModifiedBy': 'string',
        'lastModifiedTime': datetime(2015, 1, 1),
        'messageTemplateArn': 'string',
        'messageTemplateContentSha256': 'string',
        'messageTemplateId': 'string',
        'name': 'string',
        'tags': {
            'string': 'string'
        }
    }
}

Response Structure

  • (dict) –

    • messageTemplate (dict) –

      The message template.

      • attributeTypes (list) –

        The types of attributes that the message template contains.

        • (string) –

      • channelSubtype (string) –

        The channel subtype this message template applies to.

      • content (dict) –

        The content of the message template.

        Note

        This is a Tagged Union structure. Only one of the following top level keys will be set: email, sms. If a client receives an unknown member it will set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is as follows:

        'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
        
        • email (dict) –

          The content of the message template that applies to the email channel subtype.

          • body (dict) –

            The body to use in email messages.

            • html (dict) –

              The message body, in HTML format, to use in email messages that are based on the message template. We recommend using HTML format for email clients that render HTML content. You can include links, formatted text, and more in an HTML message.

              Note

              This is a Tagged Union structure. Only one of the following top level keys will be set: content. If a client receives an unknown member it will set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is as follows:

              'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
              
              • content (string) –

                The content of the message template.

            • plainText (dict) –

              The message body, in plain text format, to use in email messages that are based on the message template. We recommend using plain text format for email clients that don’t render HTML content and clients that are connected to high-latency networks, such as mobile devices.

              Note

              This is a Tagged Union structure. Only one of the following top level keys will be set: content. If a client receives an unknown member it will set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is as follows:

              'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
              
              • content (string) –

                The content of the message template.

          • headers (list) –

            The email headers to include in email messages.

            • (dict) –

              The email header to include in email messages.

              • name (string) –

                The name of the email header.

              • value (string) –

                The value of the email header.

          • subject (string) –

            The subject line, or title, to use in email messages.

        • sms (dict) –

          The content of the message template that applies to the SMS channel subtype.

          • body (dict) –

            The body to use in SMS messages.

            • plainText (dict) –

              The message body to use in SMS messages.

              Note

              This is a Tagged Union structure. Only one of the following top level keys will be set: content. If a client receives an unknown member it will set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is as follows:

              'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
              
              • content (string) –

                The content of the message template.

      • createdTime (datetime) –

        The timestamp when the message template was created.

      • defaultAttributes (dict) –

        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.

        • agentAttributes (dict) –

          The agent attributes that are used with the message template.

          • firstName (string) –

            The agent’s first name as entered in their Amazon Connect user account.

          • lastName (string) –

            The agent’s last name as entered in their Amazon Connect user account.

        • customAttributes (dict) –

          The custom attributes that are used with the message template.

          • (string) –

            • (string) –

        • customerProfileAttributes (dict) –

          The customer profile attributes that are used with the message template.

          • accountNumber (string) –

            A unique account number that you have given to the customer.

          • additionalInformation (string) –

            Any additional information relevant to the customer’s profile.

          • address1 (string) –

            The first line of a customer address.

          • address2 (string) –

            The second line of a customer address.

          • address3 (string) –

            The third line of a customer address.

          • address4 (string) –

            The fourth line of a customer address.

          • billingAddress1 (string) –

            The first line of a customer’s billing address.

          • billingAddress2 (string) –

            The second line of a customer’s billing address.

          • billingAddress3 (string) –

            The third line of a customer’s billing address.

          • billingAddress4 (string) –

            The fourth line of a customer’s billing address.

          • billingCity (string) –

            The city of a customer’s billing address.

          • billingCountry (string) –

            The country of a customer’s billing address.

          • billingCounty (string) –

            The county of a customer’s billing address.

          • billingPostalCode (string) –

            The postal code of a customer’s billing address.

          • billingProvince (string) –

            The province of a customer’s billing address.

          • billingState (string) –

            The state of a customer’s billing address.

          • birthDate (string) –

            The customer’s birth date.

          • businessEmailAddress (string) –

            The customer’s business email address.

          • businessName (string) –

            The name of the customer’s business.

          • businessPhoneNumber (string) –

            The customer’s business phone number.

          • city (string) –

            The city in which a customer lives.

          • country (string) –

            The country in which a customer lives.

          • county (string) –

            The county in which a customer lives.

          • custom (dict) –

            The custom attributes in customer profile attributes.

            • (string) –

              • (string) –

          • emailAddress (string) –

            The customer’s email address, which has not been specified as a personal or business address.

          • firstName (string) –

            The customer’s first name.

          • gender (string) –

            The customer’s gender.

          • homePhoneNumber (string) –

            The customer’s mobile phone number.

          • lastName (string) –

            The customer’s last name.

          • mailingAddress1 (string) –

            The first line of a customer’s mailing address.

          • mailingAddress2 (string) –

            The second line of a customer’s mailing address.

          • mailingAddress3 (string) –

            The third line of a customer’s mailing address.

          • mailingAddress4 (string) –

            The fourth line of a customer’s mailing address.

          • mailingCity (string) –

            The city of a customer’s mailing address.

          • mailingCountry (string) –

            The country of a customer’s mailing address.

          • mailingCounty (string) –

            The county of a customer’s mailing address.

          • mailingPostalCode (string) –

            The postal code of a customer’s mailing address.

          • mailingProvince (string) –

            The province of a customer’s mailing address.

          • mailingState (string) –

            The state of a customer’s mailing address.

          • middleName (string) –

            The customer’s middle name.

          • mobilePhoneNumber (string) –

            The customer’s mobile phone number.

          • partyType (string) –

            The customer’s party type.

          • phoneNumber (string) –

            The customer’s phone number, which has not been specified as a mobile, home, or business number.

          • postalCode (string) –

            The postal code of a customer address.

          • profileARN (string) –

            The ARN of a customer profile.

          • profileId (string) –

            The unique identifier of a customer profile.

          • province (string) –

            The province in which a customer lives.

          • shippingAddress1 (string) –

            The first line of a customer’s shipping address.

          • shippingAddress2 (string) –

            The second line of a customer’s shipping address.

          • shippingAddress3 (string) –

            The third line of a customer’s shipping address.

          • shippingAddress4 (string) –

            The fourth line of a customer’s shipping address.

          • shippingCity (string) –

            The city of a customer’s shipping address.

          • shippingCountry (string) –

            The country of a customer’s shipping address.

          • shippingCounty (string) –

            The county of a customer’s shipping address.

          • shippingPostalCode (string) –

            The postal code of a customer’s shipping address.

          • shippingProvince (string) –

            The province of a customer’s shipping address.

          • shippingState (string) –

            The state of a customer’s shipping address.

          • state (string) –

            The state in which a customer lives.

        • systemAttributes (dict) –

          The system attributes that are used with the message template.

          • customerEndpoint (dict) –

            The CustomerEndpoint attribute.

            • address (string) –

              The customer’s phone number if used with customerEndpoint, or the number the customer dialed to call your contact center if used with systemEndpoint.

          • name (string) –

            The name of the task.

          • systemEndpoint (dict) –

            The SystemEndpoint attribute.

            • address (string) –

              The customer’s phone number if used with customerEndpoint, or the number the customer dialed to call your contact center if used with systemEndpoint.

      • description (string) –

        The description of the message template.

      • groupingConfiguration (dict) –

        The configuration information of the grouping of Amazon Q in Connect users.

        • criteria (string) –

          The criteria used for grouping Amazon Q in Connect users.

          The following is the list of supported criteria values.

        • values (list) –

          The list of values that define different groups of Amazon Q in Connect users.

          • (string) –

      • knowledgeBaseArn (string) –

        The Amazon Resource Name (ARN) of the knowledge base.

      • knowledgeBaseId (string) –

        The identifier of the knowledge base.

      • language (string) –

        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

      • lastModifiedBy (string) –

        The Amazon Resource Name (ARN) of the user who last updated the message template data.

      • lastModifiedTime (datetime) –

        The timestamp when the message template data was last modified.

      • messageTemplateArn (string) –

        The Amazon Resource Name (ARN) of the message template.

      • messageTemplateContentSha256 (string) –

        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.

      • messageTemplateId (string) –

        The identifier of the message template.

      • name (string) –

        The name of the message template.

      • tags (dict) –

        The tags used to organize, track, or control access for this resource.

        • (string) –

          • (string) –

Exceptions

  • QConnect.Client.exceptions.ConflictException

  • QConnect.Client.exceptions.ValidationException

  • QConnect.Client.exceptions.ServiceQuotaExceededException

  • QConnect.Client.exceptions.AccessDeniedException

  • QConnect.Client.exceptions.ResourceNotFoundException

  • QConnect.Client.exceptions.ThrottlingException