:doc:`QConnect <../../qconnect>` / Client / search_message_templates

************************
search_message_templates
************************



.. py:method:: QConnect.Client.search_message_templates(**kwargs)

  

  Searches for Amazon Q in Connect message templates in the specified knowledge base.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/qconnect-2020-10-19/SearchMessageTemplates>`_  


  **Request Syntax**
  ::

    response = client.search_message_templates(
        knowledgeBaseId='string',
        searchExpression={
            'queries': [
                {
                    'name': 'string',
                    'values': [
                        'string',
                    ],
                    'operator': 'CONTAINS'|'CONTAINS_AND_PREFIX',
                    'allowFuzziness': True|False,
                    'priority': 'HIGH'|'MEDIUM'|'LOW'
                },
            ],
            'filters': [
                {
                    'name': 'string',
                    'values': [
                        'string',
                    ],
                    'operator': 'EQUALS'|'PREFIX',
                    'includeNoExistence': True|False
                },
            ],
            'orderOnField': {
                'name': 'string',
                'order': 'ASC'|'DESC'
            }
        },
        nextToken='string',
        maxResults=123
    )
    
  :type knowledgeBaseId: string
  :param knowledgeBaseId: **[REQUIRED]** 

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

    

  
  :type searchExpression: dict
  :param searchExpression: **[REQUIRED]** 

    The search expression for querying the message template.

    

  
    - **queries** *(list) --* 

      The message template query expressions.

      

    
      - *(dict) --* 

        The message template fields to query message templates by. The following is the list of supported field names:

         

        
        * name
         
        * description
        

        

      
        - **name** *(string) --* **[REQUIRED]** 

          The name of the attribute to query the message templates by.

          

        
        - **values** *(list) --* **[REQUIRED]** 

          The values of the attribute to query the message templates by.

          

        
          - *(string) --* 

          
      
        - **operator** *(string) --* **[REQUIRED]** 

          The operator to use for matching attribute field values in the query.

          

        
        - **allowFuzziness** *(boolean) --* 

          Whether the query expects only exact matches on the attribute field values. The results of the query will only include exact matches if this parameter is set to false.

          

        
        - **priority** *(string) --* 

          The importance of the attribute field when calculating query result relevancy scores. The value set for this parameter affects the ordering of search results.

          

        
      
  
    - **filters** *(list) --* 

      The configuration of filtering rules applied to message template query results.

      

    
      - *(dict) --* 

        The message template fields to filter the message template query results by. The following is the list of supported field names:

         

        
        * name
         
        * description
         
        * channel
         
        * channelSubtype
         
        * language
         
        * qualifier
         
        * createdTime
         
        * lastModifiedTime
         
        * lastModifiedBy
         
        * groupingConfiguration.criteria
         
        * groupingConfiguration.values
        

        

      
        - **name** *(string) --* **[REQUIRED]** 

          The name of the attribute field to filter the message templates by.

          

        
        - **values** *(list) --* 

          The values of attribute field to filter the message template by.

          

        
          - *(string) --* 

          
      
        - **operator** *(string) --* **[REQUIRED]** 

          The operator to use for filtering.

          

        
        - **includeNoExistence** *(boolean) --* 

          Whether to treat null value as a match for the attribute field.

          

        
      
  
    - **orderOnField** *(dict) --* 

      The message template attribute fields on which the query results are ordered.

      

    
      - **name** *(string) --* **[REQUIRED]** 

        The name of the message template.

        

      
      - **order** *(string) --* 

        The order at which the message templates are sorted by.

        

      
    
  
  :type nextToken: string
  :param nextToken: 

    The 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.

    

  
  :type maxResults: integer
  :param maxResults: 

    The maximum number of results to return per page.

    

  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'results': [
              {
                  'messageTemplateArn': 'string',
                  'messageTemplateId': 'string',
                  'knowledgeBaseArn': 'string',
                  'knowledgeBaseId': 'string',
                  'name': 'string',
                  'channel': 'string',
                  'channelSubtype': 'EMAIL'|'SMS'|'WHATSAPP'|'PUSH',
                  'createdTime': datetime(2015, 1, 1),
                  'lastModifiedTime': datetime(2015, 1, 1),
                  'lastModifiedBy': 'string',
                  'isActive': True|False,
                  'versionNumber': 123,
                  'description': 'string',
                  'sourceConfigurationSummary': {
                      'whatsApp': {
                          'businessAccountId': 'string',
                          'templateId': 'string',
                          'name': 'string',
                          'language': 'string',
                          'components': [
                              'string',
                          ],
                          'status': 'VALID'|'INVALID'|'REJECTED',
                          'statusReason': 'string'
                      }
                  },
                  'groupingConfiguration': {
                      'criteria': 'string',
                      'values': [
                          'string',
                      ]
                  },
                  'language': 'string',
                  'tags': {
                      'string': 'string'
                  }
              },
          ],
          'nextToken': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **results** *(list) --* 

        The results of the message template search.

        
        

        - *(dict) --* 

          The result of message template search.

          
          

          - **messageTemplateArn** *(string) --* 

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

            
          

          - **messageTemplateId** *(string) --* 

            The identifier of the message template.

            
          

          - **knowledgeBaseArn** *(string) --* 

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

            
          

          - **knowledgeBaseId** *(string) --* 

            The identifier of the knowledge base.

            
          

          - **name** *(string) --* 

            The name of the message template.

            
          

          - **channel** *(string) --* 

            The channel of the message template.

            
          

          - **channelSubtype** *(string) --* 

            The channel subtype this message template applies to.

            
          

          - **createdTime** *(datetime) --* 

            The timestamp when the message template was created.

            
          

          - **lastModifiedTime** *(datetime) --* 

            The timestamp when the message template data was last modified.

            
          

          - **lastModifiedBy** *(string) --* 

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

            
          

          - **isActive** *(boolean) --* 

            Whether the version of the message template is activated.

            
          

          - **versionNumber** *(integer) --* 

            The version number of the message template version.

            
          

          - **description** *(string) --* 

            The description of the message template.

            
          

          - **sourceConfigurationSummary** *(dict) --* 

            The source configuration summary of the message template.

            .. note::    This is a Tagged Union structure. Only one of the     following top level keys will be set: ``whatsApp``.     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'}


          
            

            - **whatsApp** *(dict) --* 

              The sourceConfiguration summary of the message template that applies to the WHATSAPP channel subtype.

              
              

              - **businessAccountId** *(string) --* 

                The ID of the End User Messaging WhatsApp Business Account to associate with this template.

                
              

              - **templateId** *(string) --* 

                The ID of WhatsApp template.

                
              

              - **name** *(string) --* 

                The name of the WhatsApp template.

                
              

              - **language** *(string) --* 

                The language of the WhatsApp template.

                
              

              - **components** *(list) --* 

                The list of component mapping from WhatsApp template parameters to Message Template attributes.

                
                

                - *(string) --* 

                  The component mapping from WhatsApp template parameters to Message Template attributes.

                  
            
              

              - **status** *(string) --* 

                The status of the message template.

                
              

              - **statusReason** *(string) --* 

                The status reason 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.

               

              
              * ``RoutingProfileArn``: Grouping the users by their `Amazon Connect routing profile ARN <https://docs.aws.amazon.com/connect/latest/APIReference/API_RoutingProfile.html>`__. User should have `SearchRoutingProfile <https://docs.aws.amazon.com/connect/latest/APIReference/API_SearchRoutingProfiles.html>`__ and `DescribeRoutingProfile <https://docs.aws.amazon.com/connect/latest/APIReference/API_DescribeRoutingProfile.html>`__ permissions when setting criteria to this value.
              

              
            

            - **values** *(list) --* 

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

               

              
              * When setting ``criteria`` to ``RoutingProfileArn``, you need to provide a list of ARNs of `Amazon Connect routing profiles <https://docs.aws.amazon.com/connect/latest/APIReference/API_RoutingProfile.html>`__ as values of this parameter.
              

              
              

              - *(string) --* 
          
        
          

          - **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``

            
          

          - **tags** *(dict) --* 

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

            
            

            - *(string) --* 
              

              - *(string) --* 
        
      
      
    
      

      - **nextToken** *(string) --* 

        If there are additional results, this is the token for the next set of results.

        
  
  **Exceptions**
  
  *   :py:class:`QConnect.Client.exceptions.ValidationException`

  
  *   :py:class:`QConnect.Client.exceptions.UnauthorizedException`

  
  *   :py:class:`QConnect.Client.exceptions.AccessDeniedException`

  
  *   :py:class:`QConnect.Client.exceptions.ResourceNotFoundException`

  
  *   :py:class:`QConnect.Client.exceptions.ThrottlingException`

  