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

**********************************
create_message_template_attachment
**********************************



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

  

  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.

  

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


  **Request Syntax**
  ::

    response = client.create_message_template_attachment(
        knowledgeBaseId='string',
        messageTemplateId='string',
        contentDisposition='ATTACHMENT',
        name='string',
        body='string',
        clientToken='string'
    )
    
  :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 messageTemplateId: string
  :param messageTemplateId: **[REQUIRED]** 

    The identifier of the message template. Can be either the ID or the ARN. It cannot contain any qualifier.

    

  
  :type contentDisposition: string
  :param contentDisposition: **[REQUIRED]** 

    The presentation information for the attachment file.

    

  
  :type name: string
  :param name: **[REQUIRED]** 

    The name of the attachment file being uploaded. The name should include the file extension.

    

  
  :type body: string
  :param body: **[REQUIRED]** 

    The body of the attachment file being uploaded. It should be encoded using base64 encoding.

    

  
  :type clientToken: string
  :param 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 <http://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/>`__.

    

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

    
    ::

      {
          'attachment': {
              'contentDisposition': 'ATTACHMENT',
              'name': 'string',
              'uploadedTime': datetime(2015, 1, 1),
              'url': 'string',
              'urlExpiry': datetime(2015, 1, 1),
              'attachmentId': 'string'
          }
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **attachment** *(dict) --* 

        The message template attachment.

        
        

        - **contentDisposition** *(string) --* 

          The presentation information for the attachment file.

          
        

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

          The name of the attachment file being uploaded. The name should include the file extension.

          
        

        - **uploadedTime** *(datetime) --* 

          The timestamp when the attachment file was uploaded.

          
        

        - **url** *(string) --* 

          A pre-signed Amazon S3 URL that can be used to download the attachment file.

          
        

        - **urlExpiry** *(datetime) --* 

          The expiration time of the pre-signed Amazon S3 URL.

          
        

        - **attachmentId** *(string) --* 

          The identifier of the attachment file.

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

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

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

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

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

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

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

  