:doc:`Connect <../../connect>` / Client / start_email_contact

*******************
start_email_contact
*******************



.. py:method:: Connect.Client.start_email_contact(**kwargs)

  

  Creates an inbound email contact and initiates a flow to start the email contact for the customer. Response of this API provides the ContactId of the email contact created.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/connect-2017-08-08/StartEmailContact>`_  


  **Request Syntax**
  ::

    response = client.start_email_contact(
        InstanceId='string',
        FromEmailAddress={
            'EmailAddress': 'string',
            'DisplayName': 'string'
        },
        DestinationEmailAddress='string',
        Description='string',
        References={
            'string': {
                'Value': 'string',
                'Type': 'URL'|'ATTACHMENT'|'CONTACT_ANALYSIS'|'NUMBER'|'STRING'|'DATE'|'EMAIL'|'EMAIL_MESSAGE'|'EMAIL_MESSAGE_PLAIN_TEXT',
                'Status': 'AVAILABLE'|'DELETED'|'APPROVED'|'REJECTED'|'PROCESSING'|'FAILED',
                'Arn': 'string',
                'StatusReason': 'string'
            }
        },
        Name='string',
        EmailMessage={
            'MessageSourceType': 'RAW',
            'RawMessage': {
                'Subject': 'string',
                'Body': 'string',
                'ContentType': 'string',
                'Headers': {
                    'string': 'string'
                }
            }
        },
        AdditionalRecipients={
            'ToAddresses': [
                {
                    'EmailAddress': 'string',
                    'DisplayName': 'string'
                },
            ],
            'CcAddresses': [
                {
                    'EmailAddress': 'string',
                    'DisplayName': 'string'
                },
            ]
        },
        Attachments=[
            {
                'FileName': 'string',
                'S3Url': 'string'
            },
        ],
        ContactFlowId='string',
        RelatedContactId='string',
        Attributes={
            'string': 'string'
        },
        SegmentAttributes={
            'string': {
                'ValueString': 'string',
                'ValueMap': {
                    'string': {'... recursive ...'}
                },
                'ValueInteger': 123,
                'ValueList': [
                    {'... recursive ...'},
                ],
                'ValueArn': 'string'
            }
        },
        ClientToken='string'
    )
    
  :type InstanceId: string
  :param InstanceId: **[REQUIRED]** 

    The identifier of the Amazon Connect instance. You can `find the instance ID <https://docs.aws.amazon.com/connect/latest/adminguide/find-instance-arn.html>`__ in the Amazon Resource Name (ARN) of the instance.

    

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

    The email address of the customer.

    

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

      The email address, including the domain.

      

    
    - **DisplayName** *(string) --* 

      The display name of email address.

      

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

    The email address associated with the Amazon Connect instance.

    

  
  :type Description: string
  :param Description: 

    A description of the email contact.

    

  
  :type References: dict
  :param References: 

    A formatted URL that is shown to an agent in the Contact Control Panel (CCP). Emails can have the following reference types at the time of creation: ``URL`` | ``NUMBER`` | ``STRING`` | ``DATE``. ``EMAIL`` | ``EMAIL_MESSAGE`` | ``ATTACHMENT`` are not a supported reference type during email creation.

    

  
    - *(string) --* 

    
      - *(dict) --* 

        Well-formed data on a contact, used by agents to complete a contact request. You can have up to 4,096 UTF-8 bytes across all references for a contact.

        

      
        - **Value** *(string) --* 

          A valid value for the reference. For example, for a URL reference, a formatted URL that is displayed to an agent in the Contact Control Panel (CCP).

          

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

          The type of the reference. ``DATE`` must be of type Epoch timestamp.

          

        
        - **Status** *(string) --* 

          Status of the attachment reference type.

          

        
        - **Arn** *(string) --* 

          The Amazon Resource Name (ARN) of the reference

          

        
        - **StatusReason** *(string) --* 

          Relevant details why the reference was not successfully created.

          

        
      


  :type Name: string
  :param Name: 

    The name of a email that is shown to an agent in the Contact Control Panel (CCP).

    

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

    The email message body to be sent to the newly created email.

    

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

      The message source type, that is, ``RAW``.

      

    
    - **RawMessage** *(dict) --* 

      The raw email body content.

      

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

        The email subject.

        

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

        The email message body.

        

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

        Type of content, that is, ``text/plain`` or ``text/html``.

        

      
      - **Headers** *(dict) --* 

        Headers present in inbound email.

        

      
        - *(string) --* 

        
          - *(string) --* 

          
    
  
    
  
  :type AdditionalRecipients: dict
  :param AdditionalRecipients: 

    The additional recipients address of the email.

    

  
    - **ToAddresses** *(list) --* 

      The **additional** recipients information present in to list. You must have 1 required recipient ( ``DestinationEmailAddress``). You can then specify up to 49 additional recipients (across ``ToAddresses`` and ``CcAddresses``), for a total of 50 recipients.

      

    
      - *(dict) --* 

        Contains information about a source or destination email address.

        

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

          The email address, including the domain.

          

        
        - **DisplayName** *(string) --* 

          The display name of email address.

          

        
      
  
    - **CcAddresses** *(list) --* 

      The **additional** recipients information present in cc list. You must have 1 required recipient ( ``DestinationEmailAddress``). You can then specify up to 49 additional recipients (across ``ToAddresses`` and ``CcAddresses``), for a total of 50 recipients.

      

    
      - *(dict) --* 

        Contains information about a source or destination email address.

        

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

          The email address, including the domain.

          

        
        - **DisplayName** *(string) --* 

          The display name of email address.

          

        
      
  
  
  :type Attachments: list
  :param Attachments: 

    List of S3 presigned URLs of email attachments and their file name.

    

  
    - *(dict) --* 

      Information about the email attachment files.

      

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

        A case-sensitive name of the attached file being uploaded.

        

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

        The pre-signed URLs for the S3 bucket where the email attachment is stored.

        

      
    

  :type ContactFlowId: string
  :param ContactFlowId: 

    The identifier of the flow for initiating the emails. To see the ContactFlowId in the Amazon Connect admin website, on the navigation menu go to **Routing**, **Flows**. Choose the flow. On the flow page, under the name of the flow, choose **Show additional flow information**. The ContactFlowId is the last part of the ARN, shown here in bold:

     

    arn:aws:connect:us-west-2:xxxxxxxxxxxx:instance/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/contact-flow/**846ec553-a005-41c0-8341-xxxxxxxxxxxx**

    

  
  :type RelatedContactId: string
  :param RelatedContactId: 

    The contactId that is related to this contact. Linking emails together by using ``RelatedContactID`` copies over contact attributes from the related email contact to the new email contact. All updates to user-defined attributes in the new email contact are limited to the individual contact ID. There are no limits to the number of contacts that can be linked by using ``RelatedContactId``.

    

  
  :type Attributes: dict
  :param Attributes: 

    A custom key-value pair using an attribute map. The attributes are standard Amazon Connect attributes, and can be accessed in flows just like any other contact attributes.

     

    There can be up to 32,768 UTF-8 bytes across all key-value pairs per contact. Attribute keys can include only alphanumeric, dash, and underscore characters.

    

  
    - *(string) --* 

    
      - *(string) --* 

      


  :type SegmentAttributes: dict
  :param SegmentAttributes: 

    A set of system defined key-value pairs stored on individual contact segments using an attribute map. The attributes are standard Amazon Connect attributes. They can be accessed in flows.

     

    Attribute keys can include only alphanumeric, -, and _.

     

    This field can be used to show channel subtype, such as ``connect:Guide``.

     

    .. note::

      

      To set contact expiry, a ``ValueMap`` must be specified containing the integer number of minutes the contact will be active for before expiring, with ``SegmentAttributes`` like { ``"connect:ContactExpiry": {"ValueMap" : { "ExpiryDuration": { "ValueInteger":135}}}}``.

      

    

  
    - *(string) --* 

    
      - *(dict) --* 

        A value for a segment attribute. This is structured as a map where the key is ``valueString`` and the value is a string.

        

      
        - **ValueString** *(string) --* 

          The value of a segment attribute.

          

        
        - **ValueMap** *(dict) --* 

          The value of a segment attribute.

          

        
          - *(string) --* 

          
            - *(dict) --* 

              A value for a segment attribute. This is structured as a map where the key is ``valueString`` and the value is a string.

              

            
      
    
        - **ValueInteger** *(integer) --* 

          The value of a segment attribute.

          

        
        - **ValueList** *(list) --* 

          The value of a segment attribute. This is only supported for system-defined attributes, not for user-defined attributes.

          

        
          - *(dict) --* 

            A value for a segment attribute. This is structured as a map where the key is ``valueString`` and the value is a string.

            

          
      
        - **ValueArn** *(string) --* 

          The value of a segment attribute that has to be a valid ARN. This is only supported for system-defined attributes, not for user-defined attributes.

          

        
      


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

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

    
    ::

      {
          'ContactId': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **ContactId** *(string) --* 

        The identifier of this contact within the Amazon Connect instance.

        
  
  **Exceptions**
  
  *   :py:class:`Connect.Client.exceptions.InvalidRequestException`

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

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

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

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

  
  *   :py:class:`Connect.Client.exceptions.InternalServiceException`

  
  *   :py:class:`Connect.Client.exceptions.IdempotencyException`

  