:doc:`ConnectParticipant <../../connectparticipant>` / Client / send_message

************
send_message
************



.. py:method:: ConnectParticipant.Client.send_message(**kwargs)

  

  Sends a message.

   

  For security recommendations, see `Amazon Connect Chat security best practices <https://docs.aws.amazon.com/connect/latest/adminguide/security-best-practices.html#bp-security-chat>`__.

   

  .. note::

    

    ``ConnectionToken`` is used for invoking this API instead of ``ParticipantToken``.

    

   

  The Amazon Connect Participant Service APIs do not use `Signature Version 4 authentication <https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html>`__.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/connectparticipant-2018-09-07/SendMessage>`_  


  **Request Syntax**
  ::

    response = client.send_message(
        ContentType='string',
        Content='string',
        ClientToken='string',
        ConnectionToken='string'
    )
    
  :type ContentType: string
  :param ContentType: **[REQUIRED]** 

    The type of the content. Possible types are ``text/plain``, ``text/markdown``, ``application/json``, and ``application/vnd.amazonaws.connect.message.interactive.response``.

     

    Supported types on the contact are configured through ``SupportedMessagingContentTypes`` on `StartChatContact <https://docs.aws.amazon.com/connect/latest/APIReference/API_StartChatContact.html>`__ and `StartOutboundChatContact <https://docs.aws.amazon.com/connect/latest/APIReference/API_StartOutboundChatContact.html>`__.

     

    For Apple Messages for Business, SMS, and WhatsApp Business Messaging contacts, only ``text/plain`` is supported.

    

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

    The content of the message.

     

    
    * For ``text/plain`` and ``text/markdown``, the Length Constraints are Minimum of 1, Maximum of 1024.
     
    * For ``application/json``, the Length Constraints are Minimum of 1, Maximum of 12000.
     
    * For ``application/vnd.amazonaws.connect.message.interactive.response``, the Length Constraints are Minimum of 1, Maximum of 12288.
    

    

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

    This field is autopopulated if not provided.

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

    The authentication token associated with the connection.

    

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

    
    ::

      {
          'Id': 'string',
          'AbsoluteTime': 'string',
          'MessageMetadata': {
              'MessageProcessingStatus': 'PROCESSING'|'FAILED'|'REJECTED'
          }
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **Id** *(string) --* 

        The ID of the message.

        
      

      - **AbsoluteTime** *(string) --* 

        The time when the message was sent.

         

        It's specified in ISO 8601 format: yyyy-MM-ddThh:mm:ss.SSSZ. For example, 2019-11-08T02:41:28.172Z.

        
      

      - **MessageMetadata** *(dict) --* 

        Contains metadata for the message.

        
        

        - **MessageProcessingStatus** *(string) --* 

          The status of Message Processing for the message.

          
    
  
  **Exceptions**
  
  *   :py:class:`ConnectParticipant.Client.exceptions.AccessDeniedException`

  
  *   :py:class:`ConnectParticipant.Client.exceptions.InternalServerException`

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

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

  