:doc:`LexModelsV2 <../../lexv2-models>` / Client / list_session_analytics_data

***************************
list_session_analytics_data
***************************



.. py:method:: LexModelsV2.Client.list_session_analytics_data(**kwargs)

  

  Retrieves a list of metadata for individual user sessions with your bot. The ``startDateTime`` and ``endDateTime`` fields are required. These fields define a time range for which you want to retrieve results. Of the optional fields, you can organize the results in the following ways:

   

  
  * Use the ``filters`` field to filter the results and the ``sortBy`` field to specify the values by which to sort the results.
   
  * Use the ``maxResults`` field to limit the number of results to return in a single response and the ``nextToken`` field to return the next batch of results if the response does not return the full set of results.
  

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/models.lex.v2-2020-08-07/ListSessionAnalyticsData>`_  


  **Request Syntax**
  ::

    response = client.list_session_analytics_data(
        botId='string',
        startDateTime=datetime(2015, 1, 1),
        endDateTime=datetime(2015, 1, 1),
        sortBy={
            'name': 'ConversationStartTime'|'NumberOfTurns'|'Duration',
            'order': 'Ascending'|'Descending'
        },
        filters=[
            {
                'name': 'BotAliasId'|'BotVersion'|'LocaleId'|'Modality'|'Channel'|'Duration'|'ConversationEndState'|'SessionId'|'OriginatingRequestId'|'IntentPath',
                'operator': 'EQ'|'GT'|'LT',
                'values': [
                    'string',
                ]
            },
        ],
        maxResults=123,
        nextToken='string'
    )
    
  :type botId: string
  :param botId: **[REQUIRED]** 

    The identifier for the bot for which you want to retrieve session analytics.

    

  
  :type startDateTime: datetime
  :param startDateTime: **[REQUIRED]** 

    The date and time that marks the beginning of the range of time for which you want to see session analytics.

    

  
  :type endDateTime: datetime
  :param endDateTime: **[REQUIRED]** 

    The date and time that marks the end of the range of time for which you want to see session analytics.

    

  
  :type sortBy: dict
  :param sortBy: 

    An object specifying the measure and method by which to sort the session analytics data.

    

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

      The measure by which to sort the session analytics data.

       

      
      * ``conversationStartTime`` – The date and time when the conversation began. A conversation is defined as a unique combination of a ``sessionId`` and an ``originatingRequestId``.
       
      * ``numberOfTurns`` – The number of turns that the session took.
       
      * ``conversationDurationSeconds`` – The duration of the conversation in seconds.
      

      

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

      Specifies whether to sort the results in ascending or descending order.

      

    
  
  :type filters: list
  :param filters: 

    A list of objects, each of which describes a condition by which you want to filter the results.

    

  
    - *(dict) --* 

      Contains fields describing a condition by which to filter the sessions. The expression may be understood as ``name`` ``operator`` ``values``. For example:

       

      
      * ``LocaleId EQ en`` – The locale is "en".
       
      * ``Duration GT 200`` – The duration is greater than 200 seconds.
      

       

      The operators that each filter supports are listed below:

       

      
      * ``BotAlias`` – ``EQ``.
       
      * ``BotVersion`` – ``EQ``.
       
      * ``LocaleId`` – ``EQ``.
       
      * ``Modality`` – ``EQ``.
       
      * ``Channel`` – ``EQ``.
       
      * ``Duration`` – ``EQ``, ``GT``, ``LT``.
       
      * ``conversationEndState`` – ``EQ``, ``CO``.
       
      * ``SessionId`` – ``EQ``.
       
      * ``OriginatingRequestId`` – ``EQ``.
       
      * ``IntentPath`` – ``EQ``.
      

      

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

        The category by which to filter the sessions. The descriptions for each option are as follows:

         

        
        * ``BotAlias`` – The name of the bot alias.
         
        * ``BotVersion`` – The version of the bot.
         
        * ``LocaleId`` – The locale of the bot.
         
        * ``Modality`` – The modality of the session with the bot (audio, DTMF, or text).
         
        * ``Channel`` – The channel that the bot is integrated with.
         
        * ``Duration`` – The duration of the session.
         
        * ``conversationEndState`` – The final state of the session.
         
        * ``SessionId`` – The identifier of the session with the bot.
         
        * ``OriginatingRequestId`` – The identifier of the first request in a session.
         
        * ``IntentPath`` – The order of intents taken in a session.
        

        

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

        The operation by which to filter the category. The following operations are possible:

         

        
        * ``CO`` – Contains
         
        * ``EQ`` – Equals
         
        * ``GT`` – Greater than
         
        * ``LT`` – Less than
        

         

        The operators that each filter supports are listed below:

         

        
        * ``BotAlias`` – ``EQ``.
         
        * ``BotVersion`` – ``EQ``.
         
        * ``LocaleId`` – ``EQ``.
         
        * ``Modality`` – ``EQ``.
         
        * ``Channel`` – ``EQ``.
         
        * ``Duration`` – ``EQ``, ``GT``, ``LT``.
         
        * ``conversationEndState`` – ``EQ``, ``CO``.
         
        * ``SessionId`` – ``EQ``.
         
        * ``OriginatingRequestId`` – ``EQ``.
         
        * ``IntentPath`` – ``EQ``.
        

        

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

        An array containing the values of the category by which to apply the operator to filter the results. You can provide multiple values if the operator is ``EQ`` or ``CO``. If you provide multiple values, you filter for results that equal/contain any of the values. For example, if the ``name``, ``operator``, and ``values`` fields are ``Modality``, ``EQ``, and ``[Speech, Text]``, the operation filters for results where the modality was either ``Speech`` or ``Text``.

        

      
        - *(string) --* 

        
    
    

  :type maxResults: integer
  :param maxResults: 

    The maximum number of results to return in each page of results. If there are fewer results than the maximum page size, only the actual number of results are returned.

    

  
  :type nextToken: string
  :param nextToken: 

    If the response from the ListSessionAnalyticsData operation contains more results than specified in the maxResults parameter, a token is returned in the response.

     

    Use the returned token in the nextToken parameter of a ListSessionAnalyticsData request to return the next page of results. For a complete set of results, call the ListSessionAnalyticsData operation until the nextToken returned in the response is null.

    

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

    
    ::

      {
          'botId': 'string',
          'nextToken': 'string',
          'sessions': [
              {
                  'botAliasId': 'string',
                  'botVersion': 'string',
                  'localeId': 'string',
                  'channel': 'string',
                  'sessionId': 'string',
                  'conversationStartTime': datetime(2015, 1, 1),
                  'conversationEndTime': datetime(2015, 1, 1),
                  'conversationDurationSeconds': 123,
                  'conversationEndState': 'Success'|'Failure'|'Dropped',
                  'mode': 'Speech'|'Text'|'DTMF'|'MultiMode',
                  'numberOfTurns': 123,
                  'invokedIntentSamples': [
                      {
                          'intentName': 'string'
                      },
                  ],
                  'originatingRequestId': 'string'
              },
          ]
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **botId** *(string) --* 

        The unique identifier of the bot that the sessions belong to.

        
      

      - **nextToken** *(string) --* 

        If the response from the ListSessionAnalyticsData operation contains more results than specified in the maxResults parameter, a token is returned in the response.

         

        Use the returned token in the nextToken parameter of a ListSessionAnalyticsData request to return the next page of results. For a complete set of results, call the ListSessionAnalyticsData operation until the nextToken returned in the response is null.

        
      

      - **sessions** *(list) --* 

        A list of objects, each of which contains information about a session with the bot.

        
        

        - *(dict) --* 

          An object containing information about a specific session.

          
          

          - **botAliasId** *(string) --* 

            The identifier of the alias of the bot that the session was held with.

            
          

          - **botVersion** *(string) --* 

            The version of the bot that the session was held with.

            
          

          - **localeId** *(string) --* 

            The locale of the bot that the session was held with.

            
          

          - **channel** *(string) --* 

            The channel that is integrated with the bot that the session was held with.

            
          

          - **sessionId** *(string) --* 

            The identifier of the session.

            
          

          - **conversationStartTime** *(datetime) --* 

            The date and time when the conversation began. A conversation is defined as a unique combination of a ``sessionId`` and an ``originatingRequestId``.

            
          

          - **conversationEndTime** *(datetime) --* 

            The date and time when the conversation ended. A conversation is defined as a unique combination of a ``sessionId`` and an ``originatingRequestId``.

            
          

          - **conversationDurationSeconds** *(integer) --* 

            The duration of the conversation in seconds. A conversation is defined as a unique combination of a ``sessionId`` and an ``originatingRequestId``.

            
          

          - **conversationEndState** *(string) --* 

            The final state of the conversation. A conversation is defined as a unique combination of a ``sessionId`` and an ``originatingRequestId``.

            
          

          - **mode** *(string) --* 

            The mode of the session. The possible values are as follows:

             

            
            * ``Speech`` – The session was spoken.
             
            * ``Text`` – The session was written.
             
            * ``DTMF`` – The session used a touch-tone keypad (Dual Tone Multi-Frequency).
             
            * ``MultiMode`` – The session used multiple modes.
            

            
          

          - **numberOfTurns** *(integer) --* 

            The number of turns that the session took.

            
          

          - **invokedIntentSamples** *(list) --* 

            A list of objects containing the name of an intent that was invoked.

            
            

            - *(dict) --* 

              An object containing the name of an intent that was invoked.

              
              

              - **intentName** *(string) --* 

                The name of an intent that was invoked.

                
          
        
          

          - **originatingRequestId** *(string) --* 

            The identifier of the first request in a session.

            
      
    
  
  **Exceptions**
  
  *   :py:class:`LexModelsV2.Client.exceptions.ThrottlingException`

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

  
  *   :py:class:`LexModelsV2.Client.exceptions.PreconditionFailedException`

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

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

  