Building a status widget in our Android app and need to know which endpoint to hit. The docs for GET /api/v2/conversations list state as active or inactive, but GET /api/v2/analytics/conversations/summary gives granular metrics like talk or hold. If I just need to check if a specific conversationId is currently ringing, should I stick with the v2/conversations endpoint or query analytics? The analytics call feels heavy for a simple status check.
Stick with GET /api/v2/conversations. The analytics endpoint is for historical summaries and aggregations, not real-time state checks. It’s slow and overkill for a simple status widget. The conversations API returns the current state immediately.
Here’s how you’d query it using the PureCloud SDK to check if a conversation is ringing:
from purecloudplatformclientv2 import ConversationApi
api_instance = ConversationApi()
try:
# Fetch specific conversation by ID
result = api_instance.get_conversation(conversation_id='your-conversation-id')
# Check the state
if result.state == 'active':
print("Conversation is active/ringing")
else:
print("Conversation is inactive")
except Exception as e:
print("Error: %s\n" % e)
Just map the state field to your UI. If you need more granular data like hold times, you might need to poll the conversation details, but for basic active/inactive, this is the right call. Don’t mix up the two endpoints or you’ll get stale data.