Skip to content

Amazon connect- SearchContacts API fails to return live/active voice contacts waiting in an unstaffed queue (0 agents online)

0

Context: We are testing Amazon Connect queue behavior under an unstaffed queue scenario (0 agents online, 0 agents available). An inbound voice contact enters the system, successfully triggers a "Transfer to Queue" block, and displays as "1 contact waiting in queue" on the Real-Time Metrics dashboard.

The Problem: We need a programmatic way to retrieve the ContactId for these stuck contacts using the AWS CLI or SDK APIs to automate a cleanup/purge process. However, standard search APIs completely fail to surface the active record.

Observed API Behaviors:

  1. aws connect search-contacts:
  • Fails when using ENQUEUE_TIMESTAMP without explicit criteria filters (Unsupported time range type).
  • When switching to INITIATION_TIMESTAMP and filtering for DisconnectTimestamp == null, the API returns zero results for the live queued contact.
  • It only surfaces the record after the contact hangs up or disconnects.
  1. aws connect get-current-user-data:
  • Returns zero results when filtering by the specific QueueId. This appears to be because no active agent session is attached to the contact since staffing is at zero.
  1. aws connect describe-contact:
  • When we manually fish the ContactId out of CloudWatch Contact Flow logs, running describe-contact successfully prints the metadata. It clearly shows a valid QueueInfo block with an EnqueueTimestamp, but DisconnectTimestamp is naturally missing.

Question: Why does the SearchContacts API index completely ignore active, queued voice interactions when a queue has zero staffed agents? Is this a known architectural constraint or indexing lag with active voice contacts?

Moving to production with millions of parallel records, parsing CloudWatch log groups is not a viable strategy. What is the recommended programmatic approach to capture these specific unassigned, stuck ContactIds in real-time? Is an asynchronous Kinesis CTR stream or EventBridge pattern the only reliable solution for this?

AWS
SUPPORT ENGINEER

asked 4 months ago120 views

2 Answers
0
Accepted Answer

Question 1: This is an architectural specification.

The official AWS documentation, Search for in-progress contacts in Connect Customer - Amazon Connect Customer explicitly describes this behavior.

For other voice contacts, you can search them only after they are connected to an agent, or have been disconnected. Queued in-progress voice contacts (with the exception of callbacks) are not shown on the Contact search page.

In other words, by design, voice contacts other than callbacks are excluded from the search index while waiting in the queue. This is an intentional design constraint of the indexing infrastructure underlying the SearchContacts API; it is not a matter of latency where they will "eventually be indexed." They will not appear in search results at all until they are connected to an agent or disconnected.

Question 2: The Kinesis CTR stream is actually not suitable.

Contact Trace Record (CTR) streams via Kinesis are generated and delivered only after a contact has concluded (disconnected). In other words, monitoring the CTR stream does not allow you to detect—in real time—contacts that are currently waiting in the queue and have not yet disconnected. Fundamentally, CTRs are "post-completion records," and they simply inherit the same limitations as the SearchContacts API, albeit in a different form. What you should actually use is "Connect Contact Events" via EventBridge. Amazon Connect natively publishes contact lifecycle events to EventBridge; the available event types are as follows:

  • INITIATED
  • CONNECTED_TO_SYSTEM
  • QUEUED ← This directly matches your requirements
  • CONNECTED_TO_AGENT
  • DISCONNECTED
EXPERT

answered 4 months ago

EXPERT

reviewed 4 months ago

0

The behavior you're experiencing with the SearchContacts API is related to how Amazon Connect indexes and surfaces contact records. The SearchContacts API primarily works with completed contact records, which explains why you're not seeing live, queued contacts until after they disconnect.

For real-time visibility into active contacts—especially those waiting in unstaffed queues—the recommended approach is to use Amazon Connect contact events via Amazon EventBridge rather than relying on search APIs.

Here's why this is the appropriate solution:

Contact Events Architecture: Contact events provide a real-time stream of events as they occur in your contact center. When a contact enters a queue, a QUEUED event is emitted that includes the ContactId, queue information, and enqueue timestamp. These events fire immediately as state changes happen, regardless of agent staffing levels.

Key Events for Your Use Case:

  • QUEUED event: Fires when a contact enters a queue, providing the ContactId and QueueInfo with enqueue timestamp
  • CONNECTED_TO_AGENT event: Fires when an agent picks up (which won't happen in your unstaffed scenario)
  • DISCONNECTED event: Fires when the contact leaves the system

By subscribing to these events through EventBridge, you can:

  1. Capture ContactIds as soon as contacts enter unstaffed queues
  2. Track how long they've been waiting
  3. Trigger automated cleanup or escalation workflows
  4. Maintain your own real-time index of stuck contacts

Implementation Pattern: Create an EventBridge rule that filters for QUEUED events on your target queues. Route these events to a Lambda function or SQS queue that maintains a tracking table (like DynamoDB). When DISCONNECTED events arrive, remove those ContactIds from your tracking system. This gives you a real-time view of all active queued contacts, regardless of staffing.

The SearchContacts API and GetCurrentUserData API are designed for different purposes—historical analysis and agent-centric views respectively—which is why they don't reliably surface unassigned, actively queued contacts. For production-scale real-time monitoring of contacts in queue states, the EventBridge contact events pattern is the architecturally correct approach.
Sources
Connect Customer contact events - Amazon Connect Customer

answered 4 months ago

EXPERT

reviewed 4 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.