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

*********************
get_current_user_data
*********************



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

  

  Gets the real-time active user data from the specified Amazon Connect instance.

  

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


  **Request Syntax**
  ::

    response = client.get_current_user_data(
        InstanceId='string',
        Filters={
            'Queues': [
                'string',
            ],
            'ContactFilter': {
                'ContactStates': [
                    'INCOMING'|'PENDING'|'CONNECTING'|'CONNECTED'|'CONNECTED_ONHOLD'|'MISSED'|'ERROR'|'ENDED'|'REJECTED',
                ]
            },
            'RoutingProfiles': [
                'string',
            ],
            'Agents': [
                'string',
            ],
            'UserHierarchyGroups': [
                'string',
            ]
        },
        NextToken='string',
        MaxResults=123
    )
    
  :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 Filters: dict
  :param Filters: **[REQUIRED]** 

    The filters to apply to returned user data. You can filter up to the following limits:

     

    
    * Queues: 100
     
    * Routing profiles: 100
     
    * Agents: 100
     
    * Contact states: 9
     
    * User hierarchy groups: 1
    

     

    The user data is retrieved for only the specified values/resources in the filter. A maximum of one filter can be passed from queues, routing profiles, agents, and user hierarchy groups.

     

    Currently tagging is only supported on the resources that are passed in the filter.

    

  
    - **Queues** *(list) --* 

      A list of up to 100 queues or ARNs.

      

    
      - *(string) --* 

      
  
    - **ContactFilter** *(dict) --* 

      A filter for the user data based on the contact information that is associated to the user. It contains a list of contact states.

      

    
      - **ContactStates** *(list) --* 

        A list of up to 9 `contact states <https://docs.aws.amazon.com/connect/latest/adminguide/about-contact-states.html>`__.

        

      
        - *(string) --* 

        
    
    
    - **RoutingProfiles** *(list) --* 

      A list of up to 100 routing profile IDs or ARNs.

      

    
      - *(string) --* 

      
  
    - **Agents** *(list) --* 

      A list of up to 100 agent IDs or ARNs.

      

    
      - *(string) --* 

      
  
    - **UserHierarchyGroups** *(list) --* 

      A UserHierarchyGroup ID or ARN.

      

    
      - *(string) --* 

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

    
    ::

      {
          'NextToken': 'string',
          'UserDataList': [
              {
                  'User': {
                      'Id': 'string',
                      'Arn': 'string'
                  },
                  'RoutingProfile': {
                      'Id': 'string',
                      'Arn': 'string'
                  },
                  'HierarchyPath': {
                      'LevelOne': {
                          'Id': 'string',
                          'Arn': 'string'
                      },
                      'LevelTwo': {
                          'Id': 'string',
                          'Arn': 'string'
                      },
                      'LevelThree': {
                          'Id': 'string',
                          'Arn': 'string'
                      },
                      'LevelFour': {
                          'Id': 'string',
                          'Arn': 'string'
                      },
                      'LevelFive': {
                          'Id': 'string',
                          'Arn': 'string'
                      }
                  },
                  'Status': {
                      'StatusStartTimestamp': datetime(2015, 1, 1),
                      'StatusArn': 'string',
                      'StatusName': 'string'
                  },
                  'AvailableSlotsByChannel': {
                      'string': 123
                  },
                  'MaxSlotsByChannel': {
                      'string': 123
                  },
                  'ActiveSlotsByChannel': {
                      'string': 123
                  },
                  'Contacts': [
                      {
                          'ContactId': 'string',
                          'Channel': 'VOICE'|'CHAT'|'TASK'|'EMAIL',
                          'InitiationMethod': 'INBOUND'|'OUTBOUND'|'TRANSFER'|'QUEUE_TRANSFER'|'CALLBACK'|'API'|'DISCONNECT'|'MONITOR'|'EXTERNAL_OUTBOUND'|'WEBRTC_API'|'AGENT_REPLY'|'FLOW',
                          'AgentContactState': 'INCOMING'|'PENDING'|'CONNECTING'|'CONNECTED'|'CONNECTED_ONHOLD'|'MISSED'|'ERROR'|'ENDED'|'REJECTED',
                          'StateStartTimestamp': datetime(2015, 1, 1),
                          'ConnectedToAgentTimestamp': datetime(2015, 1, 1),
                          'Queue': {
                              'Id': 'string',
                              'Arn': 'string'
                          }
                      },
                  ],
                  'NextStatus': 'string'
              },
          ],
          'ApproximateTotalCount': 123
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **NextToken** *(string) --* 

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

        
      

      - **UserDataList** *(list) --* 

        A list of the user data that is returned.

        
        

        - *(dict) --* 

          Data for a user.

          
          

          - **User** *(dict) --* 

            Information about the user for the data that is returned. It contains the ``resourceId`` and ARN of the user.

            
            

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

              The unique identifier for the user.

              
            

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

              The Amazon Resource Name (ARN) for the user.

              
        
          

          - **RoutingProfile** *(dict) --* 

            Information about the routing profile that is assigned to the user.

            
            

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

              The identifier of the routing profile.

              
            

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

              The Amazon Resource Name (ARN) of the routing profile.

              
        
          

          - **HierarchyPath** *(dict) --* 

            Contains information about the levels of a hierarchy group assigned to a user.

            
            

            - **LevelOne** *(dict) --* 

              Information about level one.

              
              

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

                The unique identifier for the hierarchy group.

                
              

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

                The Amazon Resource Name (ARN) for the hierarchy group.

                
          
            

            - **LevelTwo** *(dict) --* 

              Information about level two.

              
              

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

                The unique identifier for the hierarchy group.

                
              

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

                The Amazon Resource Name (ARN) for the hierarchy group.

                
          
            

            - **LevelThree** *(dict) --* 

              Information about level three.

              
              

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

                The unique identifier for the hierarchy group.

                
              

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

                The Amazon Resource Name (ARN) for the hierarchy group.

                
          
            

            - **LevelFour** *(dict) --* 

              Information about level four.

              
              

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

                The unique identifier for the hierarchy group.

                
              

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

                The Amazon Resource Name (ARN) for the hierarchy group.

                
          
            

            - **LevelFive** *(dict) --* 

              Information about level five.

              
              

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

                The unique identifier for the hierarchy group.

                
              

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

                The Amazon Resource Name (ARN) for the hierarchy group.

                
          
        
          

          - **Status** *(dict) --* 

            The status of the agent that they manually set in their Contact Control Panel (CCP), or that the supervisor manually changes in the real-time metrics report.

            
            

            - **StatusStartTimestamp** *(datetime) --* 

              The start timestamp of the agent's status.

              
            

            - **StatusArn** *(string) --* 

              The Amazon Resource Name (ARN) of the agent's status.

              
            

            - **StatusName** *(string) --* 

              The name of the agent status.

              
        
          

          - **AvailableSlotsByChannel** *(dict) --* 

            A map of available slots by channel. The key is a channel name. The value is an integer: the available number of slots.

            
            

            - *(string) --* 
              

              - *(integer) --* 
        
      
          

          - **MaxSlotsByChannel** *(dict) --* 

            A map of maximum slots by channel. The key is a channel name. The value is an integer: the maximum number of slots. This is calculated from `MediaConcurrency <https://docs.aws.amazon.com/connect/latest/APIReference/API_MediaConcurrency.html>`__ of the ``RoutingProfile`` assigned to the agent.

            
            

            - *(string) --* 
              

              - *(integer) --* 
        
      
          

          - **ActiveSlotsByChannel** *(dict) --* 

            A map of active slots by channel. The key is a channel name. The value is an integer: the number of active slots.

            
            

            - *(string) --* 
              

              - *(integer) --* 
        
      
          

          - **Contacts** *(list) --* 

            A list of contact reference information.

            
            

            - *(dict) --* 

              Information about the `contact <https://docs.aws.amazon.com/connect/latest/APIReference/API_Contact.html>`__ associated to the user.

              
              

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

                The identifier of the contact in this instance of Amazon Connect.

                
              

              - **Channel** *(string) --* 

                The channel of the contact.

                
              

              - **InitiationMethod** *(string) --* 

                How the contact was initiated.

                
              

              - **AgentContactState** *(string) --* 

                The `state of the contact <https://docs.aws.amazon.com/connect/latest/adminguide/about-contact-states.html>`__.

                 

                .. note::

                  

                  When ``AgentContactState`` is set to ``CONNECTED_ONHOLD``, ``StateStartTimestamp`` is not changed. Instead, ``StateStartTimestamp`` reflects the time the contact was ``CONNECTED`` to the agent.

                  

                
              

              - **StateStartTimestamp** *(datetime) --* 

                The epoch timestamp when the contact state started.

                
              

              - **ConnectedToAgentTimestamp** *(datetime) --* 

                The time at which the contact was connected to an agent.

                
              

              - **Queue** *(dict) --* 

                Contains information about a queue resource for which metrics are returned.

                
                

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

                  The identifier of the queue.

                  
                

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

                  The Amazon Resource Name (ARN) of the queue.

                  
            
          
        
          

          - **NextStatus** *(string) --* 

            The Next status of the agent.

            
      
    
      

      - **ApproximateTotalCount** *(integer) --* 

        The total count of the result, regardless of the current page size.

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

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

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

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

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

  