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

*****************
batch_put_contact
*****************



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

  

  .. note::

    

    Only the Amazon Connect outbound campaigns service principal is allowed to assume a role in your account and call this API.

    

   

  Allows you to create a batch of contacts in Amazon Connect. The outbound campaigns capability ingests dial requests via the `PutDialRequestBatch <https://docs.aws.amazon.com/connect-outbound/latest/APIReference/API_PutDialRequestBatch.html>`__ API. It then uses BatchPutContact to create contacts corresponding to those dial requests. If agents are available, the dial requests are dialed out, which results in a voice call. The resulting voice call uses the same contactId that was created by BatchPutContact.

  

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


  **Request Syntax**
  ::

    response = client.batch_put_contact(
        ClientToken='string',
        InstanceId='string',
        ContactDataRequestList=[
            {
                'SystemEndpoint': {
                    'Type': 'TELEPHONE_NUMBER'|'VOIP'|'CONTACT_FLOW'|'CONNECT_PHONENUMBER_ARN'|'EMAIL_ADDRESS',
                    'Address': 'string'
                },
                'CustomerEndpoint': {
                    'Type': 'TELEPHONE_NUMBER'|'VOIP'|'CONTACT_FLOW'|'CONNECT_PHONENUMBER_ARN'|'EMAIL_ADDRESS',
                    'Address': 'string'
                },
                'RequestIdentifier': 'string',
                'QueueId': 'string',
                'Attributes': {
                    'string': 'string'
                },
                'Campaign': {
                    'CampaignId': 'string'
                },
                'OutboundStrategy': {
                    'Type': 'AGENT_FIRST',
                    'Config': {
                        'AgentFirst': {
                            'Preview': {
                                'PostAcceptTimeoutConfig': {
                                    'DurationInSeconds': 123
                                },
                                'AllowedUserActions': [
                                    'CALL'|'DISCARD',
                                ]
                            }
                        }
                    }
                }
            },
        ]
    )
    
  :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 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 ContactDataRequestList: list
  :param ContactDataRequestList: **[REQUIRED]** 

    List of individual contact requests.

    

  
    - *(dict) --* 

      Request object with information to create a contact.

      

    
      - **SystemEndpoint** *(dict) --* 

        Endpoint associated with the Amazon Connect instance from which outbound contact will be initiated for the campaign.

        

      
        - **Type** *(string) --* 

          Type of the endpoint.

          

        
        - **Address** *(string) --* 

          Address of the endpoint.

          

        
      
      - **CustomerEndpoint** *(dict) --* 

        Endpoint of the customer for which contact will be initiated.

        

      
        - **Type** *(string) --* 

          Type of the endpoint.

          

        
        - **Address** *(string) --* 

          Address of the endpoint.

          

        
      
      - **RequestIdentifier** *(string) --* 

        Identifier to uniquely identify individual requests in the batch.

        

      
      - **QueueId** *(string) --* 

        The identifier of the queue associated with the Amazon Connect instance in which contacts that are created will be queued.

        

      
      - **Attributes** *(dict) --* 

        List of attributes to be stored in a contact.

        

      
        - *(string) --* 

        
          - *(string) --* 

          
    
  
      - **Campaign** *(dict) --* 

        Structure to store information associated with a campaign.

        

      
        - **CampaignId** *(string) --* 

          A unique identifier for a campaign.

          

        
      
      - **OutboundStrategy** *(dict) --* 

        Information about the outbound strategy.

        

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

          Type of the outbound strategy.

          

        
        - **Config** *(dict) --* 

          Config of the outbound strategy.

          

        
          - **AgentFirst** *(dict) --* 

            The config of agent first outbound strategy.

            

          
            - **Preview** *(dict) --* 

              Information about preview configuration of agent first outbound strategy

              

            
              - **PostAcceptTimeoutConfig** *(dict) --* **[REQUIRED]** 

                Countdown timer configuration after the agent accepted the preview outbound contact.

                

              
                - **DurationInSeconds** *(integer) --* **[REQUIRED]** 

                  Duration in seconds for the countdown timer after the agent accepted the contact.

                  

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

                The actions the agent can perform after accepting the preview outbound contact.

                

              
                - *(string) --* 

                
            
            
          
        
      
    

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

    
    ::

      {
          'SuccessfulRequestList': [
              {
                  'RequestIdentifier': 'string',
                  'ContactId': 'string'
              },
          ],
          'FailedRequestList': [
              {
                  'RequestIdentifier': 'string',
                  'FailureReasonCode': 'INVALID_ATTRIBUTE_KEY'|'INVALID_CUSTOMER_ENDPOINT'|'INVALID_SYSTEM_ENDPOINT'|'INVALID_QUEUE'|'INVALID_OUTBOUND_STRATEGY'|'MISSING_CAMPAIGN'|'MISSING_CUSTOMER_ENDPOINT'|'MISSING_QUEUE_ID_AND_SYSTEM_ENDPOINT'|'REQUEST_THROTTLED'|'IDEMPOTENCY_EXCEPTION'|'INTERNAL_ERROR',
                  'FailureReasonMessage': 'string'
              },
          ]
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **SuccessfulRequestList** *(list) --* 

        List of requests for which contact was successfully created.

        
        

        - *(dict) --* 

          Request for which contact was successfully created.

          
          

          - **RequestIdentifier** *(string) --* 

            Request identifier provided in the API call in the ContactDataRequest to create a contact.

            
          

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

            The contactId of the contact that was created successfully.

            
      
    
      

      - **FailedRequestList** *(list) --* 

        List of requests for which contact creation failed.

        
        

        - *(dict) --* 

          Request for which contact failed to be generated.

          
          

          - **RequestIdentifier** *(string) --* 

            Request identifier provided in the API call in the ContactDataRequest to create a contact.

            
          

          - **FailureReasonCode** *(string) --* 

            Reason code for the failure.

            
          

          - **FailureReasonMessage** *(string) --* 

            Why the request to create a contact failed.

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

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

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

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

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

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

  