Hi ,
We want to pull conversation details using APIs as they happen at the interval of 30 min.
Please suggest which API to use. Below API seems is not giving live data
#######################################################
import base64, sys, requests, os
from datetime import datetime, timedelta
import PureCloudPlatformClientV2
from pprint import pprint
from PureCloudPlatformClientV2.rest import ApiException
def get_interval_string():
""" Gets an ISO-8601 interval from now for the last 7 days """
now = datetime.now().replace(microsecond=0)
week_ago = (now - timedelta(minutes=10)).replace(microsecond=0)
return f"{ week_ago.isoformat() }/{ now.isoformat() }"
print("-------------------------------------------------------------")
print("- Querying Queue Historical Statistics -")
print("-------------------------------------------------------------")
CLIENT_ID = os.environ['GENESYS_CLOUD_CLIENT_ID']
CLIENT_SECRET = os.environ['GENESYS_CLOUD_CLIENT_SECRET']
ORG_REGION = os.environ['GENESYS_CLOUD_REGION']
region = PureCloudPlatformClientV2.PureCloudRegionHosts[ORG_REGION]
PureCloudPlatformClientV2.configuration.host = region.get_api_host()
api_client = PureCloudPlatformClientV2.api_client.ApiClient()
.get_client_credentials_token(CLIENT_ID, CLIENT_SECRET)
analytics_api = PureCloudPlatformClientV2.AnalyticsApi(api_client)
query = PureCloudPlatformClientV2.ConversationQuery()
query.interval = get_interval_string() # "2022-03-29T00:00:00/2022-03-29T00:10:00"
print(f"query: {query}")
#query_result = analytics_api.get_analytics_conversations_details()
query_result = analytics_api.post_analytics_conversations_details_query(query)
print(f"queryResult: {query_result}")